{VERSION 4 0 "IBM INTEL LINUX" "4.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 1 }{CSTYLE "2D Output" 2 20 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 1 } {PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Maple Output" 0 11 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 3 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Title" 0 18 1 {CSTYLE "" -1 -1 "" 1 18 0 0 0 0 0 1 1 0 0 0 0 0 0 0 }3 0 0 -1 12 12 0 0 0 0 0 0 19 0 }} {SECT 0 {EXCHG {PARA 18 "" 0 "" {TEXT -1 31 "A Bisection Based Solve R outine" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 85 "Return the real number \+ x^p when x is positive and (-x)^p * m1_val when x is negative." }} {PARA 0 "" 0 "" {TEXT -1 93 "Defined to avoid branch complications whe n considering fractional powers of negative numbers." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 180 "to_power:=proc(x,p,m1_val)\n if x>= 0 then\n evalf(x^p)\n else\n \+ evalf((-x)^p)*m1_val\n fi\nend: \+ " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 40 "to_power(8,1/3,-1); to_ power(-8,1/3,-1);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\$\"+++++?!\"*" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#\$!+++++?!\"*" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 48 "f:=x->to_power(x,1/3,-1)-3*to_power(x-2,1/3,-1); " }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"fGR6#%\"xG6\"6\$%)operatorG%&ar rowGF(,&-%)to_powerG6%9\$#\"\"\"\"\"\$!\"\"F2*&F3F2-F.6%,&F0F2\"\"#F4F1F 4F2F4F(F(F(" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 94 "Returns a set of a pproximate zeroes of f on interval if f has opposite signs at the endp oints." }}{PARA 0 "" 0 "" {TEXT -1 66 "Attempts to determine the zero \+ to an error of at most min_width/2." }}{PARA 0 "" 0 "" {TEXT -1 76 "Th e algorithm tries to keep the location of the zero between left and ri ght." }}{PARA 0 "" 0 "" {TEXT -1 58 "Assumes continuuity but does not \+ assume differentiability." }}{PARA 0 "" 0 "" {TEXT -1 45 "Returns an e mpty list when difficulty arises." }}{PARA 0 "" 0 "" {TEXT -1 32 "Exam ple: bisect_go(f,-5..5,.01);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 1469 "b isect_go:=proc(f,interval,min_width)\n local left,right,mid,so lns,f_left, f_right, f_mid, found;\n found:=false;\n s olns:=\{\};\n left:=evalf(op(1,interval)); right:=evalf(op(2,i nterval)):\n f_left:=f(left); f_right:=f(right);\n if \+ (f_left*f_right> 0) then\n return \{\}\n fi:\n \+ if (f_left=0) then\n solns:= solns union \{left\}: \n found:= true;\n fi:\n if (f_right=0) t hen\n solns:= solns union \{right\}:\n found := true;\n fi:\n\n #now f_left and f_right should be o f opposite sign\n while (((right-left)> min_width) and not fou nd) do\n mid:=(left+right)/2.0;\n \+ f_mid:=f(mid);\n#print(left,mid,right,f_left,f_mid,f_right);\n \+ if (f_mid*f_left < 0) then\n \+ right:= mid; f_right:=f_mid;\n else if (f_mi d*f_right < 0) then\n left:= mid; f_left:=f_ mid;\n else if (f_mid=0) then\n \+ solns:=solns union \{mid\}:\n retur n solns;\n fi: fi: fi:\n od:\n \+ if ((right-left)<= min_width) then\n return solns \+ union \{mid\};\n else\n return \{\}\n fi :\n#print(endgo);\n end: \+ " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "bise ct_go(f,0..1,.01);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<\"" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "val_set:=bisect_go(f,-5..5,.01);" } }{PARA 11 "" 1 "" {XPPMATH 20 "6#>%(val_setG<#\$\"+D\"y+3#!\"*" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "Digits:=10;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%'DigitsG\"#5" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 56 "val_set:=bisect_go(f,-5..5,.0000000000000000000000000 1);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%(val_setG<#\$\"+xI#p2#!\"*" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "f(val_set[1]);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\$\"\"!F\$" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 112 "Return a list of solutions provided by bisect_go for a collection of subintervals of\nwidth at most coarse_width." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 442 "bisect_solve:= proc(f,interval,coarse_width,min_widt h)\n local a,b,upper,solns,new_solns;\n solns:=\{\};\n#p rint(beforewhile);\n a:=op(1,interval);\n b:=op(2,interv al);\n while (a < b)\ndo upper:=a+coarse_width;\n \+ new_solns:=bisect_go(f,a..upper,min_width);\n #print(new _solns);\nsolns:= solns union new_solns;\n a:=upper:\n \+ od;\n solns;\n#print(afterwhile);\nend: \n " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "g:=x->tan(x);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"gG%\$tanG" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 33 "bisect_solve(g,-10..10,1,.00001);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%,beforewhileG" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<#\$!+*z\"yC%*!\"* " }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<#\$!+=5)R&y!\"*" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<#\$!+N-=\$G'! \"*" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<#\$!+9ZR7Z!\"*" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<#\$!+ LRfTJ!\"*" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<#\$!+_Jzq:!\"*" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<#\$\"+_Jzq:!\"*" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<#\$\"+LRfTJ!\"*" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<#\$\"+9ZR7Z!\"*" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<#\$\"+N-=\$G'!\"*" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<#\$\"+=5)R&y!\"*" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<\" " }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<#\$\"+*z\"yC%*!\"*" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%+afterwhileG" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "bisect_solve(f,-5..5,1,.01);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%,beforewhileG" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<#\$\"++D Jq?!\"*" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%+afterwhileG" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "11 0 0" 0 } {VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }