o #section 4.2 plot(x^3-3*x^2+1.5*x-14,x=-2..3); x...

37
O O O O O O O O O O #Section 4.2 plot(x^3-3*x^2+1.5*x-14,x=-2..3); x K 2 K 1 0 1 2 3 K 35 K 30 K 25 K 20 K 15 K 10 #When Maple is asked to solve an expression, it assumes the expression is equal to zero and will solve for all variables within the expression. solve (3*x^2-6*x+1.5,x); 1.707106781, 0.2928932188 #Note that when there is a decimal point in the expression, Maple returns an answer in decimal form. If we use an exact expression instead of the decimal, we get an exact answer. solve (3*x^2-6*x+3/2,x); 1 C 1 2 2,1 K 1 2 2 plot((1/3)*x^3+x,x=-5..5);

Upload: trandieu

Post on 26-Sep-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

O

O

O

O

O

O

O

O

O

O

#Section 4.2

plot(x^3-3*x^2+1.5*x-14,x=-2..3);

xK2 K1 0 1 2 3

K35

K30

K25

K20

K15

K10

#When Maple is asked to solve an expression, it assumes the expression is equal to zero and will solve for all variables within the expression.

solve (3*x^2-6*x+1.5,x);1.707106781, 0.2928932188

#Note that when there is a decimal point in the expression, Maple returns an answer in decimal form. If we use an exact expression instead of the decimal, we get an exact answer.

solve (3*x^2-6*x+3/2,x);

1C12

2 , 1K12

2

plot((1/3)*x^3+x,x=-5..5);

O

xK4 K2 0 2 4

K40

K30

K20

K10

10

20

30

40

plot((1/3)*x^3-x,x=-5..5);

O

xK4 K2 0 2 4

K30

K20

K10

10

20

30

plot((1/3)*x^3-x,x=-3..3);

O

xK3 K2 K1 0 1 2 3

K6

K4

K2

2

4

6

plot(1/(x-1),x=-3..3,y=-10..10);

O

xK3 K2 K1 0 1 2 3

y

K10

K5

5

10

plot(1/(x^2-1),x=-3..3,y=-10..10);

O

O

O

xK3 K2 K1 0 1 2 3

y

K10

K5

5

10

#The following are the graphs of the derivative and the originalfunction for the in-class exercise for section 4.2.

plot( [0.05*(x - 1)*(x + 0.5)*(x - 2.5)^2*(x - 10), int(0.05*(x - 1)*(x + 0.5)*(x - 2.5)^2*(x - 10),x)], x=0..3, color=[red,blue] );

O

O O O

x1 2 3

K0.5

0

0.5

1.0

1.5

#Section 4.3

plot(2*x^3-9*x^2+12*x-5,x=-1..3.5);

O

xK1 0 1 2 3

K20

K10

10

plot(6*x^2-18*x+12,x=-1..3.5);

O

xK1 0 1 2 3

10

20

30

plot(12*x-18,x=-1..3.5);

O

xK1 0 1 2 3

K30

K20

K10

10

20

plot(x*exp(-x^2/2),x=-3..3);

O

xK3 K2 K1 0 1 2 3

K0.6

K0.4

K0.2

0.2

0.4

0.6

plot([x*exp(-x^2/2),diff(x*exp(-x^2/2),x)],x=-3..3);

O

xK3 K2 K1 0 1 2 3

K0.6

K0.4

K0.2

0.2

0.4

0.6

0.8

1.0

plot([x*exp(-x^2/2),diff(x*exp(-x^2/2),x),diff(x*exp(-x^2/2),x,x)],x=-3..3,color=[red,green,blue]);

O

O O

xK3 K2 K1 0 1 2 3

K1.0

K0.5

0.5

1.0

#The following is for problem 44 p. 288

plot( [((x+1)^3*(x^2+5))/((x^3+1)*(x^2+4)), diff( ((x+1)^3*(x^2+5))/((x^3+1)*(x^2+4)), x), diff(((x+1)^3*(x^2+5))/((x^3+1)*(x^2+4)),x, x)], x=-3..3,color=[red,green,blue]);

