das1404

135 Reputation

6 Badges

12 years, 78 days

MaplePrimes Activity


These are questions asked by das1404

I am trying to draw a tetrahedron and square based pyramid, having its triangular faces the same asthat of the tetrahedron.  While the geom3d package in Maple 7 has several polyhedra, a pyramid, or pentahedron(?) seem to be missing.  The closest is the octohedron - but this is two square pyramids "glued" together!   I'm totally bamboozled by the Polyhedron command with all its options.  Is it possible to somehow cut the octohedron in two, to get a pyramid?  Below is my Maple program, including at the end aplottools command to draw a separate ocotohedron.  

  Any help gratefully received.

     David

restart:
> #Puzzle Problem with tetrahedron and pyramid.  How many faces will
> #resultant polyhedron have when a triangular face of the pyramid is "glued" to  the tetrahedron.
> with(geom3d):

> print(`A pyramid and tetrahedron are shown: the triangular faces of each being the same dimensions. The`);
> print(`triangular face of the pyramid is attached to a triangular face of the tetrahedron.`);

> print(`How many faces does the resulting polyhedron have?`);
> print(`  a.) 5    b.) 6     c.) 7     d.) 8     e.) 9`);

> # octahedron, hexahedron, cube, icosahedron, dodecahedron - but pentahedron not supported in Maple 7 :-(
> RegularPolyhedron(d,[3,4],point(o,4,4,0),3):
> #dodecahedron(t,point(p,5,0,0),3):

> tetrahedron(t,point(p,5,0,0),3):
> #draw([d(color=red),t(color=green)],cutout=7/8,lightmodel=light4,
> draw([d(color=red),t(color=green)],title=`Tetrahedron & pyramid`,orientation=[45,45]);
> with(plottools):
> f := octahedron([0,0,0],1):  #, octahedron([1,1,1],0.5):
> plots[display](f,style=patch);

I am perplexed about the geometry and plots packages.  When starting a programme involving geometric shapes, how does one decide which to use?  ..Or can the two packages be used in the same programme?  To iiiustrate my question there is a text program below which draws a diagram of a large square, with a circle inscribed tangentially to the square.  There is then a further smaller concentric circle, with a square drawn inside; the vertices touching this circle.  (It isdesigned as a problem suitable for young high-school teenagers.)

   I wanted to fill in various regions of this diagram in colors red and green.  I believe the with(geometry) package does this easily.  However, as I'm more used to the with(plots) package I stuck to this.  To get the coloured regions I drew a sequence of colored lines.  I also drew a colored square (See    SmallSq:=[op(SmallSq),sq_small||ii]:   ) by drawing a seq of concentric squares.  At the end of my program there are two almost identical plots[display] commands.   The difference is that the first does not incude the SmallSq.  I was expecting the two displays to be identical, since I'd specified the color white.  The first display has a dark colored square.  Why?? .  

   .   The program is very klutsy!  I'm embarrassed to publish it:-(  The SmallSq is adequate for my purposes, but has several white spaces - almost dots - on the dark version.  The thickness and style of the lines was the widest possible  - perhaps I should have set the larger rarius R, to a bigger value?

   And I have a feeling this diagram could have been constructed ib the geometry package in far fewer lines of code!

As always, any comments, suggestions would be most appreciated.

  David

 

 

> restart:
> # # # # # # # # # # # # # # # # # # # # # # # # # # # #

# Maple 7
> # Area puzzle involving squares & circles
> #To Do:  fill areas with color
> #  Use segment command and seq to make a set of colored lines
> #NB  Numbering for lines L1 is 1,2,3,4 for N,E,S,West
> #    Numbering for lines L2 is 1,2,4,3 for N,E,S,West
> # # # # # # # # # # # # # # # # # # # # # # # # # # # #
> with(plots):
> with(plottools):
> print(`The diagram shows two squares and two circles.`);
> print(`The red and green regions are equal in area.`);
> print(`To find the ratio of the radius of the large circle to the
> smaller.`);

> #Doesn't seem to like a combination of geometry & with plots
> #with(geometry);
> r:=R*sqrt((4-Pi)/(Pi-2));  #for the pretty printout only!
> R:=49:
> r:=R*sqrt((4-Pi)/(Pi-2)):  #give r a numerical value
> c_big := circle([0,0], R, color=red):
> c_small := circle([0,0], r, color=green):
> sq_big := rectangle([-R,R], [R,-R], color=white):
> #sq_small := rectangle([-r/sqrt(2),r/sqrt(2)], [r/sqrt(2),-r/sqrt(2)],
> color=white):
> #y:=R/2:

