Exercises (Part 1) to Maple: Mathematics on the computer - Home.hs ...

5 downloads 2976 Views 50KB Size Report
8 Apr 2013 ... Exercise 2 (Graphically display of functions, plot command) .... Determine the real part and imaginary part of = c. 5. 2 e. ⎛. ⎝. ││. ⎞. ⎠. ││.
Exercises (Part 1) to Maple: Mathematics on the computer Prof. Dr. T. Westermann University of Applied Sciences 4.8.2013

>

Important symbols: 

:=



; or : (semicolon or colon)



%

(percent)



""

(quotation marks)



#

(crossbar)

(colon equal)

assignment end of command with/without display of result the actual result string for characters comment within input line

 With F5 or Insert Text: Generation of a new text line  With F3/F4 split/join input lines  With [> button of the upper task menu: a new input line is generated  Pi circle number

> restart:

Exercise 1 (Evaluation of functions, evalf command) Determine with Maple the following terms: sin( 4 ), sin( 4.0 ),

 3 , ln( 4 ), ln( 4. ), e4, e4., sin , tan(1), sinh(0), arccos(1) 2

 Take care of the difference in the result 4 and 4.0 etc.   =Pi, evalf( )  The exponential is not defined by e^ and also not by exp^

> > > >

Exercise 2 (Graphically display of functions, plot command)

2a (color, thickness) a) Take Maple's plot command and draw the following functions in the corresponding range: x2 in [ -4, 4] sin(x) in [ , 2 ] x e

x

(Note:  is defined as Pi ! )

in [ 0, 4] in [ -2, 4]

 If you would like to change the color choose color=< red, blue, green,... > ,  If you would like to change the line thickness choose thickness=. > > >

2b (plot[options]) b) Draw with the plot command: tan(x) x ( x1 )2

in in

[ , 2 ] [ -10, 10]

 In order to scale the y-axis in a proper way take the option -10..10 or -1..10  Other options of the plot command can be found via >?plot[options]

> ?plot[options] > > >

2c (couples of graphs within one display) c) Choose the plot command in form of ([f1,f2], x=a..b, color=[..,..]) in order to draw multiple graphs within one display. To distinguish between the different functions choose different colors and line thicknesses. Introduce a labeling of the graphs with labels=[..,..] sin(2  x), cos(2  x) sin(x), arcsin(x) tanh(x), 1-exp(-x) > >

in-between [0, 1] in-between [-, ] in-between [0, 6]

> >

Exercise 3 (To differentiate functions: the diff command) Apply Maple's diff command in order to determine the first derivative of 2

x

x , arctan(x), e ,

x , sinh( ln( x ) ),

4 x25

:

x33 x

 What happens in case that you are using capital initials?  Compute the second derivatives of the functions investigating Maple's Help-Button to obtain the correct syntax! > > >

Produce nice expressions of the results computed in form of: d 1 arctan( x ) dx 1x2

or

d2 dx

2

arctan( x )

( 1x2 )

> > Take the first and second derivative of ( g t )

s( t )s0 e sin(  t ) in order to compute the velocity and the acceleration. > >

Exercise 4 (Complex Numbers) Given are the complex numbers c1 = 4 + 3i;

c2 = 3+2i;

c3 = 4 e

i    3 

 Note: The imaginary unit 1 is denoted with I !

4a (evalc command) Use evalc in order to compute c1 c 1 * c2 , , c1+c2, c2  Note: The imaginary unit

> > >

c3 * c1 ,

1 is denoted with I !

2x

c1

4

2

4b (abs and argument command) With abs and argument the absolute value as well as the angle of a complex number is computed. Calculate the absolute value as well as the angle in case of c3 * c1 c1 , > >

*4c (polar command) Calculate the absolute value as well as the angle in case of c41 3 i using the polar command.  i     6 

Determine the real part and imaginary part of c52 e 1 ( i  ) ( i  ) What's about ( e e )? Use possibly the simplify command. 2 > >