O

O

xK3 K2 K1 0 1 2 3

K10

K8

K6

K4

K2

2

4

6

solve(diff(((x+1)^3*(x^2+5))/((x^3+1)*(x^2+4)),x, x));RootOf 3 _Z9C 3 _Z8C 36 _Z7K 7 _Z6C 81 _Z5C 21 _Z4K 278 _Z3C 195 _Z2K 744 _Z

C 236, index= 1 , RootOf 3 _Z9C 3 _Z8C 36 _Z7K 7 _Z6C 81 _Z5C 21 _Z4

K 278 _Z3C 195 _Z2K 744 _ZC 236, index= 2 , RootOf 3 _Z9C 3 _Z8C 36 _Z7

K 7 _Z6C 81 _Z5C 21 _Z4K 278 _Z3C 195 _Z2K 744 _ZC 236, index= 3 ,

RootOf 3 _Z9C 3 _Z8C 36 _Z7K 7 _Z6C 81 _Z5C 21 _Z4K 278 _Z3C 195 _Z2

K 744 _ZC 236, index= 4 , RootOf 3 _Z9C 3 _Z8C 36 _Z7K 7 _Z6C 81 _Z5C 21 _Z4

K 278 _Z3C 195 _Z2K 744 _ZC 236, index= 5 , RootOf 3 _Z9C 3 _Z8C 36 _Z7

K 7 _Z6C 81 _Z5C 21 _Z4K 278 _Z3C 195 _Z2K 744 _ZC 236, index= 6 ,

RootOf 3 _Z9C 3 _Z8C 36 _Z7K 7 _Z6C 81 _Z5C 21 _Z4K 278 _Z3C 195 _Z2

K 744 _ZC 236, index= 7 , RootOf 3 _Z9C 3 _Z8C 36 _Z7K 7 _Z6C 81 _Z5C 21 _Z4

K 278 _Z3C 195 _Z2K 744 _ZC 236, index= 8 , RootOf 3 _Z9C 3 _Z8C 36 _Z7

K 7 _Z6C 81 _Z5C 21 _Z4K 278 _Z3C 195 _Z2K 744 _ZC 236, index= 9#Maple attempts to find exact solutions and when the solutions

O

O

O

O

O

O

O

O

O

O

O

O

O

are too complex, Maple expresses the result as root of an expression.

solve(x^3+x^2+x);

0, K12C

12

I 3 , K12K

12

I 3

solve(x^2+y^2=1);

x = 1K y2 , y = y , x =K 1K y2 , y = ysolve(x^2+y^2=1,x);

1K y2 , K 1K y2

#We can get an approximate solution to the above problem using evalf() command.

solve(diff(((x+1)^3*(x^2+5))/((x^3+1)*(x^2+4)),x, x));RootOf 3 _Z9C 3 _Z8C 36 _Z7K 7 _Z6C 81 _Z5C 21 _Z4K 278 _Z3C 195 _Z2K 744 _Z

C 236, index= 1 , RootOf 3 _Z9C 3 _Z8C 36 _Z7K 7 _Z6C 81 _Z5C 21 _Z4

K 278 _Z3C 195 _Z2K 744 _ZC 236, index= 2 , RootOf 3 _Z9C 3 _Z8C 36 _Z7

K 7 _Z6C 81 _Z5C 21 _Z4K 278 _Z3C 195 _Z2K 744 _ZC 236, index= 3 ,

RootOf 3 _Z9C 3 _Z8C 36 _Z7K 7 _Z6C 81 _Z5C 21 _Z4K 278 _Z3C 195 _Z2

K 744 _ZC 236, index= 4 , RootOf 3 _Z9C 3 _Z8C 36 _Z7K 7 _Z6C 81 _Z5C 21 _Z4

K 278 _Z3C 195 _Z2K 744 _ZC 236, index= 5 , RootOf 3 _Z9C 3 _Z8C 36 _Z7

