Question: Padovan - is it possible to use seq?

Padovan is a British architect, more of whom van be found by googling 'Padovan series'.

  The program below draws the first few equilateral triangles of sides of which are in a series something akin to the Fibonacci sequence.  P(n)=P(n-2)+P(n-3).  It starts 1, 1, 1, 2,...The program below outputs a display of the first few such triangles, but is very klutsy.  It has a "manual input" for the various triangles.  I wondered if there was a quick way of doing this perhaps using theseq command?

  Thanks in advance.  David

 

 

 

 restart:

# # # # # # # # # # # # # # # # # # # # # # # # # # # #

#

#  Padovan

#

#  Series of equilaterla triangles of sides of length:

#  P(n)=P(n-2) + P(n-3)

# # # # # # # # # # # # # # # # # # # # # # # # # # # #

with(plots):

with(plottools):

# etring_up draws an equilateral triangle of side s, pointing up with # [x0,y0] being the coords of the "western most" vertex.

etring_up:=proc(x0,y0,s)

local tt, h:

h:=s*sqrt(3)/2:

tt:=polygon([[x0,y0],[x0+s/2,y0+h],[x0+s,y0]], color=brown, linestyle=1, thickness=1);

plots[display]([tt], scaling=constrained);

end proc:

 

# etring_down draws an equilateral triangle of side s, pointing down

# with [x0,y0] being the coords of the "western most" vertex.

etring_down:=proc(x0,y0,s)

local tt, h:

h:=s*sqrt(3)/2:  #2*s/sqrt(3):

#Only difference between two procs is the minus sign in [x0+s/2,y0-h]

tt:=polygon([[x0,y0],[x0+s/2,y0-h],[x0+s,y0]], color=red, linestyle=1, thickness=1);

plots[display]([tt], scaling=constrained);

end proc:

#etring_down(0,0,2);

#etring_up(0,0,2):

plots[display]([etring_down(0,0,1),etring_up(0,0,1),etring_down(1/2,sqrt(3)/2,1),etring_up(1/2,-sqrt(3)/2,2), etring_down(3/2, sqrt(3)/2,2),etring_up(1/2,sqrt(3)/2,3), etring_down(-2, 2*sqrt(3),4),etring_up(-9/2,-sqrt(3)/2,5),etring_down(-9/2,-sqrt(3)/2,7),etring_up(-1,-4*sqrt(3),9),etring_down(2,2*sqrt(3),12),etring_up(-2, 2*sqrt(3),16),etring_down(-15,10*sqrt(3),21)], scaling=constrained);

Please Wait...