> SmallSq:=[]:
> for ii from 1 to round(r) do
> sq_small||ii := rectangle([-ii/sqrt(2),ii/sqrt(2)],
> [ii/sqrt(2),-ii/sqrt(2)], color=white,linestyle=1 , thickness=3):
> SmallSq:=[op(SmallSq),sq_small||ii]:
> end do:

> Llines1:=[]:Llines2:=[]:Llines3:=[]:Llines4:=[]:
> for yy from 1 by 1 to R do
> l1||yy := line([-R,yy], [-sqrt(R^2-yy^2),yy], color=red, linestyle=1 ,
> thickness=3):
> l2||yy := line([sqrt(R^2-yy^2),yy], [R,yy], color=red, linestyle=1 ,
> thickness=3):
> l3||yy := line([sqrt(R^2-yy^2),-yy], [R,-yy], color=red, linestyle=1 ,
> thickness=3):
> l4||yy := line([-sqrt(R^2-yy^2),-yy], [-R,-yy], color=red, linestyle=1
> , thickness=3):
> #List of lines is Llines
> Llines1:=[op(Llines1),l1||yy]:
> Llines2:=[op(Llines2),l2||yy]:
> Llines3:=[op(Llines3),l3||yy]:
> Llines4:=[op(Llines4),l4||yy]:
> end do:
> first:=round(r*(sqrt(2))/2)+1:
> last:=round(r):
> L2lines1:=[]:L2lines2:=[]:L2lines2D:=[]:L2lines3:=[]:L2lines3Up:=[]:L2
> lines4:=[]:
> for yy from first by 1 to last do
> l2_1||yy := line([-sqrt(r^2-yy^2),yy], [sqrt(r^2-yy^2),yy],
> color=green, linestyle=1 , thickness=3):
> #l2_2||yy := line([yy,r/sqrt(2)],[yy,sqrt(r^2-yy^2)],  color=green,
> linestyle=1 , thickness=3):
> l2_2||yy := line([yy,sqrt(r^2-yy^2)],[yy,0],  color=green, linestyle=1
> , thickness=3):
> l2_2D||yy := line([yy,-sqrt(r^2-yy^2)],[yy,0],  color=green,
> linestyle=1 , thickness=3):

> l2_3||yy := line([-yy,-sqrt(r^2-yy^2)],[-yy,0],  color=green,
> linestyle=1 , thickness=3):
> l2_3Up||yy := line([-yy,sqrt(r^2-yy^2)],[-yy,0],  color=green,
> linestyle=1 , thickness=3):

> l2_4||yy := line([-sqrt(r^2-yy^2),-yy], [sqrt(r^2-yy^2),-yy],
> color=green, linestyle=1 , thickness=3):
> #List of lines is Llines
> L2lines1:=[op(L2lines1),l2_1||yy]:
> L2lines2:=[op(L2lines2),l2_2||yy]:
> L2lines2D:=[op(L2lines2D),l2_2D||yy]:
> L2lines3:=[op(L2lines3),l2_3||yy]:
> L2lines3Up:=[op(L2lines3Up),l2_3Up||yy]:
> L2lines4:=[op(L2lines4),l2_4||yy]:
> end do:


> plots[display](c_big,c_small,Llines1,Llines2,Llines3,L2lines1,L2lines2
> ,L2lines2D,Llines4, L2lines3,L2lines3Up,L2lines4,
> scaling=constrained);
> plots[display](c_big,c_small,Llines1,Llines2,Llines3,Llines4,L2lines1,
> L2lines2,L2lines2D,L2lines3,L2lines3Up,
> L2lines4,SmallSq,scaling=constrained);


Warning, the name changecoords has been redefined

Warning, the name arrow has been redefined


            The diagram shows two squares and two circles.


             The red and green regions are equal in area.


  To find the ratio of the radius of the large circle to the small\
        er.


                                     4 - Pi
                         r := R sqrt(------)
                                     Pi - 2
 

Am trying to draw a series of triangles for animation.  I try to construct the triangles in a loop using:

triangle(cat(T1,`a`),[A,B,C]):

  so that the names of the triangles are meant to beT14, T15, T16

I have tried unsuccessfully to use the plots and draw commands ie

draw({seq(tabl[i], i=4..6)}, insequence=true, scaling=constrained);