K 7 _Z6C 81 _Z5C 21 _Z4K 278 _Z3C 195 _Z2K 744 _ZC 236, index= 6 ,

RootOf 3 _Z9C 3 _Z8C 36 _Z7K 7 _Z6C 81 _Z5C 21 _Z4K 278 _Z3C 195 _Z2

K 744 _ZC 236, index= 7 , RootOf 3 _Z9C 3 _Z8C 36 _Z7K 7 _Z6C 81 _Z5C 21 _Z4

K 278 _Z3C 195 _Z2K 744 _ZC 236, index= 8 , RootOf 3 _Z9C 3 _Z8C 36 _Z7

K 7 _Z6C 81 _Z5C 21 _Z4K 278 _Z3C 195 _Z2K 744 _ZC 236, index= 9

evalf(%);0.3332909936, 1.481579821, 0.4942543036C 1.835972781 I, K0.06544908310

C 1.528515490 I, K0.9455790709C 3.110493830 I, K1.781323114, K0.9455790709K 3.110493830 I, K0.06544908310K 1.528515490 I, 0.4942543036K 1.835972781 I#Other method is to use fsolve which finds solutions numerically. Problem here is that it only finds one solution ata time. Therefore, we need to tell Maple where to look for the solution. From the plot of the function, we see there should be3 solutions.

plot(diff(((x+1)^3*(x^2+5))/((x^3+1)*(x^2+4)),x, x),x=-3..3);

O

O

O

O

O

O

O

O

O

xK3 K2 K1 0 1 2 3

K10

K8

K6

K4

K2

2

4

6

fsolve(diff(((x+1)^3*(x^2+5))/((x^3+1)*(x^2+4)),x, x));K1.781323114

fsolve(diff(((x+1)^3*(x^2+5))/((x^3+1)*(x^2+4)),x, x),x,0..1);0.3332909936

fsolve(diff(((x+1)^3*(x^2+5))/((x^3+1)*(x^2+4)),x, x),x,1..2);1.481579821

#We have now found all 3 solutions accurate to 10 digits and we could have Maple display more digits if desired.

evalf(fsolve(diff(((x+1)^3*(x^2+5))/((x^3+1)*(x^2+4)),x, x),x,1..2),20);

1.4815798212751903434

solve(diff(((x+1)^3*(x^2+5))/((x^3+1)*(x^2+4)),x, x));RootOf 3 _Z9C 3 _Z8C 36 _Z7K 7 _Z6C 81 _Z5C 21 _Z4K 278 _Z3C 195 _Z2K 744 _Z

C 236, index= 1 , RootOf 3 _Z9C 3 _Z8C 36 _Z7K 7 _Z6C 81 _Z5C 21 _Z4

K 278 _Z3C 195 _Z2K 744 _ZC 236, index= 2 , RootOf 3 _Z9C 3 _Z8C 36 _Z7

K 7 _Z6C 81 _Z5C 21 _Z4K 278 _Z3C 195 _Z2K 744 _ZC 236, index= 3 ,

O

O

O O

O

O

O

O

O

RootOf 3 _Z9C 3 _Z8C 36 _Z7K 7 _Z6C 81 _Z5C 21 _Z4K 278 _Z3C 195 _Z2

K 744 _ZC 236, index= 4 , RootOf 3 _Z9C 3 _Z8C 36 _Z7K 7 _Z6C 81 _Z5C 21 _Z4

K 278 _Z3C 195 _Z2K 744 _ZC 236, index= 5 , RootOf 3 _Z9C 3 _Z8C 36 _Z7

K 7 _Z6C 81 _Z5C 21 _Z4K 278 _Z3C 195 _Z2K 744 _ZC 236, index= 6 ,

RootOf 3 _Z9C 3 _Z8C 36 _Z7K 7 _Z6C 81 _Z5C 21 _Z4K 278 _Z3C 195 _Z2

K 744 _ZC 236, index= 7 , RootOf 3 _Z9C 3 _Z8C 36 _Z7K 7 _Z6C 81 _Z5C 21 _Z4

