Questions tagged [triangular]

Use this tag when you have a programmatic problem related to coordinates, area, or any other property of a shape that forms a triangle.

The shape formed by a polygon which has three sides is said to be triangular in nature.

Triangular shape has been discussed, analyzed, formed mathematical formulas around, explained in different contexts since the inception of the idea of geometry.

You can read more about triangular shape and it's properties here.

157 questions
1
vote
2 answers

Constructing Triangular Mesh for 3-Dimensional Data Surface Data in Python

I have a dataset of 3-dimensional points for which I'd like to construct a mesh, using python. All the software I've seen requires that you provide the edges. Is there a program in python which takes as the input a set of points in 3D and outputs a…
Eliezer
  • 747
  • 7
  • 7
1
vote
1 answer

How to apply grid only on lower triangular area of a heatmap?

I created a heatmap and masked out the upper triangular portion of it. But when I am applying line width to it, grid is appearing to the whole portion of the heatmap. But I want mask out the upper section. Can anyone help me with it? My code, import…
1
vote
1 answer

Python/Maths: Convert a matrix into a lower triangular matrix

I defined the matrix a. Then I wrote an algorithm which turns the matrix a into a lower triangular matrix (I provided the programme below) The algorithm does work because if I do "print(" ")" at the end of the algorithm I do receive a lower…
sakabukayo
  • 33
  • 4
1
vote
2 answers

C# Program can't view the result of triangle area using heron's formula

I've been trying to solve this problem about my program about printing the final result of Area of Triangle using Heron's Formula with user input static void Main(string[] args) { //variable/s declaration double a, b, c,…
jhun mcgee
  • 19
  • 2
1
vote
4 answers

Linear index for a diagonal run of an upper triangular matrix

Given a NxN matrix, I would like to linearly index into its upper right triangle, following a diagonal by diagonal pattern, starting after the main diagonal. For example, given a 4x4 matrix X 0 3 5 X X 1 4 X X X 2 X X X X I'm looking for a non…
Mat
  • 63
  • 6
1
vote
0 answers

What is the fastest way to compute a matrix exponetial for upper triangular matricies?

I'm working on a scientific python project where I need to evaluate a lot of matrix exponential functions of the form exp(M). Currently, I'm using the scipy.linalg.expm function to evaluate this expression but even for my smallish test cases this…
zifn
  • 11
  • 1
1
vote
1 answer

Monte Carlo simulation from a triangular distribution in Python

I'm new to python and trying to use the numpy.random triangular function to run a series of Monte Carlo simulations from several triangular distributions and then append the simulation outputs from each run. The sample data is as below. ID Low …
BMM
  • 63
  • 7
1
vote
2 answers

Find max matching 3 Triangular numbers

It's well known that any positive number can be expressed through at most 3 Triangular numbers. ( https://oeis.org/A000217 ) Example: 11 := 10 + 1 12 := 10 + 1 + 1 13 := 10 + 3 14 := 10 + 3 + 1 15 := 15 I am searching the representation of the…
TTho Einthausend
  • 609
  • 4
  • 13
1
vote
1 answer

NumPy - Create Upper Triangular Matrix with Diagonals of Increasing Power

I'd like to create a square upper triangular matrix that is defined as follows for some float c and some dimension N: [[1 , c , c^2, ... c^N], [0, 1 , c, ... c^{N-1}], [0, 0 , 1, ... c^{N-2}], . . . [0, 0 , 0, .... 1]] For…
Rylan Schaeffer
  • 1,945
  • 2
  • 28
  • 50
1
vote
1 answer

How to fill specific elements of a matrix knowing their indices with values from a column vector

How can I fill the elements of the lower triangular part of a matrix, including the diagonal, with values from a column vector? For example i have : m=np.zeros((3,3)) n=np.array([[1],[1],[1],[1],[1],[1]]) #column vector I want to replace values…
Wejdene
  • 17
  • 1
  • 2
1
vote
1 answer

Given a, b, c and alpha find x

I was doing image processing to determine the distance between two points in a picture. it involves a fair amount of geometry. One of the problems which I tried to solve using basic geometry but failed to arrive at a solution is the following. I…
1
vote
1 answer

Checking if a number is triangular

So i have this predicate triangular(N) in which N is a number and this predicate return true if a number is a triangular number. My problem is this for some reason my predicate does an infinite loop instead of just summing the numbers until the…
Martim Correia
  • 483
  • 5
  • 16
1
vote
1 answer

Expressing a number as the sum of two triangular numbers

A triangular number or triangle number counts objects arranged in an equilateral triangle. Their formula is n(n+1)/2. I want to write a number as the sum of two triangular numbers. ( 24=21+3 ; 48=45+3 ) I have written some code in C++ that does…
1
vote
1 answer

Converting a vector in R into a lower/upper triangular matrix in specific order

I have a vector where the order of the elements are important, for example: v<-c(1,2,3,4,5,6,7,8,9,10) I would like to arrange my vector into a lower/upper triangular matrix with a specific order: 1 2 4 7 0 3 5 8 0 0 6 9 0 0 0 10 or 1 0 0 0 2 3 0…
Beth
  • 127
  • 6
1
vote
1 answer

Triangular heatmap from 3-column dataframe

I have a dataframe with two categorical columns and a third with integers: import pandas as pd df1 = pd.DataFrame({ 'First': ['A','A','A','B','B','C'], 'Second': ['B','C','D','C','D','D'], 'Value': [1,2,3,4,5,6]} ) df1 First …
JRCX
  • 249
  • 2
  • 14