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
1 answer

Prolog, triangular numbers, accumulators and tail recursion

I'm working on a homework assignment, consisting of 2 parts. The first is to write a Prolog program that checks if a certain pair X, Y belongs to a http://en.wikipedia.org/wiki/Triangular_number. For example: (2, 3) = true; (4, 10) = true et…
Oxymoron
  • 1,382
  • 4
  • 20
  • 40
1
vote
2 answers

Trisurf cannot plot into specified axis

I would like to make a triangular surface plot throught the function trisurf, targeting a specified axis. However, MATLAB documentation does not indicate any syntax to do that. When I open the function I get the following first lines: function hh =…
fma
  • 219
  • 2
  • 14
1
vote
1 answer

How to make a lower triangular matrix with steps of two positions

I have a matrix that looks like: x=[[a,b,c,d,e,f], [g,h,i,j,k,l], [m,n,o,p,q,r]] with a,b,c numbers. I am however only interested in the numbers at the lower left half and would like to creat a lower triangular matrix that goes by steps of…
Jellyse
  • 839
  • 7
  • 22
1
vote
3 answers

Print right angle triangle with characters

I want to create a right angled triangle made out of characters. The code asks you how many rows you want the triangle to be, and the maximum is 26 of course. When I test the code I input 5 (for no reason). This is my code so far: import…
Adam Rana
  • 23
  • 5
1
vote
0 answers

stm32 : How to synchronize DAC, ADC together?

I am using stm32L476 discovery board. I am trying to generate triangular wave with DAC. I am using two lookup tables for the DAC(1 for each up slope and down slope). I am giving sine wave at ADC input and I am getting some samples in triangular wave…
user8398475
  • 61
  • 2
  • 7
1
vote
3 answers

Wrong output when printing a tent shape with stars

I'm trying to print out a hollow, open tent shape using asterisk stars "*". The code uses two for loops, the first for the rows, and the other for the columns. following is my code: void printTent(int n) { int j = 1; int i = 1; if…
Moh'd H
  • 247
  • 1
  • 4
  • 16
1
vote
1 answer

2D orientation test barycentric coordinates

If I have an ordered 3-tuple of points in integer barycentric coordinates, how do I test orientation on them? (I want to know if the points are collinear, form a left turn or a right turn) The "algorithm" has to be quite robust so I don't want to…
mrmax1
  • 15
  • 2
1
vote
1 answer

angular material md-country-select not binding with ng-model

I am using angular material and md-country-select for countries dropdown but it is not binding with ng-model. Is this a bug or I am doing something wrong. I already used…
Qubaish Bhatti
  • 700
  • 5
  • 22
1
vote
2 answers

R reverse lower triangle matrix loop

I am trying to fill the lower diagonal of my matrix M with a prefilled vector, V My original matrix looks like similar to this: M = matrix(c(.3,.2,.1,0), nrow=4, ncol=5) M 1 2 3 4 5 1 .3 .3 .3 .3 .3 2 .2 .2 .2 .2 .3 3 .1 .1 .1 .1 .1 4 0 0 0 …
Max
  • 49
  • 6
1
vote
1 answer

Given lengths of 3 sides of a triangle, compute an average distance between the middle points of the sides

I have come across a problem. The problem statement is A team of 3 people, is going to participate in a competition. According to the regulations of this competition, every team is given a single computer, which is located on a triangular table,…
sanapala mohanarao
  • 321
  • 1
  • 2
  • 16
1
vote
1 answer

python, plot triangular function into 2d arrays

I'm new to python, in this case, I want to put my function into 2d arrays, so I can plot the function. Here is my triangle function, I'm using it for fuzzy logic: def triangle (z,a,b,c): if (z<=a) | (z>=c): y = 0 elif (a<=z) &…
prasta
  • 11
  • 1
  • 3
1
vote
3 answers

Giving an element from lower/upper triangular matrix

I have the upper triangular portion of a matrix, with the main diagonal stored as a linear array, how can the (i,j) indices of a matrix element be extracted from the linear index of the array? For example the linear array :[a0, a1, a2, a3, a4, a5,…
Bako
  • 313
  • 1
  • 15
1
vote
3 answers

How do you find which row and column a number belongs to in Floyd Triangle

How do you find which row and column does a number belongs to in Floyd Triangle? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54…
bbnn
  • 3,505
  • 10
  • 50
  • 68
1
vote
1 answer

Counting holes in a mesh

I have a special kind of triangular mesh. (i.e. I haven't used a regular algorithm to triangulate the set of points I have, but I followed a special algorithm to do this for chemical data). The result is a complicated 3D shape consits of a lot of…
The Maestro
  • 659
  • 1
  • 5
  • 21
1
vote
2 answers

What wrong with my Python code to check the triangular number?

def Triangular(n): arr = [] for i in range(n): T = i*(i+1)/2 arr.append(T) if n == any(arr): return True else: return False All test cases are in False. Please show me what I was wrong
Xèo
  • 13
  • 1
  • 3