K 278 _Z3C 195 _Z2K 744 _ZC 236, index= 8 , RootOf 3 _Z9C 3 _Z8C 36 _Z7

K 7 _Z6C 81 _Z5C 21 _Z4K 278 _Z3C 195 _Z2K 744 _ZC 236, index= 9

evalf(%,20);0.33329099355621728187, 1.4815798212751903434, 0.49425430357034888449

C 1.8359727813044462529 I, K0.065449083098015133147C 1.5285154895083324747 I, K0.94557907089461272448C 3.1104938302208671135 I,K1.7813231139868496790, K0.94557907089461272448K 3.1104938302208671135 I,K0.065449083098015133147K 1.5285154895083324747 I, 0.49425430357034888449K 1.8359727813044462529 I

#Activity 4.3 Equations

#Graph 1

plot(.2*(x^2*(x-1)*(x+1)*(x-2)*(x+2)+5),x=-2..2,y=-1..2);

O O

O

O O

xK2 K1 0 1 2

y

K1

1

2

#Graph 2

plot((x+.5)^2*(x-.5)*(x-1.7)+.2,x=-1..2,y=-1..1);

O

O O

O

O

xK1 0 1 2

y

K1.0

K0.5

0.5

1.0

#Graph 3.

plot(0.3*exp(x),x=-2.5..1.5,y=-0.8..1);

O O

O

O O

xK2 K1 0 1

y

K0.8

K0.6

K0.4

K0.2

0.2

0.4

0.6

0.8

1.0

#Graph 4.

plot([x^(1/3),-(-x)^(1/3)],x=-5..5,y=-2..2,color=[red,red]);

O

O

O

O O

xK4 K2 0 2 4

y

K2

K1

1

2

#Graph 5.

plot(-abs(1/x)+1,x=-2.5..2.5,y=-0.7..1.5);

O

O

O

O O

xK2 K1 0 1 2

y

K0.5

0.5

1.0

1.5

#Graph 6.

plot(exp(-x^2/2),x=-2.5..2.5,y=-0.5..1.5);

O

O

O

O

O

xK2 K1 0 1 2

y

K0.5

0.5

1.0

1.5

#Section 4.4

plot((x+1)^5*sin(x-3),x=-3..0,y=-10..10);

O

O

O

O

O

O

O

O

O

O

O

xK3 K2 K1 0

y

K10

K5

5

10

solve(diff((x+1)^5*sin(x-3),x));K1, K1, K1, K1, 3CRootOf _ZC 5 tan _Z C 4

evalf(solve(diff((x+1)^5*sin(x-3),x)));K1., K1., K1., K1., 2.402483740

#Clearly the solve command did not find all the solutions. The graph helps us know that there must be additional solutions in the interval besides x = -1

fsolve(diff((x+1)^5*sin(x-3),x));K.2838542552

fsolve(diff((x+1)^5*sin(x-3),x),x=-1.5..-0.29);K.9999999964

#This looks a lot like x = -1, but we must make that interpretation.

fsolve(diff((x+1)^5*sin(x-3),x),x=-3..-2.5);K2.917060175

plot(diff((x+1)^5*sin(x-3),x),x=-3..0);

O

O O

O

xK3 K2 K1 0

K5

5

10

#We can take a closer look around y = 0.

plot(diff((x+1)^5*sin(x-3),x),x=-3..0,y=-0.5..0.5);

O

O

xK3 K2 K1 0

y

K0.4

K0.2

0.2

0.4

plot(diff((x+1)^5*sin(x-3),x),x=-3..0,y=-0.1..0.1, numpoints=2000);

O

O

xK3 K2 K1 0

y

K0.10

K0.05

0.05

0.10

plot(diff((x+1)^5*sin(x-3),x),x=-3..0,y=-0.01..0.01, numpoints =2000);

O

O

xK3 K2 K1 0

y

K0.010

K0.005

0.005

0.010

plot([1/(x^2+4*x+3),1/(x^2+4*x+4),1/(x^2+4*x+5)],x=-5..3,y=-3..3,color=[red,green,blue]);

