The assume facilit and Simpli57519cation This lecture tries to summarize Chapters 13 and 14 of 1 encoun ter the normalization issue again but no for expressions more general than olynomials in olving trigonometric and exp onen tial functions urning ID: 36732 Download Pdf

164K - views

Published bymyesha-ticknor

The assume facilit and Simpli57519cation This lecture tries to summarize Chapters 13 and 14 of 1 encoun ter the normalization issue again but no for expressions more general than olynomials in olving trigonometric and exp onen tial functions urning

Download Pdf

Download Pdf - The PPT/PDF document "MCS In tro duction to Sym olic Computat..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.

Page 1

MCS 320 In tro duction to Sym olic Computation Spring 2004 Maple Lecture 23. The assume facilit and Simplication This lecture tries to summarize Chapters 13 and 14 of [1 ]. encoun ter the normalization issue again, but no for expressions more general than olynomials, in olving trigonometric and exp onen tial functions. urning bac to olynomials and term rewriting algorithms, sho ho to use Gr obner basis for constrained optimization. 23.1 The assume facilit ha encoun tered the assume already for instance: with improp er in tegrals, dep ending on parameter: [> exint :=

int(exp(a*t),t=0 ..i nf ini ty ); [> assume(a<0); [> exint; Here giv more complete treatmen of this facilit 23.1.1 Basics of assume In the case elo Maple asks for an assumption: [> assume(x>0); make an assumption [> about(x); query the assumption [> x; we see with flag [> additionally(x<2 ); add an assumption [> about(x); [> := evaln(x); remove assumptions The last command is of course the same as := 'x' Supp ose an to declare something as constan t. [> constants; constants known by Maple [> constants:=const an ts ,Ne wC ons ta nt; append new constant [> D(f)(x); general derivative [>

D(NewConstant)(x ); derivative of constant is zero The alternativ uses assume [> assume(myConstan t, co nst an t); make an assumption [> D(myConstant)(x) verify the assumption 23.1.2 Using prop erties in arithmetic The assume command creates an assumption, with additionally can add extra assumptions, and with ab out can see the assumption made on the ariable. As illustration see the use of assumption in connection with the bisection metho for nding ro ots of function. Supp ose are searc hing for ro ot of cos 0. [> := -> cos(x) x^2; [> f(0); f(Pi); By the mean alue theorem kno that

there is ro ot in the in terv al [0,Pi]: [> assume(a>0,a [> about(a); [> f(Pi/2); Jan ersc helde, Marc 10, 2004 UIC, Dept of Math, Stat CS Lecture 23, page

Page 2

MCS 320 In tro duction to Sym olic Computation Spring 2004 apply the mean alue theorem again: [> additionally(a i/ 2) [> about(a); So can use assumptions to erform some kind of in terv al arithmetic. 23.1.3 An algebra of prop erties With the command is can ask Maple to erify prop erties. [> assume(n,odd); assume(m,odd); [> is(n+2,odd); [> is(n^2,odd); [> is(n^2+m,odd); 23.2 Simplication ha already seen the simplify

command when ork ed with algebraic um ers. Most of what will see elo applies to trigonometric and exp onen tial functions. In man cases Maple nds out whic transformation rules to apply Here are some examples: [> abs(-Pi*x); [> min(a,3,4,cos(b) ); 23.2.1 expand and com bine ha seen expand for olynomials, but the command also applies to trigonometric functions: [> expression := exp(x+y) sin(x+y); [> expand(expressio n^ 2) ma wish to freeze the x+y in the argumen ab e. [> frontend(expand, [e xp res si on^ 2] ); Sometimes Maple do es not do the expand: [> expand(ln(x*y)); unless oth and

are ositiv e: [> assume(x>0); assume(y>0); [> expand(ln(x*y)); [> := 'x': := 'y': remove the assumptions If as ab e, only an temp orary assumption on the ariables, then etter use assuming [> expand(ln(x*y)) assuming x>0,y>0; The opp osite of expand is the command com bine [> e1 := expand(cos(a+b)); [> combine(e1); [> expand((cos(x))^ 3* (s in( 3* x)) ^2 ); [> combine((cos(x)) ^3 *( sin (3 *x) )^ 2); [> expand(%); Be are that there some com binations are not allo ed: [> e2 := ln(x)+ln(y); [> combine(e2); [> combine(e2,`symb ol ic `); implicit assumptions [> combine(e2) assuming x>0,y>0; better

to have explicit assumptions Jan ersc helde, Marc 10, 2004 UIC, Dept of Math, Stat CS Lecture 23, page

Page 3

MCS 320 In tro duction to Sym olic Computation Spring 2004 23.2.2 simplify ha used simplify in connection with algebraic um ers. Here see the application of simplify to exp onen tials and trigonometric functions: [> expression := exp(x)*exp(y) sin(x)^2 cos(x)^2; [> simplify(express io n, tri g) using trigonometric identities [> simplify(express io n, exp ); simplifying exponentials [> simplify(express io n, exp ,t rig ); both simplifications Adding extra assumptions, gain con

trol er the simplication pro cess. With the option sym olic, can enforce the sym olic simplication. illustrate this case with what as formerly (and formally) kno wn as the \square ro ot bug" in computer algebra. Recall our lecture on complex um ers. [> sqrtx2 := sqrt(x^2); [> simplify(sqrtx2) [> simplify(sqrtx2, sy mb oli c) [> simplify(sqrtx2, de la y); The option dela has an eect opp osite to the sym olic option. It dela ys simplication, unless completely mathematically sound justication exists. 23.2.3 con ert and trigonometric simplication can write

trigonometric expressions with exp onen tials and vice ersa: [> convert(1/((x-3) *( x^ 2+4 *x +4) ), `pa rf ra c`, x) [> sc := sin(x)*cos(y); [> expsc := convert(sc,exp); [> back := convert(expsc,tri g); is this our original expression? [> simplify(back); another good use of simplify With trigsubs see arious suggestions to substitute giv en expression, for example: [> suggestions := trigsubs(sin(x+ y)) [> suggestions[1] suggestions[7]; [> subs(%,(sin(x+y) )^ 2) 23.3 Simplication w.r.t. side relations Supp ose (analogous to sin cos 1), then can simplify [> simplify(x^3+y^3 ,{ x^ 2+y ^2

1}); The example ab is particular case of general term rewriting sc heme. Let us lo ok at constrained minimization with Lagrange ultipliers, something ha seen in our ul- tiv ariate calculus class. As example, consider the problem of nding those oin ts on the unit sphere whic tak minimal or maximal alues in the function x; xy [> := x^2 y^2 z^2 1; constraint side relation [> := x^2 2*x*y*z z^2; locate minima and maxima of [> sys := {diff(f,x)-lambd a* dif f( g,x ), diff(f,y)-lambda* dif f( g,y ), diff(f,z)-lambda* dif f( g,z ), g} With Gr obner basis rewrite the equations in to an equiv

alen system in triangular form. Jan ersc helde, Marc 10, 2004 UIC, Dept of Math, Stat CS Lecture 23, page

Page 4

MCS 320 In tro duction to Sym olic Computation Spring 2004 [> with(grobner); [> := gbasis(sys,[x,y ,z, la mbd a] ,pl ex ); [> nops(G); [> solve(G[10],lamb da ); gives the Lagrange multipliers The Gr obner basis rev eals lots of other relations et een the ariables. If are in terested in the solutions, select those equations that giv us x, and in function of the Lagrange ultipliers: [> G[1]; [> G[5]; [> G[8]; It is nice exercise to con tin ue the solution of this problem and

to nd actual alues for x, and z. 23.4 Assignmen ts 1. Consider x cos dx Giv the Maple commands to compute the sym olic alue of the in tegral for an negativ alue of the parameter 2. Execute assume(apple,"red"); follo ed is(apple,"red") Giv the Maple commands to hange the remem er table of is so that is(apple,"green") returns true. Do NOT use assume for this hange. 3. Giv the Maple commands to sho the iden tit tan( tan( sin( cos cos 4. Sho that ln(tan( )) arcsinh (tan )) 0, sym olically and umerically 5. Do := follo ed i1 := int(int(f,x),y) and i2 := int(int(f,y),x) Can ou sho that i1

and i2 are the same? 6. Find those oin ts on the surface xy closest to the origin. Set up the system with Lagrange ultipliers and solv e. 7. Giv en the conic section Ax xy 1, where and AC Let denote the distance from the origin to the furthest oin on the conic. Use Maple to sho that 2( AC Find form ula for when denotes the distance from the origin to the nearest oin on the conic. References [1] A. Hec k. Intr duction to Maple Springer-V erlag, third edition, 2003. Jan ersc helde, Marc 10, 2004 UIC, Dept of Math, Stat CS Lecture 23, page

© 2020 docslides.com Inc.

All rights reserved.