KOS 1110 Computers in Science
Assignment 5 - Maple graphics and maplets
Due date Monday, 10-10-2005, 10:00am

1.	Multiplot: During your laboratory class, you have created multiplots (one figure containing several plots) and animations using these multiplots.  Using your own function, create at least one set of multiplot (static) and animation.  Use as many options as possible to make your plot look like textbook quality plots.
> 
> restart;
> with(plots):

> y1:=2*sin(f*theta)*2*cos(f*theta);

> subs(f=1, y1);

>  p1:=plot(subs(f=1, y1), theta=0..2*Pi,colour=blue,legend="A=1",thickness=1):p1;

> y2:=A*cos(f*theta)+A*sin(f*theta);

> subs(f=1,y2);

> p2:=plot(subs(A=1,f=1,y2),theta=0..2*Pi,colour=orange,legend="A=2",thickness=3):p2;

> p3:=plot(subs(f=2, y1), theta=0..2*Pi,colour=green,legend="A=3",thickness=2):p3;

> p4:=plot(subs(A=2,f=1,y2),theta=0..2*Pi,colour=red,legend="A=4",thickness=4):p4;

> display(p1,p2,p3,p4);

> 
2.	Scientific graph: Select any one graph and the corresponding equation used to create this graph from your text/reference books.  Plot this graph using maple. Use as many options as possible to make your plot look like textbook quality plots.
> restart;
> with(plots):
> y:=8*sin(2.5*x);

> plot((y),x=-5..5,title="sin function where A and B values increased", labels=["x(the value of B)","y(the value of A)"]);

> 
> 
3.	Your artistic skills:  Draw at least one unique picture each in 2D and 3D using Maple.  Convert the 3D picture into VRML format and visualise using Cortona player.  
> restart;
> with(plots):
Warning, the name changecoords has been redefined

>  x:=cos(2*t)*sin(3*t)+sin(4*t);   y:=cos(3*t)*sin(4*t)+cos(2*t);

> plot([x,y,t=-100..100]);
> 

1. DIAGRAM OF UNIDENTIFIED BACTERIA STRAND

> animate3d(cos(phi)/sin(sqrt(x^2+y^2)+phi),x=-6..6, y=-6..6, phi=0..2*Pi-2*Pi/15, style=patch);

2. DIAGRAM OF THE SURFACE OF ICED STAR

> 
> 
4.	3D animation: Make at least one unique animation in 3D
Give names to all the above pictures. Publish these pictures and the animations in your home page along with the details, such as the equations that are used to create the animations.
> restart;
> with(plots):
Warning, the name changecoords has been redefined

> animate3d([x,y,(1.3)^x*sin(2*u)+cos(4*u)*(5*u*4)],x=1..5,y=1..7,u=1..2,coords=spherical);

3. DIAGRAM OF ONION’S SKIN 

5.	Write a Maple procedure (proc) called function(x), which will accept the value of a and x to calculate a function which has a value of 7*ex+x+5  in the range of x=-a to 0 and a value of x+5  in the range of x=0 to a. The value of this function is zero everywhere else.  Check your procedure by calling this proc using different values of x and a.  
> restart;
> f:=proc(x,a) local z: if x>=-a and x<=0 then z:=7*e*x+x+5: else z:=x+5 :x>=0 and x<=a: z:=0: fi: end proc;

> f(3,2);

> f(-5,7);

> f(-2,2);

> f(1,2);

> 
> 
> 
6.	Write a Maple procedure (proc) called Grade(marks), which will accept a student's exam mark and returns his grade.
> restart;
> f:=proc(x)local z:if x>=80 and x<=100 then z:="A": elif x>=65 and x<=80 then z:="B":elif x>=50 and x<=64 then z:="C":elif x>=30 and x<=49 then z:="D":else z:="E":fi:end:

> f(83);

> f(65);

> f(53);

> f(42);

> f(2);

> 
> 
> 

7.    Write the commands necessary to produce the following maplets:

a)    Grader maplet which will accept a student's exam mark and returns his grade.
b)  Eqsolver maplet which will accept any equation in one variable and give its        solutions.
c)   3Dplotter maplet which accept any equation in two variables and draw a 3D   plot.
Include necessary titles, comments and buttons in all the above maplets.
>  with(Maplets[Elements]):
> GradeMaplet:=Maplet ([[" KNOW YOUR EXAM GRADE!! "],
[" Key In your Marks : ", TextField ['TF1']()],
TextBox['TB1'](not editable, width='40', height='3'),  
[Button ( "Get Grade", Evaluate ('TB1' = 'f(TF1)')),
Button ( " Finish ", Shutdown (['TF1', 'TB1']))]]):

> Maplets[Display](GradeMaplet);

>