Post Reply 
Pascal triangle to a matrix
11-22-2019, 01:07 PM (This post was last modified: 11-22-2019 01:28 PM by toml_12953.)
Post: #2
RE: Pascal triangle to a matrix
(11-22-2019 08:45 AM)Tonig00 Wrote:  Hello
I need some help. I do not program often and when I do I have doubts.

I try to put the values of the Pascal triangle,
1 --- m1(1,1)
1 1 --- m1(2,1) m1(2,2)
1 2 1 --- m1(3,1), etc
1 3 3 1
……………..
to a matrix that I call "m1" up to "f" lines, in the following way:

Thanks in advance for your help

Toni

What does COMB(0,0) even mean? I don't see it as being useful.

Try this:

Code:
EXPORT Tri_Pa(f)
BEGIN
   LOCAL n,m;
   LOCAL m1:=makemat(0,f,f);
   FOR n FROM 1 TO f DO
      FOR m FROM 1 TO n DO
         m1(n,m):=COMB(n,m);
      END;
   END;
END;

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Pascal triangle to a matrix - Tonig00 - 11-22-2019, 08:45 AM
RE: Pascal triangle to a matrix - toml_12953 - 11-22-2019 01:07 PM
RE: Pascal triangle to a matrix - Tonig00 - 11-22-2019, 07:14 PM



User(s) browsing this thread: 1 Guest(s)