**4d (fsolve command) Use fsolve in order to determine c2

1   4

.

 Note: fsolve(z - c =0, z, complex) determines all complex roots of the polynomial p(z)=zk-c k

> >

Exercise 5 (Integration of functions, int command) Compute the integrals using the int command:   2 x1  dx   x36 x29 x 0   What happens if you use capital initials of the int command? > > > >  4 4 x dx , 

 x ln( x ) dx , 

1

 sin( x )  dx ,  cos( x ) e 

Produce nice expressions of the results computed in form of: 1 cos( x ) sin( x ) 1 x  sin( x )2 dx   2 2 > >

(Partial fraction)

Use Maple's convert(..., parfrac, x) command to perform a decomposition in form of partial fractions for  6   x 2 x5x44 x1  x32 x21   dx,  4 dx  4 3 3 2  x 2 x 2 x1  x 2 x 2 x 2 x1   Subsequently integrate these terms. > >

*(Substitution) Use the command changevar from the student package, which is loaded with >with(student); > restart:with(student): > changevar(y=cos(x), Int(sin(x)*exp(cos(x)), x), y); in order to perform a substitution 2

  ln( t )  dt with y=ln( t )   t  1

  2 x3  dx with y=x23 x1 2   x 3 x1   sin( x32 ) x2 dx with y=sin( x32 )  > > >

Exercise 6 (Solving equations and inequalities, solve command) 6a (Equations) Take Maple's solve command in order to solve: x2x20, 4 x4 2 x4 > > >

x24 x130 ,

2 x3 53 x0,

6b (Inequalities) Take Maple's solve command in order to solve: x x3 2 x2 > 3, ( x1 )2 x ,  x3 x > >

6c (Systems of linear equations) Take Maple's solve command in order to solve the following two systems of linear equations: ii) x13 x22 x34 i) 2 x1x2x33 3 x1x24 x31 2 x1x23 x32 2 x116 x218 x328 4 x13 x22 x32 > > Note:  solve(eq,x) solves equation eq with respect to variable x  solve({eq1,eq2,eq3},{x1,x2,x3}) solves equations eq1,eq2,eq3 with respect to x1,x2,x3.

Exercise 7 (Limits, limit command) 7a (Consequences) Use the limit command in order to determine the limits of 1 an= for n ->  n 1 an=1 n for n ->  2 3

( n1 )

2n

for n ->  3n1 Choose capital initials of the command in order to produce nice expressions. > > > an=

> 7b Preliminary considerations (function limits) What would you expect from function y

1 at point x0? x

Perform a Maple computation! > 1 Plot y in the range x=-3..3. x > Look for the options of the limit command and specify subsequently appropriate 1 options for the calculation of . x > >

7c (function limits) Take the limit command and compute the limits of

2 x23 x4

in point x -> 1 and x ->  3 x24 x1 sin( x ) f(x)= in point x -> 0 and x ->  x ex1 in point x -> 0 and x ->  f(x)= x

f(x)=

1   2

( x1 ) 1 in point x -> 0 and x -> . x Choose capital initials in order to produce nice expressions. > > > > f(x)=

>

Exercise 8 (Vectors and vector operations) Given are the vectors (column vectors) a 3, 5, 8 ; b 1, 2, 1 ; and a row vector c[ 2, 0, 1 ].  Take care of the difference between column and row vectors!  Activate the LinearAlgebra package to load the vector commands.

8a (Norm command) Compute the following vectors t a + 4 b, a + c, a + c Why is it not possible to evaluate the second expression? Determine the absolute value of the vectors a, b, c. > > > >

8b (DotProduct, CrossProduct) Calculate the scalar product and the cross product of vector a with vector b. Check that the cross product stays orthogonal on vector a as well as on vector b. > >

8c (VectorAngle command) Determine the angle between the vectors a and b. > > >

Exercise 9 (Matrices und matrix operations, determinants) Given are the matrices 3 2 1   A 0 0 1 ;   1 2 3 and 2 3   C 4 5.   1 1

