Download MuPAD from SciFace

MuPAD Pro Computing Essentials - Examples 

Example 8.9 - Plotting points and lines

Divide the segment of the line connecting A and B into n equal pieces. Then join the end of each piece with the two given points P and Q.  This example shows how complex geometrical constructions can be modeled in MuPAD.

export(plot, Point, line):
ax := 10:

ay := 0:
az := 10:
bx := 0:
by := 10:
bz := 10:
A := Point([ax,ay,az]):
B := Point([bx,by,bz]):
P := Point([1,0,0], PointWidth = 60):
Q := Point([10,10,10], PointWidth = 60):
n := 7:

points := (
   Point(
      [ax+i*(bx-ax)/n,ay+i*(by-ay)/n,az+i*(bz-az)/n],
      Color=[i/n,1-i/n,i/n],
      PointWidth=80,
      PointStyle=FilledCircles
   )
) $ i=0..n:

lines1 := (
   line(
      P,
      [ax+i*(bx-ax)/n,ay+i*(by-ay)/n,az+i*(bz-az)/n],
      Color=[i/n,1-i/n,i/n]
   )
) $ i=0..n:

  
lines2 := (
   line(
      Q,
      [ax+i*(bx-ax)/n,ay+i*(by-ay)/n,az+i*(bz-az)/n],
      Color=[i/n,1-i/n,i/n]
   )
) $ i=0..n:

    
line0 := line(A, B, LineWidth=15):
plot(P, Q, points,line0, lines1, lines2)

 

TOP