O

O

xK5 K4 K3 K2 K1 0 1 2 3

y

K3

K2

K1

1

2

3

plot([1/(x^2+4*x+4),1/(x^2+4*x+5),1/(x^2+4*x+6)],x=-5..3,y=-1..1,color=[red,green,blue]);

O

O

xK5 K4 K3 K2 K1 0 1 2 3

y

K1.0

K0.5

0.5

1.0

plot((10*x*(x-1)^4)/((x-2)^3*(x+1)^2),x=-5..5,y=-5..25);

O

O

xK4 K2 0 2 4

y

K5

5

10

15

20

25

plot((10*x*(x-1)^4)/((x-2)^3*(x+1)^2),x=-1..3,y=-1..1);

O

O

xK1 0 1 2 3

y

K1.0

K0.5

0.5

1.0

plot(diff((10*x*(x-1)^4)/((x-2)^3*(x+1)^2),x),x=-5..5,y=-5..5);

O

O

xK4 K2 0 2 4

y

K4

K2

2

4

plot(diff((10*x*(x-1)^4)/((x-2)^3*(x+1)^2),x),x=-5..5,y=-5..5,numpoints=2000);

O O

O

O

xK4 K2 0 2 4

y

K4

K2

2

4

#Note that the following is the syntax for parametric plots. Also note that the command scaling=constrained forces a 1-1 or square plot.

plot([sin(2*t),sin(3*t),t=0..2*Pi],x=-1..1,y=-1..1,scaling=constrained);

O

O

O

xK1.0 K0.5 0 0.5 1.0

y

K1.0

K0.5

0.5

1.0

Section 4.9

A slopefield can be created in Maple using the dfieldplot routine from the DEtools package. Note that what we are saying in this input is that we have a derivative of y(x) with respect to x which is equal to afunction, in this case exp(x^2/2), and that what is being plotted is y(x).

with(DEtools);AreSimilar, DEnormal, DEplot, DEplot3d, DEplot_polygon, DFactor, DFactorLCLM,

DFactorsols, Dchangevar, FunctionDecomposition, GCRD, Gosper, Heunsols,

Homomorphisms, IsHyperexponential, LCLM, MeijerGsols, MultiplicativeDecomposition,

PDEchangecoords, PolynomialNormalForm, RationalCanonicalForm, ReduceHyperexp,

RiemannPsols, Xchange, Xcommutator, Xgauge, Zeilberger, abelsol, adjoint, autonomous,

bernoullisol, buildsol, buildsym, canoni, caseplot, casesplit, checkrank, chinisol, clairautsol,

constcoeffsols, convertAlg, convertsys, dalembertsol, dcoeffs, de2diffop, dfieldplot,

diff_table, diffop2de, dperiodic_sols, dpolyform, dsubs, eigenring, endomorphism_charpoly,

O

O

O

O

equinv, hk, eulersols, exactsol, expsols, exterior_power, firint, firtest, formal_sol, gen_exp,

generate_ic, genhomosol, gensys, hamilton_eqs, hypergeomsols, hyperode, indicialeq,

infgen, initialdata, integrate_sols, intfactor, invariants, kovacicsols, leftdivision, liesol,

line_int, linearsol, matrixDE, matrix_riccati, maxdimsystems, moser_reduce, muchange,

mult, mutest, newton_polygon, normalG2, ode_int_y, ode_y1, odeadvisor, odepde,

parametricsol, particularsol, phaseportrait, poincare, polysols, power_equivalent, ratsols,

redode, reduceOrder, reduce_order, regular_parts, regularsp, remove_RootOf,

riccati_system, riccatisol, rifread, rifsimp, rightdivision, rtaylor, separablesol, singularities,

solve_group, super_reduce, symgen, symmetric_power, symmetric_product, symtest,

transinv, translate, untranslate, varparam, zoomdfieldplot(diff(y(x),x)=exp(x^2/2),y(x),x=-2..2,y=-2..2);

xK2 K1 0 1 2

y(x)

K2

K1

1

2

O