Maple


Maple is a comprehensive computer system for beginning to advanced Mathematics and Physics. Its amazing power and versatility can give students additional help, motivation, and insight into theory and applications, in classes, labs, homework, and/or projects.




Download Maple Tutorial -1

                                                     Maple Tutorial

From Unix Prompt (= $) 

$ xmaple &                                             Start X Windows version of Maple in background (background = &) 
$ maple &                                              Start text version of Maple in background (background = &) 
$ maple – cw    &                                     Start classical version of Maple 


Execute Commands :

Place mouse anyplace after > and press [Enter] to execute. 
> restart;                                                     De-assign all variables (like a new session);   
> 3+7;                                                         Enter and Return may/may not be same key 


Sums & Products :

> restart;                                                                 Clean the slate 
> sum( (-1)^i * x^(2*i)/(2*i)!, i=0..2 );                            Evaluate first 3 terms in cos series 
> sum( (-1)^i * x^(2*i)/(2*i)!, i=0..infinity );                     Evaluate all terms 
> Sum( (-1)^i * x^(2*i)/(2*i)!, i=0..infinity );                    Symbolic sum 
> value(%);                                                               Evaluate previous expression (% replaces old ") 
> Product(        (i^2+3*i-11)/(i+3), i=0..10 );                  Form product of symbols 
> value(%);                                                               Evaluate previous expression 

Symbolic Manipulations :

> restart;                                                      Clean the slate 
> Sum( i, i=1..n );                                          Symbolic sum.  This should be n(n+1)/2 when evaluated 
> sum( i,i = 1 .. n );                                       The active form. lowercase not upper 
> value(%);                                                                 Not form of expected result 
> expand(%);         factor(%);           expand(%);            so be manipulative! 
> expand( (x+y)^15 ); 
> simplify( cos(x)^2 + sin(x)^2 );                                    Simplify using math identities 
> convert( sin(x), exp );                                                 Convert to exponential notation (many variants) 
>



Evaluate the integral:

> Int(x/sqrt(1+x),x);

> value(%);

> Int(x/(1+x*x*x),x);

> value(%);

>  Int(Int(x*x+y*y,x=0..1),y=-1..1);

> value(%);

Maple Procedure:

A maple procedure consists of a  name which calls the procedure, a sequence of commands and an end statement.
Here is the example-

> restart;
> myfunc:=proc(x)
> 2*x;
> end;

> myfunc(6);

> mult:=proc(x,y)
> x*x+y*y;
> end;
>

> mult(2,3);





Fibonaccai Numbers:

> restart;

> Fibo:=proc(n::nonnegint)
> if(n<2) then
> n;
> else
> Fibo(n-1)+Fibo(n-2);
> fi;
> end;

> seq( Fibo(i), i=0..15);

  
 Legendre Polynomial in Maple:

> restart;
> L := proc(n::nonnegint)
> option remember;
> if n=0 then return 1;
> elif n=1 then return x;
> else return sort( x^(n)
                        - add( L(i-1)*int(x^(n)*L(i-1),x=-1..1 )
                              /int( L(i-1)*L(i-1), x=-1..1 ),
                              i=1..n) );
> fi;
> end proc;

> seq( print(L(k)), k=0..9); 



Write a Maple procedure sqplot( a ) that plots the square plot defined by y=a for |x|<a and y=0 for otherwise.

> restart;
> sqplot:=proc(a)
> local f;
> f:=(x)-> piecewise(x<-a,0,x<a,a,0);
> f;
>
> end;

> plot(sqplot(5),-10..10);


The Fibonacci  polynomial  satisfy the linear recurrence
     Fn(x) = xFn-1(x) +Fn-2(x)
Where, F0=0 and F1= 1
Write a maple procedure to compute and factor Fn(x).
> restart;

> F:=proc(n::nonnegint,x::name)

> option remember;
> if n=0 then return 0;
> elif n=1 then return 1;

> else return x*F(n-1,x)+F(n-2,x);
> fi;
> end proc;
  
> F(4,x);

> factor(%);

> factor(seq(print(F(k,x)),k=0..5));

> simplify(seq(print(F(k,x)),k=0..5));


The Fibonacci Number satisfy the following recursion relation
                     F(2n) = 2F(n-1)F(n) +F(n)2     where n>1
and,              F(2n+1) =F(n+1)2+F(n)2          where n>1     
Use this recursion relation to write the Maple procedure for Fibonacci Numbers

> restart;
> Fibo:=proc(n::nonnegint)
> option remember;
> if (n<2) then return n;

> elif type(n,even) then return (2*Fibo(n/2-1)*Fibo(n/2)+Fibo(n/2)*Fibo(n/2));      

> else return  (Fibo(n/2+1/2)*Fibo(n/2+1/2)+Fibo(n/2-1/2)*Fibo(n/2-1/2));

> fi;
> end proc;











No comments:

Post a Comment