1 2 1   B 2 0 1;    4 3 1

9a (Matrix command, matrix product) Define the matrices A, B and C with the Matrix command. Compute the products A B, B A, A C Why is it not possible to perform the operation C A?  Note: The multiplication of matrices can't be expressed with * !  Don't forget to activate the LinearAlgebra package, to load the matrix commands.

> > > >

9b (Determinant command) Determine the determinant of the matrices A and B. > >

9c (InverseMatrix command) Invert A and B. > > > Show that Matrix * Matrix_inv = unit matrix. > > >

Exercise 10 (First order differential equations (ode)) 10a (ode without initial condition) Solve the following ode 1. y'(x) + 2 y(x) = 4 x 2. x y'(x) +y(x) = 0 3. y' = exp(y) cos(x) (Hint: Check or ask the lecturer how this ode must be specified with Maple!)  Note: In order to formulate the ode you have to use the diff command!

> > > > >

10b (ode with initial condition) Solve the following ode with initials 1. y'(x) + x y(x) = 4 x 2. U'(t) + 1/(R C) U(t) = U0 sin(w t) 3. x (x+1) y' = y > > >

with y(0)=0 with U(0)=0 with y(1)=1/2.

10c (Drawing the solution) Plot the solution of the ode 1. y'(x) + x y(x) = 4 x with y(0)=0 (plot for x>0) 2. x (x+1) y' = y with y(1)=1/2 (plot for x>1) > > > > > >

Exercise 11 (differential equation of order n) 11a (ode without initial conditions) Solve the following ode 1. y''(x) + 4 y'(x) + 8 y(x) = e

( x )

2. y''(x) +y(x) = sin(x) 3. y'''(x) -5 y''(x) + y'(x) -y(x) = 0  Note: In order to formulate the ode you have to use the diff command!

> > > > >

11b (ode with initial conditions) Solve the following ode with initials and plot the solution for x>0 ( x )

1. y''(x) + 4 y'(x) + 8 y(x) = e 2. y''(x) +y(x) = sin(x) 3. y'''(x) -5 y''(x) + y'(x) -y(x) = 0

y(0)=1, y'(0)=0 y(0)=0, y'(0)=0 y(0)=1. y'(0)=2, y''(0)=0

 Note: In order to specify the initial condition y' you have to use the D-operator: D(y)(0)=...!

> > > > >

Exercise 12 (Laplace's transformation) 

 ( s t ) F( s ) dt  f( t ) e  0

12a (Laplace's transformation) Determine the Laplace transform of 1. 2. 3. 4. 5.

( 4 t )

f(t) = e f(t) = -4 sin(w t) f(t) = 3 cos(w t) f(t) = t3 f(t)= 4 t83 t21

 Note: For the computation with Maple you have to load the package inttrans, which is done by specifying >with(inttrans)

> > >

> >

12b (inverse Laplace's transformation) For the given functions determine the inverse Laplace transform 1. F(s) = 2. F(s) =

1 s4 5 (1)

s225 1 3. F(s) = s8 1 4. F(s) = s

> > > > >

Exercise 13 (Fourier's transformation) 13a (Fourier's transformation) Determine the Fourier transform of 1. 2. 3. 4. 5.

( 4 t )

f(t) = e S(t) f(t) = -4 sin(w t) f(t) = 3 cos(w t) f(t) = S(t) f(t) = Imp(t)

 Note: For the computation with Maple you have to load the package inttrans, which is done by specifying >with(inttrans)  S(t) is the jump function; which is defined as Heaviside!  Imp(t) is the pulse function; which must be defined with help of Heaviside!

> S(t):=Heaviside(t): #Definition of jump function > Imp(t):=S(t)-S(t-T): T:=10: #Definition of pulse function > > >

13b (inverse Fourier's transformation)

Determine the inverse Fourier transform of 1. F(w) = 2. F(w) = 3. F(w) =

1 4I w 1 4w2 1 4w2

> > > > > > > >  With > ? command name the Maple-Help menu is opened