plots[display({seq(tabl[i], i=4..6)}, insequence=true, scaling=constrained);

  Can the animation be done in either?  

It seems to want a variable in a list/set format - How do I set that up?  Any comments, or help gratefully received.  The program is below.  Part of the output does give triangles - but they all seem identical:-(

 

restart:

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

# Altitude exploration  program

#Trying to draw a sequence of triangles for animation

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

with(plots):

with(geometry):

for a from 4 to 6 do

b:=a+1: c:=a+2:

angA:=arccos((a+5)/2/(a+2));

point(A,0,0),point(B,c*cos(angA),c*sin(angA)),point(C,a+1,0):

tabl[a]:=triangle(cat(T1,`a`),[A,B,C]):

printf("a=%d\n",a);

triangle(cat(T1,`a`),[A,B,C]):

end do:
 

for i from 4 to 6 do

draw({seq(tabl[i], i=4..6)}, scaling=constrained);

printf("a=%d\n",i);

end do;
 

print(`After do`);

draw({seq(tabl[i], i=4..6)}, insequence=true, scaling=constrained);

Warning, the name changecoords has been redefined

 

Warning, the name arrow has been redefined

 

Warning, these names have been redefined: circle, ellipse, homothety, hyperbola, line, point

 

a=4

a=5

a=6

a=4

a=5

a=6

I'd like to find the harmonic mean of the lengths of the three altitudes of a triangle.  I believe this to be equal to the radius of the incenter of the triangle.  I haven't used the geometry package  much, but notice it has some interesting features like Harmonic mean. (Incidentally, it has a vertex, and vertices command, but these don't seem to be recognised in Maple 7 - not even in the Help section.)  I would normally tackle thissue  problem using coordinate geometry, and give a diagram of the triangle using the plots [display] command.  Id like some advice about the interactivity of commands in geometry and plots packages eg  can I find the coordinates of the base of an altitudemail using the geometry package?  There is an altitude command which gives the àltitude's equation.  For this the coding would be

:triangle(ABC, [point (A,0,0),point (B,,2,0), point (C,1,3)]:

altitude (hA1,A, ABC);

detail (hA1);

   I think I have answered my own question!  I see there is a DefinedAs command which would give me the coords.   Am I correct in thinking the geometry package is the best method of doing this.  Later I was hoping to display animation, to see how the Harmonic mean changes with varying different triangles.

Thanks for reading this and Happy New Year.

David  

Am trying to teach myself "circle inversion" to solve circle geometry problems.  Towards this end I wrote a Maple 7 program to draw a Pappus chain of circles.  Pappus lived around 200AD, and I read that he considered this problem ancient!  

   The output diagram may not come out on this forum, but it comes out as a collection of tangential circles, and I have no problems with that.  In drawing the circles I was thinking of using the infinity symbol.  The following line uses the infinity, but with a minus sign.  Maple is "happy" with this and outputs square braces, suggesting an empty list?  I changed the program by omitting the -ve sign - and Maple came up with an error message.  I would have expected the output to include the value zero  ie [0]  I think it is just that the infinity symbol is not allowed in the seq command. 

[seq( i, i=0..-infinity )];  #???  why the -?,

 

In the next part I define X, Y and rad as the coordinates and radii of a sequence of circles: subscript i, ranging from start to nterm, (for the number of terms).  These are set at 1 and 286.   The program works OK with these values, but if the variable start is changed to zero, 0, it doesn't work.  I thought I might have a division by zero, but can't find one.  I also drew a circle with a radius of zero - no problem!  (...except it's difficult to see:-))   

   My main puzzle is why does it come up with the error message "invalid subscript selector" when the variable start is set to 0?

With i=start=0 I am asking it to draw a circle of radius zero at some specified coords - but it doesn't like it!  

  Any comments would be appreciated.  Merry Christmas.

David

 

 

restart:

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

# Pappus Chain of circles

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

with(plots):

with(plottools):

#Maple 7

#r is ratio of AC/AB = diam of large circle, to a smaller internally tangential one

r:=1.35:

#Why will start=0 not work?

start:=1:

#nterm=286 is smallest value where axes have "true" origin of (0.0)

#nterm<= 285 puts "x-axis" below y=-0.6

nterm:=286:

X := [seq( 0.5*r*(1+r)/(((i*(1-r))^2)+r), i=start..nterm )]:

 

Y := [seq( i*r*(1-r)/(((i*(1-r))^2)+r), i=start..nterm )]:

rad:=[seq(0.5*r*(1-r)/((i*(1-r))^2+r), i=start..nterm)]:

[seq( i, i=0..-infinity )];  #???  why the -?

#Gives [] output with -ve sign:  empty list?  Why is 0 not included?

# Not allowed to use with seq

#ccc:=[seq(circle([X[i],Y[i]],rad[i]), i=1..5)]:  #nops(X))]:

ccc:=[seq(circle([X[i],Y[i]],rad[i]), i=start..nterm)]:

#c := circle([1,1], 0, color=red):

#plots[display](c, scaling=constrained);

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

 

OUTPUT

 

First 6 7 8 9 10 11 Page 8 of 11