From maple_gr@daisy.uwaterloo.ca Wed Jan 3 12:00:08 1996 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA28555; Wed, 3 Jan 96 12:00:08 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id KAA18320 for maple-list-outgoing; Wed, 3 Jan 1996 10:30:18 -0500 Message-Id: <199601031530.KAA18320@daisy.uwaterloo.ca> From: Maple Group Subject: [MUG] Re: expanding RootOf indexing a Sum To: maple-list@daisy.uwaterloo.ca Date: Wed, 3 Jan 1996 10:23:08 -0500 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Maple Group -=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=- Date: Fri, 22 Dec 95 12:38:20 -0800 From: Robert Israel To: maple-list@daisy.uwaterloo.ca Subject: expanding RootOf indexing a Sum Don Taylor wrote: | I wrote up a set of 3 differential equations for a ladder of 3 resistors | and 3 capacitors charging up to 1 volt. After some study and experimentation | Maple seems to have no problem solving the problem. But it gives the | solution in terms of a sum of terms, each of which is in terms of 'RootOf'. | The whole expression isn't that complicated but I cannot find a way to get | it to factor the 'RootOf' and insert this into the summation. | > eqns:={(1-v1(t))/R-C*diff(v1(t),t)-(v1(t)-v2(t))/R=0, | > (v1(t)-v2(t))/R-C*diff(v2(t),t)-(v2(t)-v3(t))/R=0, | > (v2(t)-v3(t))/R-C*diff(v3(t),t)=0,v1(0)=0,v2(0)=0,v3(0)=0}; | > dsolve(eqns,{v1(t),v2(t),v3(t)},method=laplace); The output you gave is the result of a bit more processing. What I get in Release 3 is / ----- 2 2 2 \ | \ C R (6 + 5 C _r R + C _r R ) exp(_r t)| {v3(t) = 1 + | ) - ----------------------------------------|, | / 2 2 3 3 2 | | ----- 6 C R + 10 C R _r + 3 C R _r | \_r = %1 / / ----- 2 2 2 \ | \ C R (5 + 5 C _r R + C _r R ) exp(_r t)| v2(t) = 1 + | ) - ----------------------------------------|, | / 2 2 3 3 2 | | ----- 6 C R + 10 C R _r + 3 C R _r | \_r = %1 / / ----- 2 2 2 \ | \ C R (3 + 4 C _r R + C _r R ) exp(_r t)| v1(t) = 1 + | ) - ----------------------------------------|} | / 2 2 3 3 2 | | ----- 6 C R + 10 C R _r + 3 C R _r | \_r = %1 / 2 2 2 3 3 3 %1 := RootOf(1 + 6 C _Z R + 5 C _Z R + _Z C R ) # save it in a variable > sol:= ": # here's the "RootOf" > ro:= %1; 2 2 2 3 3 3 ro := RootOf(1 + 6 C _Z R + 5 C _Z R + _Z C R ) # solve this > rts:= [solve(op(ro),_Z)]; 1/3 7 5 rts := [%1 + ------------- - -----, 2 2 1/3 3 C R 9 C R %1 1/3 7 5 1/2 / 1/3 7 \ - 1/2 %1 - -------------- - ----- + 1/2 I 3 |%1 - -------------|, 2 2 1/3 3 C R | 2 2 1/3| 18 C R %1 \ 9 C R %1 / 1/3 7 5 1/2 / 1/3 7 \ - 1/2 %1 - -------------- - ----- - 1/2 I 3 |%1 - -------------|] 2 2 1/3 3 C R | 2 2 1/3| 18 C R %1 \ 9 C R %1 / 1/2 7 I 3 %1 := - -------- + 7/18 ------ 3 3 3 3 54 C R C R # Maple doesn't like constructions of the form "sum(expr, r=[r1, r2, r3])" # so here's a little procedure to take its place: > sumlist:= proc(expr, r) local v,L,j; v := op(1,r); L := op(2,r); convert([seq(subs(v = L[j],expr),j = 1 .. nops(L))],`+`) end; # Now substitute "sumlist" for "sum" and the list of roots for the "RootOf" # in the solution, and evaluate. > eval(subs(sum=sumlist, ro=rts, sol)); 2 2 2 C R (6 + 5 C %5 R + C %5 R ) exp(%5 t) {v3(t) = 1 - ---------------------------------------- 2 2 3 3 2 6 C R + 10 C R %5 + 3 C R %5 2 2 2 C R (6 + 5 C %4 R + C %4 R ) exp(%4 t) - ---------------------------------------- 2 2 3 3 2 6 C R + 10 C R %4 + 3 C R %4 2 2 2 C R (6 + 5 C %3 R + C %3 R ) exp(%3 t) - ----------------------------------------, 2 2 3 3 2 6 C R + 10 C R %3 + 3 C R %3 2 2 2 C R (3 + 4 C %5 R + C %5 R ) exp(%5 t) v1(t) = 1 - ---------------------------------------- 2 2 3 3 2 6 C R + 10 C R %5 + 3 C R %5 2 2 2 C R (3 + 4 C %4 R + C %4 R ) exp(%4 t) - ---------------------------------------- 2 2 3 3 2 6 C R + 10 C R %4 + 3 C R %4 2 2 2 C R (3 + 4 C %3 R + C %3 R ) exp(%3 t) - ----------------------------------------, 2 2 3 3 2 6 C R + 10 C R %3 + 3 C R %3 2 2 2 C R (5 + 5 C %5 R + C %5 R ) exp(%5 t) v2(t) = 1 - ---------------------------------------- 2 2 3 3 2 6 C R + 10 C R %5 + 3 C R %5 2 2 2 C R (5 + 5 C %4 R + C %4 R ) exp(%4 t) - ---------------------------------------- 2 2 3 3 2 6 C R + 10 C R %4 + 3 C R %4 2 2 2 C R (5 + 5 C %3 R + C %3 R ) exp(%3 t) - ---------------------------------------- } 2 2 3 3 2 6 C R + 10 C R %3 + 3 C R %3 1/2 7 I 3 %1 := - -------- + 7/18 ------ 3 3 3 3 54 C R C R 1/2 / 1/3 7 \ %2 := I 3 |%1 - -------------| | 2 2 1/3| \ 9 C R %1 / 1/3 7 5 %3 := - 1/2 %1 - -------------- - ----- - 1/2 %2 2 2 1/3 3 C R 18 C R %1 1/3 7 5 %4 := - 1/2 %1 - -------------- - ----- + 1/2 %2 2 2 1/3 3 C R 18 C R %1 1/3 7 5 %5 := %1 + ------------- - ----- 2 2 1/3 3 C R 9 C R %1 Hope this helps. Robert Israel israel@math.ubc.ca Department of Mathematics (604) 822-3629 University of British Columbia fax 822-6074 Vancouver, BC, Canada V6T 1Y4 -=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=- Date: Thu, 21 Dec 1995 18:40:17 -0800 To: maple-list@daisy.uwaterloo.ca From: drfredkin@ucsd.edu (Donald R. Fredkin) Subject: expanding RootOf indexing a Sum I get a different form for the result of dsolve: / ----- 2 2 2 \ | \ C R (3 + 4 C _r R + C _r R ) exp(_r t)| {v1(t) = 1 + | ) - ----------------------------------------|, | / 2 2 3 3 2 | | ----- 6 C R + 10 C R _r + 3 C R _r | \_r = %1 / / ----- 2 2 2 \ | \ C R (5 + 5 C _r R + C _r R ) exp(_r t)| v2(t) = 1 + | ) - ----------------------------------------|, | / 2 2 3 3 2 | | ----- 6 C R + 10 C R _r + 3 C R _r | \_r = %1 / / ----- 2 2 2 \ | \ C R (6 + 5 C _r R + C _r R ) exp(_r t)| v3(t) = 1 + | ) - ----------------------------------------|} | / 2 2 3 3 2 | | ----- 6 C R + 10 C R _r + 3 C R _r | \_r = %1 / 2 2 2 3 3 3 %1 := RootOf(1 + 6 C _Z R + 5 C _Z R + _Z C R ) Now I say > assign("); to capture the solution in a useful form. I can go further if I am prepared to specify R and C numerically: > V := evalf(subs(R=1,C=1,[v1(t),v2(t),v3(t)])); V := [1. - .1075743423 exp( - 3.2469796037175 t) - .3492916954 exp( - 1.5549581320874 t) - .5431339623 exp( - .19806226419516 t), 1. + .1341430108 exp( - 3.2469796037175 t) - .1554494286 exp( - 1.5549581320874 t) - .9786935822 exp( - .19806226419516 t), 1. - .05969925608 exp( - 3.2469796037175 t) + .2801101914 exp( - 1.5549581320874 t) - 1.220410935 exp( - .19806226419516 t)] which, I think, is what is wanted. -- Donald R. Fredkin drfredkin@ucsd.edu From israel@math.ubc.ca Wed Jan 3 15:21:52 1996 Received: from galois.math.ubc.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA05666; Wed, 3 Jan 96 15:21:52 -0800 Date: Wed, 3 Jan 96 15:21:52 -0800 From: Robert Israel Received: by galois.math.ubc.ca id PAA15813; Wed, 3 Jan 1996 15:23:11 -0800 Message-Id: <199601032323.PAA15813@galois.math.ubc.ca> To: maple-list@daisy.uwaterloo.ca Subject: Re: [MUG] Heaviside and Assume In-Reply-To: Mail from '"Eliezer Z. Prisman" ' dated: Mon, 25 Dec 1995 21:51:10 -0500 (EST) Cc: israel Status: RO "Eliezer Z. Prisman" wrote: assume(s>=0); is(Heaviside(s)=1); FAIL WHY MAPLE DOES SAY "FAIL" FOR IT? I guess you could call it a bug. Heaviside(0) comes out as 1, and if you assume s > 0 then Heaviside(s) will be 1 also, but assuming s >= 0 won't work. The code for "Heaviside" in Release 3 is as follows: proc(x) local s; options `Copyright 1993 by Waterloo Maple Software`; if type(procname,'indexed') then ERROR(`invalid args`) fi; if nargs <> 1 then ERROR(`Heaviside takes one algebraic argument`) fi; s := signum(0,x,0); if s = 0 then 1 elif s = 1 then 1 elif s = -1 then 0 else 'Heaviside(x)' fi end I don't know why it doesn't use signum(0,x,1): this would return 1 if x = 0, while signum(0,x,0) returns 0 if x = 0. If you make a new function, changing the signum(0,x,0) to signum(0,x,1), it will work. Robert Israel israel@math.ubc.ca Department of Mathematics (604) 822-3629 University of British Columbia fax 822-6074 Vancouver, BC, Canada V6T 1Y4 From maple_gr@daisy.uwaterloo.ca Wed Jan 3 11:30:17 1996 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA27689; Wed, 3 Jan 96 11:30:17 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id KAA17915 for maple-list-outgoing; Wed, 3 Jan 1996 10:25:13 -0500 Message-Id: <199601031525.KAA17915@daisy.uwaterloo.ca> From: hf@glare.in-chemnitz.de (Holger Friedrich) Subject: [MUG] Re: Kronecker delta To: maple-list@daisy.uwaterloo.ca Date: Sun, 24 Dec 1995 23:56:52 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: hf@glare.in-chemnitz.de (Holger Friedrich) >I think your "delta" procedure should also return 1 if the two arguments are equal, >even if they aren't numeric. > >> delta := proc(j, k) > if j=k then 1 > elif type([j, k], [numeric, numeric]) then 0 > else 'delta'(args) > fi > end; > You were right, of course. This just did not matter when I was investigating situations in which the arguments to the deltas always evaluated to specific integers in the end. If I want to get the final answers for something like delta(n, n) or delta(n, n+1) without specifying a specific value for n, I have to do what you suggested... and even take it one step further: delta := proc(j, k) if not type(j - k, numeric) then RETURN('procname(args)') fi; if j = k then 1 else 0 fi; end: This version returns zero for delta(n, n+1). After all, there is already enough information to figure out that it is zero. Thanks again for your suggestion. It was helpful. Regards, -- Holger Friedrich Chemnitz, Germany E-Mail: hf@glare.in-chemnitz.de Second chance: easy!glare!hf@thunder.hrz.tu-chemnitz.de From maple_gr@daisy.uwaterloo.ca Wed Jan 3 11:31:21 1996 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA27841; Wed, 3 Jan 96 11:31:21 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id KAA17834 for maple-list-outgoing; Wed, 3 Jan 1996 10:24:32 -0500 Message-Id: <199601031524.KAA17834@daisy.uwaterloo.ca> From: Robert Israel Subject: [MUG] Re: plotting flows To: maple-list@daisy.uwaterloo.ca Date: Fri, 22 Dec 95 11:58:55 -0800 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Robert Israel Brian Sanderson with(plots): # here is the system of DE's corresponding to a vector field. > des:= D(x)(t)=y(t)-x(t)^3, D(y)(t)=z(t)^2 - y(t)^3, D(z)(t)=x(t)*y(t) - z(t)^3 ; # make a list of initial conditions forming a line on the y axis from y=-1 to y=1 # at intervals of 0.1. > ics:= [ seq([x(0)=0, y(0)=0.1 * j, z(0)=0], j=-10..10) ]; # make a list of numeric solution procedures, one per initial condition > F:= map( ic -> dsolve({des, op(ic)}, {x(t), y(t), z(t)}, numeric), ics): # for each initial condition, plot the solution curve for 0<=t<=2 > scurves:= map(f -> odeplot(f, [x(t),y(t),z(t)], 0..2, numpoints=80), F): # extract the lists of points from the plot structures > map(indets, scurves, specfunc(anything, CURVES)): > ptlists:= map(op,map(op,")): # now "transpose" this list of lists of points, so each list of points is for # a particular t. > tlists:= [seq([seq(ptlists[i][j], i=1..nops(ptlists))], j=1..nops(ptlists[1]))]: # make a list of plots using spacecurve > sections:= map(spacecurve, tlists): # instead of an 80-frame animation, which would use a tremendous amount # of memory, I'll make 8 frames, each with 10 of the sections, plus the original # solution curves. > frames:= [ seq( display({ seq(sections[i+8*j], j=0..9), op(scurves) }), i=1..8) ]: # and now display it as an animation > display(frames, insequence=true); The animation is best viewed as a continuous loop. Hope this helps. Robert Israel israel@math.ubc.ca Department of Mathematics (604) 822-3629 University of British Columbia fax 822-6074 Vancouver, BC, Canada V6T 1Y4 From israel@math.ubc.ca Wed Jan 3 16:09:37 1996 Received: from galois.math.ubc.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA07221; Wed, 3 Jan 96 16:09:37 -0800 Date: Wed, 3 Jan 96 16:09:37 -0800 From: Robert Israel Received: by galois.math.ubc.ca id QAA16258; Wed, 3 Jan 1996 16:10:55 -0800 Message-Id: <199601040010.QAA16258@galois.math.ubc.ca> To: maple-list@daisy.uwaterloo.ca Subject: Re: [MUG] Need for Help In-Reply-To: Mail from '"DANIEL WILLARD, WILL" ' dated: Tue, 2 Jan 96 08:38:20 EST Cc: israel Status: RO "DANIEL WILLARD, WILL" writes: | Consider the product | A[k] * z^n * f[k] | where n and k are integers, | positive or negative (range unspecified). I wish an operator or procedure | which will convert this into | A[k] * f[k+n]. The following procedure converts such a term. > convterm:= proc(x) local s, fk,C,n; if not match(x=C*z^n, z, s) then RETURN(x) fi; fk:= select(t -> op(0,t)=f, indets(x, indexed)); if nops(fk) <> 1 then RETURN(x) fi; fk:= op(fk); subs(s, C/fk * f[op(fk)+n]); end; | Such products occur in sums of unpredictable length. Use "map" to apply "convterm" to each term of a sum. For example: > expr:= A[1]*z*f[1]+A[2]*z^2*f[2]+A[0]*f[0]+A[-1]/z*f[j]; 2 A[-1] f[j] expr := A[1] z f[1] + A[2] z f[2] + A[0] f[0] + ---------- z > map(convterm, expr); A[1] f[2] + A[2] f[4] + A[0] f[0] + A[-1] f[j - 1] Robert Israel israel@math.ubc.ca Department of Mathematics (604) 822-3629 University of British Columbia fax 822-6074 Vancouver, BC, Canada V6T 1Y4 From israel@math.ubc.ca Thu Jan 4 15:28:45 1996 Received: from galois.math.ubc.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA22197; Thu, 4 Jan 96 15:28:45 -0800 Date: Thu, 4 Jan 96 15:28:45 -0800 From: Robert Israel Received: by galois.math.ubc.ca id PAA20507; Thu, 4 Jan 1996 15:30:05 -0800 Message-Id: <199601042330.PAA20507@galois.math.ubc.ca> To: bjs@maths.warwick.ac.uk Subject: Re: curve flowing In-Reply-To: Mail from 'Brian Sanderson ' dated: Thu, 4 Jan 1996 11:12:19 GMT Cc: israel Status: RO > Tried your suggestion. UNfortunately our release 3 license has expired > and `specfunc' is not in release 2 so I will have to wait. Will let > you know when we get the license back. I am trying to visualise > something like the topologists `belt trick'. "specfunc" is in release 2. The only thing in my solution that doesn't work in release 2 is that "spacecurve" doesn't draw a curve through a list of points. It's easy to get around that, however. Just replace the line > sections:= map(spacecurve, tlists): by > sections:= map(t -> PLOT3D(CURVES(t)), tlists): and it will work in release 2. Robert Israel israel@math.ubc.ca Department of Mathematics (604) 822-3629 University of British Columbia fax 822-6074 Vancouver, BC, Canada V6T 1Y4 ------------ Aha! To check for an indexed expression with given index types: > type(f[n,1], indexed({name,integer})); true From maple_gr@daisy.uwaterloo.ca Tue Jan 9 14:23:56 1996 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA05513; Tue, 9 Jan 96 14:23:56 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id LAA26164 for maple-list-outgoing; Tue, 9 Jan 1996 11:55:40 -0500 Message-Id: <199601091655.LAA26164@daisy.uwaterloo.ca> From: monagan@cecm.sfu.ca (Michael Monagan) Subject: [MUG] Re: Variable names in output of D operator To: maple-list@daisy.uwaterloo.ca Date: Mon, 8 Jan 1996 11:53:40 -0800 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: monagan@cecm.sfu.ca (Michael Monagan) Dear Martin, > f := t -> F(x(t), y(t)); f := t -> F(x(t), y(t)) > D(f); t -> D[1](F)(x(t), y(t)) D(x)(t) + D[2](F)(x(t), y(t)) D(y)(t) I would like to get t -> D[x](F)(x(t), y(t)) D(x)(t) + D[y](F)(x(t), y(t)) D(y)(t) ================================================================================= Using alias is probably the simplest solution here. Mike |\^/| Maple V Release 3 (Simon Fraser University) ._|\| |/|_. Copyright (c) 1981-1994 by Waterloo Maple Software and the \ MAPLE / University of Waterloo. All rights reserved. Maple and Maple V <____ ____> are registered trademarks of Waterloo Maple Software. | Type ? for help. > f := t -> F(x(t), y(t)); f := t -> F(x(t), y(t)) > D(f); t -> D[1](F)(x(t), y(t)) D(x)(t) + D[2](F)(x(t), y(t)) D(y)(t) > alias( D[x](F)=D[1](F), D[y](F)=D[2](F) ); > D(f); t -> D[x](F)(x(t), y(t)) D(x)(t) + D[y](F)(x(t), y(t)) D(y)(t) From maple_gr@daisy.uwaterloo.ca Tue Jan 9 14:46:23 1996 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA06487; Tue, 9 Jan 96 14:46:23 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id LAA26047 for maple-list-outgoing; Tue, 9 Jan 1996 11:54:22 -0500 Message-Id: <199601091654.LAA26047@daisy.uwaterloo.ca> From: Maple Group Subject: [MUG] Re: Need for Help To: maple-list@daisy.uwaterloo.ca Date: Tue, 9 Jan 1996 11:44:32 -0500 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Maple Group -=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=- Date: Wed, 3 Jan 96 16:09:37 -0800 From: Robert Israel To: maple-list@daisy.uwaterloo.ca Subject: Need for Help "DANIEL WILLARD, WILL" writes: | Consider the product | A[k] * z^n * f[k] | where n and k are integers, | positive or negative (range unspecified). I wish an operator or procedure | which will convert this into | A[k] * f[k+n]. The following procedure converts such a term. > convterm:= proc(x) local s, fk,C,n; if not match(x=C*z^n, z, s) then RETURN(x) fi; fk:= select(t -> op(0,t)=f, indets(x, indexed)); if nops(fk) <> 1 then RETURN(x) fi; fk:= op(fk); subs(s, C/fk * f[op(fk)+n]); end; | Such products occur in sums of unpredictable length. Use "map" to apply "convterm" to each term of a sum. For example: > expr:= A[1]*z*f[1]+A[2]*z^2*f[2]+A[0]*f[0]+A[-1]/z*f[j]; 2 A[-1] f[j] expr := A[1] z f[1] + A[2] z f[2] + A[0] f[0] + ---------- z > map(convterm, expr); A[1] f[2] + A[2] f[4] + A[0] f[0] + A[-1] f[j - 1] Robert Israel israel@math.ubc.ca Department of Mathematics (604) 822-3629 University of British Columbia fax 822-6074 Vancouver, BC, Canada V6T 1Y4 -=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=- Date: Thu, 04 Jan 1996 13:20:48 +0000 To: maple-list@daisy.uwaterloo.ca From: Stanley J Houghton Subject: Need for Help At 08:38 02/01/96 EST, you wrote: >>> From: "DANIEL WILLARD, WILL" > >Subject: Need for Help > > Happy New Year, you all! I have a problem, Dr. Anthony. > Consider the product > A[k] * z^n * f[k] > where n and k are integers, >positive or negative (range unspecified). I wish an operator or procedure >which will convert this into > A[k] * f[k+n]. > Such products occur in sums of >unpredictable length, and the order of the three multiplicands in any >product is itself unpredictable. Further, if the exponent of z happens to be >0 (zero), z^0 will not actually be in the product. I have many such sums, >most of considerable length, to process, as an intermediate step in a >process I shall not bore you with. And I sha'n't confuse you with the many >unsuccessful ways I have tried. Daniel I experimented with your problem without really understanding it but hope that the example below will help. You will see that it certainly does the necessary parsing and manipulation. I used an iterative solution to the unknown order of the product as you will see. If f[k] term is missing, the value is unaltered. I was not sure if I should test for the same substcript in A and f (ie both A[k] and f[k] but not A[k] and f[j]). However, I didn't include it since I thought it wasn't intented. As a matter of interest the use of indets (which I include below) is a useful way of extracting terms that you need. You can then divide and simplify to eradicate them. Hope it helps and all the best for 1996 Stanley Houghton Computer Centre University of Bradford England > restart; > conv:= > proc(s)local result,fk,term,n; > if type (s,`+`) then #apply to elements of a sum > map(conv,s) > elif not type(s,`*`) then #not a product > s > else > result:=1; #result initialised for iterative loop > fk:=0; #set to term of form f[k] > n:=0; #power of z in the product > for term in op(s) do > if type(term,f[anything]) then #f[k] term found > fk:=term > elif term='z' then #take care of z^1 > n:=1 > elif type(term,`^`) and op(1,term)='z' then #take care of z^expr > n:=op(2,term) > else > result:=result*term > fi > od; > if fk=0 then #no f term so put z term back in > result*'z'^n > else > result*op(0,fk)[op(1,fk)+n] > fi; > fi > end: > > s:=A[k] * z^n * f[k]+A[k]*z*f[k]+B[j]*f[k]-A[k]*z^n+B[j]*z^3*f[j]:s; > conv(s); > map(indets,[op(s)]); > map(indets,[op(s)],name^anything); > map(indets,[op(s)],f[anything]); > From maple_gr@daisy.uwaterloo.ca Tue Jan 9 15:27:45 1996 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA07531; Tue, 9 Jan 96 15:27:45 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id LAA25391 for maple-list-outgoing; Tue, 9 Jan 1996 11:41:52 -0500 Message-Id: <199601091641.LAA25391@daisy.uwaterloo.ca> From: Robert Israel Subject: [MUG] Re: Heaviside and Assume To: maple-list@daisy.uwaterloo.ca Date: Wed, 3 Jan 96 15:21:52 -0800 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Robert Israel "Eliezer Z. Prisman" wrote: assume(s>=0); is(Heaviside(s)=1); FAIL WHY MAPLE DOES SAY "FAIL" FOR IT? I guess you could call it a bug. Heaviside(0) comes out as 1, and if you assume s > 0 then Heaviside(s) will be 1 also, but assuming s >= 0 won't work. The code for "Heaviside" in Release 3 is as follows: proc(x) local s; options `Copyright 1993 by Waterloo Maple Software`; if type(procname,'indexed') then ERROR(`invalid args`) fi; if nargs <> 1 then ERROR(`Heaviside takes one algebraic argument`) fi; s := signum(0,x,0); if s = 0 then 1 elif s = 1 then 1 elif s = -1 then 0 else 'Heaviside(x)' fi end I don't know why it doesn't use signum(0,x,1): this would return 1 if x = 0, while signum(0,x,0) returns 0 if x = 0. If you make a new function, changing the signum(0,x,0) to signum(0,x,1), it will work. Robert Israel israel@math.ubc.ca Department of Mathematics (604) 822-3629 University of British Columbia fax 822-6074 Vancouver, BC, Canada V6T 1Y4 From ddubois@maplesoft.com Tue Jan 9 14:11:41 1996 Received: from wildecho.maplesoft.on.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA05047; Tue, 9 Jan 96 14:11:41 -0800 Received: by wildecho.maplesoft.on.ca id AA12605 (5.65c/IDA-1.4.4 for israel@math.ubc.ca); Tue, 9 Jan 1996 17:11:24 -0500 Date: Tue, 9 Jan 1996 17:11:24 -0500 From: Dan Dubois Message-Id: <199601092211.AA12605@wildecho.maplesoft.on.ca> To: israel@math.ubc.ca Subject: [MUG] Re: Heaviside and Assume Cc: support@maplesoft.com Status: RO Dear Dr. Israel: This is in response to your message on the Maple Users Group: > "Eliezer Z. Prisman" wrote: > assume(s>=0); > is(Heaviside(s)=1); > FAIL > WHY MAPLE DOES SAY "FAIL" FOR IT? > I guess you could call it a bug. Heaviside(0) comes out as 1, and > if you assume s > 0 then Heaviside(s) will be 1 also, but assuming > s >= 0 won't work. The code for "Heaviside" in Release 3 is as follows: > proc(x) > local s; > options `Copyright 1993 by Waterloo Maple Software`; > if type(procname,'indexed') then ERROR(`invalid args`) fi; > if nargs <> 1 then > ERROR(`Heaviside takes one algebraic argument`) > fi; > s := signum(0,x,0); > if s = 0 then 1 > elif s = 1 then 1 > elif s = -1 then 0 > else 'Heaviside(x)' > fi > end > I don't know why it doesn't use signum(0,x,1): this would return 1 if x = 0, > while signum(0,x,0) returns 0 if x = 0. If you make a new function, changing > the signum(0,x,0) to signum(0,x,1), it will work. In Maple V Release 4 the Heaviside(t) function is defined as zero for t < 0, 1 for t > 0 and is not defined at 0. In this case FAIL will still be returned and Heaviside(0) will not evaluate. |\^/| Maple V Release 4 ._|\| |/|_. Copyright (c) 1981-1995 by Waterloo Maple Inc. All rights \ MAPLE / reserved. Maple and Maple V are registered trademarks of <____ ____> Waterloo Maple Inc. | Type ? for help. > interface(verboseproc=2); > print(Heaviside); proc(x) local s; option remember, `Copyright (c) 1992 by the University of Waterloo. All rights reserved.`; if type(procname, 'indexed') then ERROR(`invalid args`) fi; if nargs <> 1 then ERROR(`Heaviside takes one algebraic argument`) fi; s := signum(0, x, 0); if s = 1 then 1 elif s = -1 then 0 else 'Heaviside(x)' fi end Dan -- ***************************************************************** * Daniel Dubois Tech. Phone: (519) 747-2505 * * Waterloo Maple Inc. Alt. Phone: (519) 747-2373 * * Technical Support Manager FAX : (519) 747-5284 * ***************************************************************** * email: support@maplesoft.com (support issues) * * ddubois@maplesoft.com (personal address) * * www : http://www.maplesoft.com * ***************************************************************** From deghare@daisy.uwaterloo.ca Thu Jan 11 11:48:35 1996 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA03757; Thu, 11 Jan 96 11:48:35 -0800 Received: (from deghare@localhost) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id OAA04025; Thu, 11 Jan 1996 14:48:29 -0500 Date: Thu, 11 Jan 1996 14:48:29 -0500 From: Dave Hare Message-Id: <199601111948.OAA04025@daisy.uwaterloo.ca> To: israel@math.ubc.ca Subject: Re: Integration with Maple V R3 Cc: watmaple@daisy.uwaterloo.ca Status: RO > From: Robert Israel > > Dave: > > You wrote: > > | Note the problem has been fixed for Release 4: > > | > int(cos(x)/(1+x^2),x=-infinity..infinity); > | -Pi sinh(1) + Pi cosh(1) > > Yes and no. This particular one was fixed by choosing a different branch > cut for Ci. But the basic problem still remains: Maple does not seem to > have a way of detecting when an integration path crosses a branch cut. > And so examples still pop up, such as this one which was pointed out > by David Mazziotti: > > > assume(w>0); > > int( 1/(1+t^2)*exp(-I*w*t); > 0 > > Here's another, which doesn't involve special functions at all, just "ln". > I don't have R4 with me right now, but expect it to have the same trouble > as R2 and R3 on this one: > > > int(exp(I*t)/(exp(I*t)+1/2), t=0..2*Pi); > > 0 > > Answer should be 2*Pi. Maple gets - I ln(exp(I t) + 1/2) for the > antiderivative, and doesn't know about the branch cut. Yes, I know. I wasn't trying to claim that the problem of integration mixing with branch cuts is solved. It is quite a difficult problem. Dave From maple_gr@daisy.uwaterloo.ca Thu Jan 11 16:54:50 1996 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA14323; Thu, 11 Jan 96 16:54:50 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id PAA11369 for maple-list-outgoing; Thu, 11 Jan 1996 15:49:50 -0500 Message-Id: <199601112049.PAA11369@daisy.uwaterloo.ca> From: David Casperson Subject: [MUG] Maple logic (was Re: Info on Maple) To: maple-list@daisy.uwaterloo.ca Date: Wed, 10 Jan 1996 12:12:22 -0800 (PST) Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: David Casperson > >> From: "Preeti Rastogi" > > Hi, > > I am making a tool using one of the computer algebra systems. I > would greatly appreciate any help in that direction. Thanks a > lot in advance. > > The questions I have are - > > [...](2) What is the reliability of results (especially symbolic > Logic package) of Maple? Is there any record of the errors > encountered? Maple has systemic problems resulting from design confusion about whether it should use Boolean (2-valued) or home-grown (3-valued) logic. This manifests itself as bugs in that the built-in simplifier assumes the laws of 2-valued logic, so > 'q' and not 'q' gives false, but if 'q' is instantiated with FAIL (the third value of three value logic) the correct result is FAIL. Thus > FAIL and not FAIL gives FAIL. The surprise comes when you try something like > subs('q'=FAIL,''q' and not 'q''). In general the simplifier is overly aggressive in simplifying logical expressions. (It also does things inconsistent with the programming language semantics like simplifying 'ERROR() and false' to false.) HOWEVER, if you stick with 2-valued logic, the simplifier behaves itself, to the best of my knowledge. I don't know whether these problems affect any of the higher level packages, but you should be aware of the above if you intend to write your own Maple procedures. Briefly summarized: the logic that the Maple language describes is not the logic of the Maple programming language. David Casperson, casper@unbc.edu University of Northern British Columbia. From maple_gr@daisy.uwaterloo.ca Thu Jan 11 17:08:11 1996 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA14850; Thu, 11 Jan 96 17:08:11 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id PAA11329 for maple-list-outgoing; Thu, 11 Jan 1996 15:49:22 -0500 Message-Id: <199601112049.PAA11329@daisy.uwaterloo.ca> From: Stanley J Houghton Subject: [MUG] Re: plotting points To: maple-list@daisy.uwaterloo.ca Date: Wed, 10 Jan 1996 14:08:17 +0000 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Stanley J Houghton Try using plots[textplot] instead of plot and use the parameter font=[SYMBOL,pointsize] where pointsize is the size you want. This will get you part way there but I would need to experiment for log scales. You may have to write a small proc to convert values to the new coordinates and draw your own axes. 'map' may be a help as in coords:=[[1,1],[2,2]]; plots[textplot](map(x->[op(x),`+`],coords),font=[SYMBOL,36]); to save adding the symbol to each coordinate. The only problem I encountered was poor display of overlapping symbols. However, it all prints ok. Stan At 15:50 04/01/96 MEZ, you wrote: >>> From: Frank Gerdes > >Dear MUGers, > >I want to plot some points. >Using the MAPLE command > plot( [ [1,1] , [2,2] ] ,style=point ); >I obtain a plot with very small crosses. But what I need are >big circles, triangles and so on. I want to plot them in linear >scale and logarithmic scale. > >Can anybody help me? Any hints are appreciated. > >I use Maple V Release 3. > >Thanks, > >frank gerdes >University of Oldenburg, Germany > > >P.S.: In the German book "Maple V Release 2 - Einfuehrung und >Leitfaden fuer den Praktiker" written by Michael Kofler a solution >of my problem can be found. But the commmand presented there cannot >be used in logarithmic scale. > > > > > From bjs@maths.warwick.ac.uk Tue Jan 16 07:46:42 1996 Received: from [137.205.232.28] by raven.math.ubc.ca (911016.SGI/1.14) id AA20617; Tue, 16 Jan 96 07:46:42 -0800 From: Brian Sanderson Received: from keld.maths.warwick.ac.uk by ribble.maths.warwick.ac.uk; Tue, 16 Jan 1996 15:43:25 GMT Date: Tue, 16 Jan 1996 15:43:26 GMT Message-Id: <7310.199601161543@keld.maths.warwick.ac.uk> To: israel@math.ubc.ca Subject: diff flows Cc: bjs@maths.warwick.ac.uk Status: RO Still having problems. The University has lost its maple 3 licence and reverted to maple 1. I have maple release 2 at home but run into improper op or subscript selector message at the line frames:= .............. Here is the file I am using. Help would be much appreciated. Brian Sanderson {VERSION 1 1 "MS-Windows" "1.0"}{GLOBALS 3 2}{FONT 0 "Lucida Sans Typewriter" "Lucida Sans Typewriter" "Times-Roman" 6 10 64 "Time s-Roman" 10{COLOR "ff0000"}}{FONT 1 "" "" "Helvetica" 4 11 0 "Hel vetica" 11{COLOR "000000"}}{FONT 2 "Courier New" "Courier New" "C ourier" 4 10 192 "Courier" 10{COLOR "000000"}}{SCP_R 0 0 24{SCP_R 1 0 1{INP_R 3 0 "> "{TEXT 0 12 "with(plots):"}}}{SCP_R 5 0 1 {COM_R 7 0{TEXT 1 61 "# here is the system of DE's corresponding to a vector field."}}}{SCP_R 9 0 1{INP_R 11 0 "> "{TEXT 0 81 "des := D(x)(t)=y(t)-x(t)^3, D(y)(t)=z(t)^2 - y(t)^3, D(z)(t)=x(t)*y( t) - z(t)^3 ;"}}}{SCP_R 13 0 2{COM_R 15 0{TEXT 1 81 "# make a lis t of initial conditions forming a line on the y axis from y=-1 to y=1"}}{COM_R 18 0{TEXT 1 22 "# at intervals of 0.1."}}}{SCP_R 20 0 1{INP_R 22 0 "> "{TEXT 0 57 "ics:= [ seq([x(0)=0, y(0)=0.1 * j , z(0)=0], j=-10..10) ];"}}}{SCP_R 24 0 1{COM_R 26 0{TEXT 1 71 "# make a list of numeric solution procedures, one per initial cond ition"}}}{SCP_R 28 0 1{INP_R 30 0 "> "{TEXT 0 72 "F:= map( ic -> dsolve(\{des, op(ic)\}, \{x(t), y(t), z(t)\}, numeric), ics):"}}} {SCP_R 32 0 1{COM_R 34 0{TEXT 1 65 "# for each initial condition, plot the solution curve for 0<=t<=2"}}}{SCP_R 36 0 1{INP_R 38 0 "> "{TEXT 0 72 "scurves:= map(f -> odeplot(f, [x(t),y(t),z(t)], 0 ..2, numpoints=80), F):"}}}{SCP_R 40 0 1{COM_R 42 0{TEXT 1 54 "# extract the lists of points from the plot structures"}}}{SCP_R 44 0 2{INP_R 46 0 "> "{TEXT 0 49 "map(indets, scurves, specfunc(any thing, CURVES)):"}}{INP_R 49 0 "> "{TEXT 0 28 "ptlists:= map(op,m ap(op,\"));"}}}{SCP_R 51 0 2{COM_R 53 0{TEXT 1 77 "# now \"transp ose\" this list of lists of points, so each list of points is for "}}{COM_R 56 0{TEXT 1 17 "# a particular t."}}}{SCP_R 58 0 1 {INP_R 60 0 "> "{TEXT 0 80 "tlists:= [seq([seq(ptlists[i][j], i=1 ..nops(ptlists))], j=1..nops(ptlists[1]))]:"}}}{SCP_R 62 0 1 {COM_R 64 0{TEXT 1 39 "# make a list of plots using spacecurve"}} }{SCP_R 66 0 1{COM_R 68 0{TEXT 1 36 "#sections:= map(spacecurve, tlists):"}}}{SCP_R 70 0 1{INP_R 72 0 "> "{TEXT 0 43 "sections:=ma p(t->plot3D(CURVES(t)),tlists):"}}}{SCP_R 74 0 3{COM_R 76 0{TEXT 1 71 "# instead of an 80-frame animation, which would use a treme ndous amount"}}{COM_R 79 0{TEXT 1 80 "# of memory, I'll make 8 fr ames, each with 10 of the sections, plus the original"}}{COM_R 82 0{TEXT 1 18 "# solution curves."}}}{SCP_R 84 0 1{INP_R 86 0 "> " {TEXT 0 82 "frames:= [ seq( display(\{ seq(sections[i+8*j], j=0.. 9), op(scurves) \}), i=1..8) ]:"}}}{SCP_R 88 0 1{COM_R 90 0{TEXT 1 36 "# and now display it as an animation"}}}{SCP_R 92 0 1{INP_R 94 0 "> "{TEXT 0 34 "display(frames, insequence=true); "}}} {SCP_R 96 0 1{INP_R 98 0 "> "{TEXT 0 37 "SEq := seq(sections[i+8* j], j=0..9); "}}}{SCP_R 100 0 1{INP_R 102 0 "> "{TEXT 0 13 "secti ons(10);"}}}{SCP_R 104 0 1{INP_R 106 0 "> "{TEXT 0 8 "?display"}} }{SCP_R 108 0 1{INP_R 110 0 "> "{TEXT 0 0 ""}}}}{END} From israel@math.ubc.ca Tue Jan 16 09:27:05 1996 Received: from galois.math.ubc.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA23850; Tue, 16 Jan 96 09:27:05 -0800 Date: Tue, 16 Jan 96 09:27:05 -0800 From: Robert Israel Received: by galois.math.ubc.ca id JAA26561; Tue, 16 Jan 1996 09:28:35 -0800 Message-Id: <199601161728.JAA26561@galois.math.ubc.ca> To: bjs@maths.warwick.ac.uk Subject: Re: diff flows In-Reply-To: Mail from 'Brian Sanderson ' dated: Tue, 16 Jan 1996 15:43:26 GMT Cc: israel Status: RO Brian: Change that "plot3D" to "PLOT3D" in the "sections:= ..." line and it will work in Release 2. I can't help you with Release 1. Robert From maple_gr@daisy.uwaterloo.ca Thu Jan 18 11:59:21 1996 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA03885; Thu, 18 Jan 96 11:59:21 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id JAA14531 for maple-list-outgoing; Thu, 18 Jan 1996 09:09:17 -0500 Message-Id: <199601181409.JAA14531@daisy.uwaterloo.ca> From: Robert Israel Subject: [MUG] Re: Heaviside and Assume To: maple-list@daisy.uwaterloo.ca Date: Thu, 11 Jan 96 17:11:26 -0800 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Robert Israel Peter Giesselink wrote: | I guess it is the use of the assume function who causes the trouble: | assume(s,positive): | isgiven(s>=0); | TRUE | is(Heaviside(s)=1); | TRUE That's not the point. "positive" in Maple (as in standard mathematical English, although apparently not in some other languages) means > 0, not >= 0. > assume(s, positive); > isgiven(s > 0); true Heaviside(s) returns 1 if s=0, and also if (because of "assume") Maple knows s>0, but not if Maple just knows s>=0. Robert Israel israel@math.ubc.ca Department of Mathematics (604) 822-3629 University of British Columbia fax 822-6074 Vancouver, BC, Canada V6T 1Y4 From maple_gr@daisy.uwaterloo.ca Thu Jan 18 12:11:25 1996 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA04412; Thu, 18 Jan 96 12:11:25 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id JAA14586 for maple-list-outgoing; Thu, 18 Jan 1996 09:10:45 -0500 Message-Id: <199601181410.JAA14586@daisy.uwaterloo.ca> From: reinders@math2.rwth-aachen.de (Priv. Doz. Dr. M. Reinders) Subject: [MUG] Re: Variable names in output of D operator To: maple-list@daisy.uwaterloo.ca Date: Tue, 16 Jan 1996 14:02:04 +0100 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: reinders@math2.rwth-aachen.de (Priv. Doz. Dr. M. Reinders) Dear Maple Users! Some time ago I asked > I have a function F of two variables x and y. When I differentiate F > using the D operator, I would prefer the output D[x](F), D[y](F), > D[x,x](F), ... instead of D[1](F), D[2](F), D[1,1](F), ... . > > Example: > > > f := t -> F(x(t), y(t)); > > f := t -> F(x(t), y(t)) > > > D(f); > > t -> D[1](F)(x(t), y(t)) D(x)(t) + D[2](F)(x(t), y(t)) D(y)(t) > > I would like to get > > t -> D[x](F)(x(t), y(t)) D(x)(t) + D[y](F)(x(t), y(t)) D(y)(t) Thanks to all who replied to my question. The suggestion was to use > subs(D[1]=D[x], D[2]=D[y], D(f)); or > alias( D[x](F)=D[1](F), D[y](F)=D[2](F) ); The problem is that the function F above was only an example In fact I have a function of (at least) 4 variables and I want to compute higher order derivatives. Of course I can subs or alias all necessary derivatives: D[1], D[2], ... , D[1,1], D[1,2], ... , D[1,1,1], D[1,1,2], ... , but with (for example) 4 variables and derivatives up the order four that would be a bit complicated. Does anybody know a different solution? Thanks for your help Martin -- Martin Reinders (reinders@math2.rwth-aachen.de) Lehrstuhl II fuer Mathematik, RWTH Aachen From maple_gr@daisy.uwaterloo.ca Thu Jan 18 12:41:52 1996 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA05459; Thu, 18 Jan 96 12:41:52 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id JAA14562 for maple-list-outgoing; Thu, 18 Jan 1996 09:09:59 -0500 Message-Id: <199601181409.JAA14562@daisy.uwaterloo.ca> From: Mark Fitch Subject: [MUG] Plotting 3D Function To: maple-list@daisy.uwaterloo.ca Date: Fri, 12 Jan 1996 07:50:25 -0500 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Mark Fitch A trick I used to enhance the plot of Cantor functions on 3D Cantor sets (a 4D graph), was to encode f(x,y,z) using color gradients as follows pointplot([x,y,z],color=COLOUR(RGB,(f(x,y,z)-fmin)/(fmax-fmin),0,0)); This will plot the minimum value of f(x,y,z) as black and the maximum value as red with intermediate values between. This does not address the issue of graphing all the necessary points (not necessary for my Cantor function approximations). Mark Fitch mfitch@clemson.edu http://www.math.clemson.edu/~mfitch/ From maple_gr@daisy.uwaterloo.ca Thu Jan 18 12:49:49 1996 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA05949; Thu, 18 Jan 96 12:49:49 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id JAA14547 for maple-list-outgoing; Thu, 18 Jan 1996 09:09:42 -0500 Message-Id: <199601181409.JAA14547@daisy.uwaterloo.ca> From: raczy@lifl.fr (Come Raczy) Subject: [MUG] Re: Plotting 3D Function To: maple-list@daisy.uwaterloo.ca Date: Fri, 12 Jan 1996 10:43:04 +0100 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: raczy@lifl.fr (Come Raczy) Donald M. Frederick writes: > >> From: "Donald M. Frederick" > > Dear MUG Subscribers: > > I have two related problems in plotting that I am trying to solve in Maple V > Rel 3 (soon to be Rel 4 when it is available). > > I would like to plot f(x,y,z), the solution of a PDE (solution derived by > either analytic or numerical means) with the color of the (x,y,z) point > mapped to indicate the actual value of f(x,y,z), in some fashion. > > Your help with this is greatly appreciated. I think that you must design your plot by hand. The first step is to define a function fCol to define a color for each value of f. This function may return a single value in [0,1] (for HUE format) or a triple of values in [0,1] (for RGB format). Then, put all your points in a list. For each point [x,y,z], you will plot the following element : POINTS([x,y,z], COLOUR(HUE, fCol(f(x,y,z))) Here is an example : # =============== BEGIN Maple ================ with(plots): myPoints := [seq([0.1*i, 0.1*i, 0.1*i^2], i=1..100)]: f := (x,y,z) -> sqrt(0.02 + 2*x^2): fMin := f(op(myPoints[1])) : # minimum value for f(x,y,z) on the domain fMax := f(op(myPoints[nops(myPoints)])): # maximum value for f(x,y,z) fHUE := v -> (v-fMin)/(fMax-fMin): # for HUE format fRGB := v -> op([0.5, (v-fMin)/(fMax-fMin)/2+0.5,0.5]): PLOT3D(op(map(pp->POINTS(pp, COLOUR(HUE, (fHUE@f)(op(pp)))), myPoints)), SYMBOL(POINT)); PLOT3D(op(map(pp->POINTS(pp, COLOUR(RGB, (fRGB@f)(op(pp)))), myPoints)), SYMBOL(POINT)); # =============== END Maple ================ If your points are ordered, you can do something like that : PLOT3D(seq( CURVES([myPoints[i], myPoints[i+1]], COLOUR(RGB, (fRGB@f)(op(myPoints[i])))), i=1..99)); Or use the MESH item in place of POINTS and CURVES, if you points are in a 2D space. Hope this helps Best regards ----- Come Raczy : raczy@lifl.fr From stockie@cs.ubc.ca Wed Jan 24 11:09:21 1996 Received: from grolsch.cs.ubc.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA11620; Wed, 24 Jan 96 11:09:21 -0800 Received: from athena.cs.ubc.ca (stockie@athena.cs.ubc.ca [142.103.19.17]) by grolsch.cs.ubc.ca (8.6.12/8.6.9) with ESMTP id LAA05513 for ; Wed, 24 Jan 1996 11:09:20 -0800 Message-Id: <199601241909.LAA05513@grolsch.cs.ubc.ca> Received: by athena.cs.ubc.ca (1.37.109.10G/16.2) id AA083620559; Wed, 24 Jan 1996 11:09:19 -0800 Date: Wed, 24 Jan 1996 11:09:19 -0800 From: John Stockie To: israel@math.ubc.ca Subject: Maple question Status: RO Dear Dr. Israel, I have a question regarding a Maple error I have been encountering. I thought I would ask you first, (before posting this to the entire MUG mailing list) since you seem to be answering many of the questions that appear on the list. I have an 8x8 matrix, whose entries are very *large* expressions. When I try to compute the determinant, Maple works for a minute or two and then stops with the following error message: Error, (in expand/bigprod) object too large I have attempted to reduce the size of the matrix in every way I can think of, without success. I have also tried the same problem on other machines with more memory, and Maple seems to die at about the same point. Without details of what the experessions look like, is there anything you know of that I might be able to do to reduce the size of the problem to one that Maple can deal with? Since an increase in memory size does not seem to affect the ability of Maple to handle larger expressions, I wondered whether you know if there is a hard limit on the size of an object (set in some kind of Maple configuration file) that can be set at installation time? I would consider attempting to re-install Maple on my machine in order to get around this problem, if you think it's possible. I'd really appreciate any suggestions you might have. This is a problem integral to my thesis research, and I really cannot go on without resolving it. If I haven't provided enough details on the problem for you to answer my questions, I would be happy to meet with you to talk about it. Thanks, John Stockie. -- ------------------------------------------------------------ John Stockie Department of Mathematics Tel: (604) 822-5008 University of British Columbia or (604) 822-5800 Vancouver, B.C., Canada http://www.math.ubc.ca/~stockie/ ------------------------------------------------------------ From israel@math.ubc.ca Wed Jan 24 11:51:39 1996 Received: from galois.math.ubc.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA13250; Wed, 24 Jan 96 11:51:39 -0800 Date: Wed, 24 Jan 96 11:51:39 -0800 From: Robert Israel Received: by galois.math.ubc.ca id LAA04445; Wed, 24 Jan 1996 11:53:17 -0800 Message-Id: <199601241953.LAA04445@galois.math.ubc.ca> To: stockie@cs.ubc.ca Subject: Re: Maple question In-Reply-To: Mail from 'John Stockie ' dated: Wed, 24 Jan 1996 11:09:19 -0800 Cc: israel Status: RO Dear John, I think that what you have may be a fundamental matter of combinatorial blowup of expressions, rather than a hardware problem. With an 8 by 8 symbolic matrix, the determinant is a sum of 8! = 40320 terms. Unless there is some cancellation, you're stuck with that. And if each matrix entry is "large", the result is going to be even worse. Even if each entry in the matrix is a sum of only two terms, unless there is cancellation there will be 8!* 2^8 = 10321920 terms in the determinant. The first question to ask may be, do you really need to calculate the determinant? What do you want to use it for? How would a sum of 10 million terms be useful to you, even if Maple could handle it? If you are going to evaluate this numerically at certain values of the variables, the thing to do is to substitute the numerical values before taking the determinant. If you want to check whether the matrix is nonsingular, or calculate eigenvalues, there may be better ways than using the determinant. If you really do need the determinant, perhaps it would be better to use an unexpanded form of it. Maple's "det" expands everything out, so that det(matrix([[a+b, c+d],[e+f, g+h]])) is returned as a*g+a*h+b*g+b*h-c*e-c*f-d*e-d*f. It shouldn't be too hard to write an expansion-by-minors version of the determinant that would return this as (a+b)*(g+h) - (c+d)*(e+f), which could alleviate the "combinatorial explosion". Hope this helps. Robert From maple_gr@daisy.uwaterloo.ca Wed Jan 24 14:07:40 1996 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA18347; Wed, 24 Jan 96 14:07:40 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id IAA00883 for maple-list-outgoing; Wed, 24 Jan 1996 08:54:41 -0500 Message-Id: <199601241354.IAA00883@daisy.uwaterloo.ca> From: Maple Group Subject: [MUG] Re: Variable names in output of D operator To: maple-list@daisy.uwaterloo.ca Date: Wed, 24 Jan 1996 08:48:45 -0500 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Maple Group -=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=- Date: Thu, 18 Jan 96 14:41:09 -0800 From: Robert Israel To: maple-list@daisy.uwaterloo.ca Subject: Variable names in output of D operator reinders@math2.rwth-aachen.de (Priv. Doz. Dr. M. Reinders) wrote: |> Thanks to all who replied to my question. The suggestion was to use |> > subs(D[1]=D[x], D[2]=D[y], D(f)); |> or |> > alias( D[x](F)=D[1](F), D[y](F)=D[2](F) ); |> The problem is that the function F above was only an example |> In fact I have a function of (at least) 4 variables and I want to compute |> higher order derivatives. Of course I can subs or alias all necessary |> derivatives: |> D[1], D[2], ... , |> D[1,1], D[1,2], ... , |> D[1,1,1], D[1,1,2], ... , |> but with (for example) 4 variables and derivatives up the order four |> that would be a bit complicated. Well, you can use the following procedure. expr is any expression or procedure F is the function whose partial derivatives you want to rename vars is a list of variables The result will have substitutions made in any D[...](F) occurring in expr, so that 1 becomes vars[1], 2 becomes vars[2], etc. > reinders := proc(expr,F,vars) local v, i; if has(expr,D) then if type(expr,function) then if type(expr,function(identical(F))) then subs( seq(i=vars[i], i=1..nops(vars)), op(0,expr))(F) elif op(0,expr) = D then expr else reinders(op(0,expr),F,vars)(op(expr)) fi elif type(expr,procedure) then v := op(1,expr); unapply(reinders(expr(v),F,vars),v) else map(reinders,expr,F,vars) fi else expr fi end; > f:= t -> F(x(t), y(t), z(t)): > reinders(D(f), F, [x, y, z]); t -> D[x](F)(x(t), y(t)) D(x)(t) + D[y](F)(x(t), y(t)) D(y)(t) By the way, Maple (at least in Release 3, I haven't checked R4 yet) won't do (D@@2)(f) for some reason. For the second and higher derivatives you're forced into circumlocutions. > (D@@2)(f); Error, (in D/procedure) univariate operand > unapply(convert(diff(f(t), t$2), D), t); t -> (D[1, 1](F)(x(t), y(t)) D(x)(t) + D[1, 2](F)(x(t), y(t)) D(y)(t)) (2) D(x)(t) + D[1](F)(x(t), y(t)) D (x)(t) + (D[1, 2](F)(x(t), y(t)) D(x)(t) + D[2, 2](F)(x(t), y(t)) D(y)(t)) (2) D(y)(t) + D[2](F)(x(t), y(t)) D (y)(t) > reinders(", F, [x,y,z]); t -> (D[x, x](F)(x(t), y(t)) D(x)(t) + D[x, y](F)(x(t), y(t)) D(y)(t)) (2) D(x)(t) + D[x](F)(x(t), y(t)) D (x)(t) + (D[x, y](F)(x(t), y(t)) D(x)(t) + D[y, y](F)(x(t), y(t)) D(y)(t)) (2) D(y)(t) + D[y](F)(x(t), y(t)) D (y)(t) Robert Israel israel@math.ubc.ca Department of Mathematics (604) 822-3629 University of British Columbia fax 822-6074 Vancouver, BC, Canada V6T 1Y4 -=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=- From: Joe Riel Subject: Variable names in output of D operator To: maple-list@daisy.uwaterloo.ca Date: Thu, 18 Jan 1996 19:00:33 -0800 (PST) You can always write a Maple procedure which sets up the aliases for you. Here is a crude example which works but probably isn't the best, aliasdiff := proc(f:name,v:list,n:posint) local i,j,nv,s,S; nv := nops(v); S := [op(subs(0=NULL,{op(combinat[permute]([seq(j$n,j=0..nv)],n))}))]; zip(<(a=b)|a,b>,subs(seq(i=v[i],i=1..nv),S),S); seq(D[op(lhs(s))](f)=D[op(rhs(s))](f),s="); alias(") end: aliasdiff(f,[x,y],3); I, D[x, x, x](f), D[x, x, y](f), D[x, y, y](f), D[y, y, y](f), D[x](f), D[y](f), D[x, x](f), D[x, y](f), D[y, y](f) now all derivatives of x and y of f up to third order are aliased, D[1,2,1](f); D[x,x,y](f) Note that Maple does not pay attention to the order of the derivatives. You might consider modifying this so that it doesn't use the f argument, then all derivatives of the form D[1,2] would be aliased to D[x,y], you wouldn't have to call aliasdiff for all the functions you are using. Joe Riel From maple_gr@daisy.uwaterloo.ca Thu Jan 25 16:06:03 1996 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA12672; Thu, 25 Jan 96 16:06:03 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id PAA22109 for maple-list-outgoing; Thu, 25 Jan 1996 15:49:50 -0500 Message-Id: <199601252049.PAA22109@daisy.uwaterloo.ca> From: "Preben Alsholm" Subject: [MUG] RE: integration of num. solutions of DEs To: maple-list@daisy.uwaterloo.ca, justiz@zedat.fu-berlin.de Date: Thu, 25 Jan 1996 10:05:07 +0100 (CET) Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: "Preben Alsholm" Joern Justiz wants to integrate the numerical solution to a differential equation and runs into problems: eq:=4*sin(a(t))+diff(a(t),t$2)=0: dsolve({eq,a(0)=2,D(a)(0)=0},a(t),type=numeric,output=listprocedure): aa:=subs(",a(t)); Now he tries to integrate aa multiplied by sin (t/10): >evalf(int(aa(t)*sin(t/10),t=2..3)); >evalf(int('aa(t)'*sin(t/10),t=2..3)); >evalf(Int('aa(t)*sin(t/10)',t=2..3)); >evalf(Int('aa(t)'*sin(t/10),t=2..3)); None of these work, but the following approach does: aasin:= t -> aa(t)*sin(t/10): evalf( Int( aasin, weird=2..3) ); -.3641068228 My preferred syntax would have been evalf( Int( aasin, 2..3) ); but that doesn't work (in Release 3). Preben Alsholm IFAK, Technical University of Denmark DK 2800 Lyngby, Denmark Article: 18911 of sci.math.symbolic Path: unixg.ubc.ca!van-bc!news.cyberstore.ca!math.ohio-state.edu!uwm.edu!vixen.cso.uiuc.edu!howland.reston.ans.net!blackbush.xlink.net!sol.ctr.columbia.edu!news.kei.com!news.mathworks.com!fu-berlin.de!zib-berlin.de!irz401!news.tu-chemnitz.de!easy.in-chemnitz.de!glare!hf Newsgroups: sci.math.symbolic Message-ID: <1258@glare.in-chemnitz.de> Reply-To: hf@glare.in-chemnitz.de (Holger Friedrich) From: hf@glare.in-chemnitz.de (Holger Friedrich) Date: Mon, 01 Jan 1996 23:19:58 GMT Subject: [Maple] eval(something, 1), eval(something, 2), ... Lines: 18 Didn't someone recently ask why eval(..., 2000) did not appear to do anything else than eval(..., 1) does? I can't seem to find that post, though (but it should still be on my machine if it had appeared in MUG rather than here). Here is what it _does_ differently: > restart; > a := b: b := c: c := d: d := e: > eval(a, 1), eval(a, 2), eval(a, 3), eval(a, 4); b, c, d, e However, it does not seem to look inside procedure calls -- apparently that's what irritated the original poster: > eval(a * sin(a), 4); e sin(a) -- Holger Friedrich Chemnitz, Germany E-Mail: hf@glare.in-chemnitz.de Second chance: easy!glare!hf@thunder.hrz.tu-chemnitz.de Article: 19386 of sci.math.symbolic Path: unixg.ubc.ca!math.ubc.ca!israel From: israel@math.ubc.ca (Robert Israel) Newsgroups: sci.math.symbolic Subject: Re: A simple Maple question : simplification within sum Date: 31 Jan 1996 21:05:54 GMT Organization: University of British Columbia, Vancouver, B.C., Canada Lines: 121 Distribution: world Message-ID: <4eolji$fus@nntp.ucs.ubc.ca> References: <310F5070.48FB@crmc2.univ-mrs.fr> <4enogi$lra@netnews.upenn.edu> NNTP-Posting-Host: galois.math.ubc.ca In article <4enogi$lra@netnews.upenn.edu>, Laura Kornstein writes: |> After typing in the un-simplified input (you can finish with |> either a colon or semicolon and start the next comand either |> adjacent to the function or at the next prompt), try typing: |> |> > evalf("); |> |> That tells it to evaluate the value of the previous expresson. I don't like to flame, but may I suggest trying out your ideas before posting, to see if they work? This one doesn't. "evalf" evaluates an expression to floating-point numbers. Since M is a symbolic variable, there's nothing for "evalf" to do here. |> Andres Saul wrote: |> >Hi, |> > How can I do to tell Maple to simplify this sum to |> >f(0)-f(M+1). |> >Maple does not simplify even if it knows the function. |> >> sum(f(n)-f(n+1),n=0..M); |> > |> > M |> > ----- |> > \ |> > ) (f(n) - f(n + 1)) |> > / |> > ----- |> > p n = 0 |> > |> >> sum(erf(n)-erf(n+1),n=0..M); |> > |> > M |> > ----- |> > \ |> > ) (erf(n) - erf(n + 1)) |> > / |> > ----- |> > n = 0 Maple's abilities to manipulate sums are rather limited, and I don't know of any reasonable way to make this work. If you load the "student" package and change "sum" to "Sum", "expand" will separate out the two terms. > with(student): > assume(M>=1); > J:= expand(Sum(f(n)-f(n+1), n=0 .. M)); / M \ / M \ |----- | |----- | | \ | | \ | J := | ) f(n)| - | ) f(n + 1)| | / | | / | |----- | |----- | \n = 0 / \n = 0 / You can then work on the two parts separately, using "changevar" to change the index variable for the second. > J1:= op(1,J): J2:= op(2,J): > changevar(n=m-1,J2, m); # it doesn't work if you try n=n-1, you need a new name /M + 1 \ |----- | | \ | - | ) f(m)| | / | |----- | \m = 1 / Now change back to using n. This time you can use "subs". > J2:= subs(m=n, "); /M + 1 \ |----- | | \ | J2 := - | ) f(n)| | / | |----- | \n = 1 / Now we need to split off the n=0 term from J1 and the n=M+1 term from J2 in order to be able to combine them. I don't know of any way to do this, other than by defining a new procedure to do this. "splitsum" splits a sum (or Sum) from b to c into a sum from b to a-1 and a sum from a to c, if b <= a <= c. It must be able to decide these inequalities (which is why I included the "assume" above). > splitsum:= proc(f, a) local lims, lims1, lims2, b, c; if type(f, function) and (op(0,f) = `sum` or op(0,f) = `Sum`) then lims:= op(2,f); b:= op(1,op(2,lims)); c:= op(2,op(2,lims)); if is(b < a) and is(a <= c) then lims1:= op(1,lims) = b .. a-1; lims2:= op(1,lims) = a .. c; subsop(2=lims1, f) + subsop(2=lims2, f) else f fi elif type(f, {`+`,`*`, `^`, function}) then map(split,f,a) else f fi end; > splitsum(J1, 1) + splitsum(J2, M+1); / 0 \ / M~ + 1 \ |----- | | ----- | | \ | | \ | | ) f(n)| - | ) f(n)| | / | | / | |----- | | ----- | \n = 0 / \n = M~ + 1 / > value("); f(0) - f(M~ + 1) -- Robert Israel israel@math.ubc.ca Department of Mathematics (604) 822-3629 University of British Columbia fax 822-6074 Vancouver, BC, Canada V6T 1Y4 From maple_gr@daisy.uwaterloo.ca Mon Dec 18 15:18:52 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA10279; Mon, 18 Dec 95 15:18:52 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id NAA03224 for maple-list-outgoing; Mon, 18 Dec 1995 13:13:47 -0500 Message-Id: <199512181813.NAA03224@daisy.uwaterloo.ca> From: hf@glare.in-chemnitz.de (Holger Friedrich) Subject: [MUG] Re: local variables in local procedures To: maple-list@daisy.uwaterloo.ca Date: Tue, 12 Dec 1995 17:53:58 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Content-Length: 4322 X-Lines: 105 Status: RO >> From: hf@glare.in-chemnitz.de (Holger Friedrich) >From: Robert Israel >Yes, but the _values_ of local variables can always be exported in this >way. Even if the variable's value is its own name. There is nothing >special about procedures here. > >> foo:= proc() local bar; bar end; >> foo(); > bar Let's do comparisons for the case when a (local or global) variable equals something else. I think that might be a fairer comparison to do, as I am not aware of a way to declare a _procedure_body_ to be local. As for simple names, there is a difference depending whether or not the name assigned to the variable is declared local: > restart; f := proc() local x, bar; x := bar; x end: > f(); is(f() = bar); bar FAIL > restart; f := proc() local x; x := bar; x end: > f(); is(f() = bar); bar true In the above examples, it does not make a difference whether or not x is declared local. What matters is the local or global status of bar. With a procedure body instead of a name, I can only reproduce the second case. Sure, there is nothing special about procedures; they behave just like any other _global_ variable or name. > restart; f := proc() local x; x := foo -> bar; x end: > f(), eval(f()); is(eval(f()) = (foo -> bar)); x, foo -> bar true Even outside the "wrapper" procedure, Maple recognizes that the procedure body foo -> bar is equal to itself, just as it does with the _global_ variable name bar in the _second_ example above. This is quite understandable, considering that we _first_ defined the procedure body and _then_ assigned it to a local variable. I.e. the above is equivalent to the following: > restart; f := proc() local x; foo -> bar; x := "; x end: > f(), eval(f()); is(eval(f()) = (foo -> bar)); x, foo -> bar true I do not see how Maple could have guessed that we were going to assign the procedure body to a _local_ variable at the time we defined the procedure body foo -> bar. I am not aware of a way to tell Maple that a _procedure_body_ is intended to be local (or am I just missing it)? As I understand it, _defining_ another procedure inside a procedure body in Maple is something completely different from a _local_ procedure in a standard programming language such as Pascal. This possibility to have a procedure define other procedures can be quite useful, and I am not suggesting that it should be _replaced_ with truly local procedures in the sense of standard computer programming. (E.g. if you want to define a bunch of procedures in an interactive Maple session, you can simply run a single procedure previously stored that defines all those procedures for you. All of these functions are still defined and accessible when that single procedure completes its job and exits. This kind of thing is completely out of question in a compiled language, as you will never get to define a sunroutine when the program is already running!) Perhaps it would not be bad if Maple acquired local procedures in the future (in addition to the ability of defining global procedures inside another procedure, not instead of it). In the meantime, it should be straightforward to do everything you want without them _if_ you just understand exactly what Maple is doing in the first place. Perhaps the documentation could point this out a little more visibly. The rules for using local/global variables in different procedures _are_ mentioned in the online help, but so briefly (and without giving a reason that would explain why things are done that way) that one won't pay much attention to it until one has a head-on collision with this problem. Perhaps the documentation should point out more prominently (with a big red exclamation mark, if possible) that defining procedures inside other Maple procedures is something completely different from local procedures in computer programming. -- Holger Friedrich Chemnitz, Germany E-Mail: hf@glare.in-chemnitz.de Second chance: easy!glare!hf@thunder.hrz.tu-chemnitz.de From maple_gr@daisy.uwaterloo.ca Thu Dec 21 16:10:21 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA29229; Thu, 21 Dec 95 16:10:21 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id PAA26374 for maple-list-outgoing; Thu, 21 Dec 1995 15:15:53 -0500 Message-Id: <199512212015.PAA26374@daisy.uwaterloo.ca> From: Brian Sanderson Subject: [MUG] plotting flows To: maple-list@daisy.uwaterloo.ca Date: Tue, 19 Dec 1995 12:08:43 GMT Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Content-Length: 525 X-Lines: 13 Status: RO >> From: Brian Sanderson I have a 3 dimensional vector field and maple can display it for me, but it is very hard to visualise how the corresponding flow works. I would like to see what happens to a line as it flows. Animation? Display of the corresponding surface? Can anyone help? -- Brian J Sanderson * B.Sanderson@warwick.ac.uk Mathematics Institute * Tel: +44-1203-523738 FAX: +44-1203-524182 University of Warwick, Coventry CV4 7AL, UK http://www.maths.warwick.ac.uk/~bjs/ From Stuart.Doole@Bristol.ac.uk Fri Nov 3 02:20:40 1995 Received: from dira.bris.ac.uk by raven.math.ubc.ca (911016.SGI/1.14) id AA18178; Fri, 3 Nov 95 02:20:40 -0800 Received: from zeus.bris.ac.uk by dira.bris.ac.uk with SMTP (PP); Fri, 3 Nov 1995 10:19:17 +0000 Received: by zeus.bris.ac.uk (950215.SGI.8.6.10/940406.SGI) for israel@math.ubc.ca id KAA24176; Fri, 3 Nov 1995 10:19:05 GMT From: Stuart.Doole@bristol.ac.uk (SH. Doole) Message-Id: <199511031019.KAA24176@zeus.bris.ac.uk> Subject: Conformal in maple To: israel@math.ubc.ca Date: Fri, 3 Nov 1995 10:19:04 +0000 (GMT) X-Mailer: ELM [version 2.4 PL21] Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 1247 Status: RO Dear Robert, Thanks for your helpful posting on sci.math.symbolic about the maple command conformal. I was interested in your comments: > In some cases I've found it better (though more trouble) to plot sets of > curves parametrically. And if you're doing Schwarz-Christoffel > transformations where the integral can't be done in closed form, you may > be better off plotting the curves as solutions of differential equations. In the parametric approach, do you mean a parametric definition of the conformal map F to which you still apply the Maple function conformal? Or a more basic approach where you work out all the images yourself like if you were writing it in fortran, say. The map I really want to plot is a S-C map but I was just trying to reproduce some textbook examples first Yours Stuart Doole ================================================================ Dr Stuart Doole Applied Nonlinear Mathematics Group Dept of Engineering Maths phone: (+44) 0117 928 7754 University of Bristol fax: (+44) 0117 925 1154 Bristol BS8 1TR UK email: stuart.doole@bristol.ac.uk http://www.fen.bris.ac.uk/engmaths/nonlinear/staff/shd.html ================================================================ From maple_gr@daisy.uwaterloo.ca Mon Oct 30 16:30:15 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA08548; Mon, 30 Oct 95 16:30:15 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id OAA03482 for maple-list-outgoing; Mon, 30 Oct 1995 14:53:02 -0500 Message-Id: <199510301953.OAA03482@daisy.uwaterloo.ca> From: "Klaus Geers Univ. Karlsruhe" Subject: [MUG] Bug in integrator To: maple_group@DAISY.WATERLOO.EDU Date: Wed, 25 Oct 95 11:08 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: "Klaus Geers Univ. Karlsruhe" Hallo, we found the following bug in maple function int. The result of integrating a real function results in a complex value. The result produced by evalf(Int ...) seems to be correct. But we are interested in a symblic expression which we can be used in subsequent calculations. Who has any ideas how to solve this problem? > restart;interface(patchlevel); 3 > f:= (x,a) -> (sin(x)/x)^2/(Pi^2-x^2)^2/(a^2+x^2); 2 sin(x) f := (x,a) -> ------------------------ 2 2 2 2 2 2 x (Pi - x ) (a + x ) > assume(a>0); assume(x,real); about(a,x); Originally a, renamed a~: is assumed to be: RealRange(Open(0),infinity) Originally x, renamed x~: is assumed to be: real # -------------------------------------------------------------------------------- > F:= evalf(int(f(x,1),x=0..infinity)); F := .03669763619 - .02444086039 I -------------------------------------------------------------------------------- > F2 := evalf(Int(f(x,1),x=0..infinity)); F2 := .01111963741 Best regards Klaus Geers University of Karlsruhe Computing Centre Postfach 6980 D-76128 Karlsruhe Fed. Rep. of Germany Tel.: +49 721 608 3755 Fax : +49 721 32550 e-mail: geers@rz.uni-karlsruhe.de From maple_gr@daisy.uwaterloo.ca Wed Sep 20 19:33:51 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA22384; Wed, 20 Sep 95 19:33:51 -0700 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id QAA07769 for maple-list-outgoing; Wed, 20 Sep 1995 16:12:53 -0400 Message-Id: <199509202012.QAA07769@daisy.uwaterloo.ca> From: Robert Israel Subject: [MUG] Re: Non linear recurrence eq. To: maple-list@daisy.uwaterloo.ca Date: Wed, 13 Sep 95 10:18:32 -0700 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Robert Israel Harald Pleym (haraldp@tmih.no) wrote: | 1) Is it possible to use a command in Maple (like "roslve" to solve a non-linear | recurrence equations. | I have not been able to find one. In general these equations have no "closed-form" solutions. "rsolve" will do some rather special cases of nonlinear equations. | 2)Is it possible to use Maple to find the excact limit value A=sqrt(2) in the | problem below, by using for example continued fraction expansion in some way? s The usual way to find limits is to look for fixed points of the transformation, as you do. You can then discuss stability. | The "problem" is: | > req:=a(n+1)=1+1/(a(n)+1); Actually, this one should be doable, because it's a fractional linear transformation. a(n+1) = (a(n)+2)/(a(n)+1) If you write a(n) = p(n)/q(n) with p(0)=a(0), q(0)=1, then a(n+1) = (p(n)+2 q(n))/(p(n)+q(n)) So the coefficients p(n) and q(n) transform linearly, and "rsolve" can solve this recurrence: > rsolve({p(n+1)=p(n)+2*q(n), q(n+1)=p(n)+q(n), p(0)=a(0), q(0)=1},{p,q}); { 1/2 / 1 \n / 1 \n 1/2 q(n) = - 1/4 2 (- |----------| a(0) - |----------| 2 | 1/2| | 1/2| \- 1 + 2 / \- 1 + 2 / / 1 \n / 1 \n 1/2 / 1/2 1/2 + |- --------| a(0) - |- --------| 2 ) / ((- 1 + 2 ) (1 + 2 )), | 1/2| | 1/2| / \ 1 + 2 / \ 1 + 2 / 1/2 / 1 \n 1/2 / 1 \n p(n) = 1/4 2 (|----------| 2 a(0) + 2 |----------| | 1/2| | 1/2| \- 1 + 2 / \- 1 + 2 / / 1 \n 1/2 / 1 \n / 1/2 1/2 + |- --------| 2 a(0) - 2 |- --------| ) / ((- 1 + 2 ) (1 + 2 )) | 1/2| | 1/2| / \ 1 + 2 / \ 1 + 2 / } > simplify(subs(", a(n)=p(n)/q(n))); a(n) = 1/2 n 1/2 1/2 n 1/2 1/2 n 1/2 n (1 + 2 ) 2 a(0) + 2 (1 + 2 ) + 2 a(0) (1 - 2 ) - 2 (1 - 2 ) ----------------------------------------------------------------------------- 1/2 n 1/2 1/2 n 1/2 n 1/2 1/2 n a(0) (1 + 2 ) + 2 (1 + 2 ) - a(0) (1 - 2 ) + 2 (1 - 2 ) > limit(rhs("), n=infinity); Unfortunately, Maple won't do this limit. Does the symbolic calculator not know that |1 + sqrt(2)| > |1 - sqrt(2)|? The answer is of course sqrt(2) unless a(0) = - sqrt(2). Robert Israel israel@math.ubc.ca Department of Mathematics (604) 822-3629 University of British Columbia fax 822-6074 Vancouver, BC, Canada V6T 1Y4 From israel@math.ubc.ca Thu Sep 21 09:28:08 1995 Received: from galois.math.ubc.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA17799; Thu, 21 Sep 95 09:28:08 -0700 Date: Thu, 21 Sep 95 09:28:08 -0700 From: Robert Israel Received: by galois.math.ubc.ca id AA16060; Thu, 21 Sep 95 09:28:08 PDT Message-Id: <9509211628.AA16060@galois.math.ubc.ca> To: maple-list@daisy.uwaterloo.ca Subject: Functional differentiation Cc: israel Status: RO jrc@umr.edu (James Friend) writes: |> Is there a quicker way to do these differentiations? To ensure that the nesting |> of the functions in Maple works correctly, an almost unending list of "subs" |> commands are necessary. This, seems to me, to be due to my complete lack of |> understanding of Maple's scoping rules. But since the scoping rules aren't |> really written down in any of Maple's many manuals and references that I've |> managed to find so far, I thought I'd ask you. Basically, the rule is quite simple: a formal parameter or local variable in a procedure or function definition can't be accessed outside of that definition (or even in another function defined within that definition). e.g.: > A:= x; > F:= x -> A + x; > F(y); x + y The "x" in the value of A is the global "x", even when A is evaluated within F, so it is not replaced by the actual parameter y. Another point to watch for is that the body of a function definition using -> or < | > is not evaluated when the function is defined, but only when it is called. So in the example above, > A:= z; > F(w); z + w When F was defined, A had the value x, but that didn't affect the definition of F. After A's value is changed to "z", the new value is used when F(w) is evaluated. If you want to define a function using the current values of variables, you can use "unapply" which makes an (evaluated) expression into a function. > G:= unapply(A + x, x); > G(w); w + z > A:= v; > G(w); w + v |> # Radial and tangential plate solution (from biharmonic equation): |> R:= nxx,rxx,A1,A2,A3,A4>: I don't know what you are trying to accomplish with this use of "subs". You could use > R:= (nx,rx,A1,A2,A3,A4) -> A1*BJ(nx,rx)+A2*BI(nx,rx)+A3*BK(nx,rx)+A4*BY(nx,rx); I suspect you don't really need a function with all these formal parameters. It would probably be simpler to use expressions with nx, rx, etc. as global symbolic variables. Make sure they are symbolic (i.e. haven't been assigned values): if necessary you can "unassign" them with > nx:= 'nx'; etc. When you do get something that you really want to be a function (because you want to evaluate it at different values of these variables), use "unapply". I hope this helps. Robert Israel israel@math.ubc.ca Department of Mathematics (604) 822-3629 University of British Columbia fax 822-6074 Vancouver, BC, Canada V6T 1Y4 From israel@math.ubc.ca Thu Sep 21 12:33:33 1995 Received: from galois.math.ubc.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA24964; Thu, 21 Sep 95 12:33:33 -0700 Date: Thu, 21 Sep 95 12:33:33 -0700 From: Robert Israel Received: by galois.math.ubc.ca id AA17887; Thu, 21 Sep 95 12:33:33 PDT Message-Id: <9509211933.AA17887@galois.math.ubc.ca> To: maple-list@daisy.uwaterloo.ca Subject: Re: [MUG] Determination of whether an expression must be non-negative In-Reply-To: Mail from 'MURPHY@a.cfr.cmu.edu' dated: Fri, 8 Sep 1995 12:30:16 -0400 (EDT) Cc: israel Status: RO MURPHY@a.cfr.cmu.edu (Bob Murphy) asked: |> Are there any maple procedures that will determine whether an expression |> must be non-negative (i.e., x**2 for real x)? Any help appreciated! There is the "is" command, but it is not very powerful. > assume(x, real); > is(x^2 >= 0); true > is(x^2 - 1 >= 0); false > is(x^2 - 2*x + 1 >= 0); FAIL In general, there can be no algorithm to determine whether or not an expression in x is nonnegative for all real x. For polynomials with numeric coefficients, however, you can use "sturm". The function "nrealzeros" defined below should return the number of real zeros of p in the variable x. If this is 0 or 1, and p has even degree and positive leading coefficient, then p is nonnegative. > readlib(sturm); > nrealzeros:= (p,x) -> sturm(sturmseq(p,x), x, -infinity, infinity); > p1:= x^6 + x^3 - 2*x + 1; > p2:= x^6 + x^3 - 3*x + 1; > nrealzeros(p1,x); 0 > nrealzeros(p2,x); 2 Robert Israel israel@math.ubc.ca Department of Mathematics (604) 822-3629 University of British Columbia fax 822-6074 Vancouver, BC, Canada V6T 1Y4 From monagan@inf.ethz.ch Sat Sep 16 12:29:41 1995 Received: from hub.ubc.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA08200; Sat, 16 Sep 95 12:29:41 -0700 Received: from inf.ethz.ch (root@neptune.ethz.ch [129.132.101.33]) by hub.ubc.ca (8.6.12/1.14) with ESMTP id MAA14113 for ; Sat, 16 Sep 1995 12:29:32 -0700 Received: from mendel.inf.ethz.ch (monagan@mendel.inf.ethz.ch [129.132.12.20]) by inf.ethz.ch (8.6.10/8.6.10) with ESMTP id VAA05780; Sat, 16 Sep 1995 21:27:54 +0200 From: Michael Monagan Received: (monagan@localhost) by mendel.inf.ethz.ch (8.6.10/8.6.10) id VAA29080; Sat, 16 Sep 1995 21:27:54 +0200 Date: Sat, 16 Sep 1995 21:27:54 +0200 Message-Id: <199509161927.VAA29080@mendel.inf.ethz.ch> To: denk@obelix.cica.es, israel@math.ubc.ca Subject: Maple simplifications Status: RO These are ``relatively'' easy to do as follows. First, note, the Mathematica code is not quite what you wrote obj[A_*B_,C_]=A*obj[B,C] since you only want to apply the product rule for constants A? In Maple obj := proc(x,y) local u,v; if type(x,`+`) then u := op(1,x); v := x-u; RETURN(obj(u)+obj(v)) fi; if type(x,`*`) then u := select(type,x,constant); if u<>1 then RETURN(u*obj(x/u,y)) fi; fi; 'obj'(x,y) # no rules apply end: Mike From rajamani@mines.utah.edu Thu Aug 10 12:34:47 1995 Received: from bingham.mines.utah.edu by raven.math.ubc.ca (911016.SGI/1.14) id AA14436; Thu, 10 Aug 95 12:34:47 -0700 Received: from [128.110.128.169] (mammoth.mines.utah.edu [128.110.128.169]) by bingham.mines.utah.edu (8.6.10/8.6.5.Beta9) with SMTP id NAA20126 for ; Thu, 10 Aug 1995 13:36:47 -0600 Date: Thu, 10 Aug 1995 13:36:47 -0600 Message-Id: <199508101936.NAA20126@bingham.mines.utah.edu> X-Sender: rajamani@bingham.mines.utah.edu Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: israel@math.ubc.ca From: rajamani@bingham.mines.utah.edu (Raj K. Rajamani) Subject: object too large error in MAPLE Status: RO Dear Dr. Robert Israel: I take the liberty of asking you directly after seeing your expert advice to many inquiries over Maple User Group. Please spare a few minutes. I use similarity transformation of matrices to solve a system of diffl eqns. Say 7 of them. The diffl eqn is dm(t)/dt= A m(t) where A is a constant matrix made up of algebraic expressions . The solution is m(t)= T J T_inverse m(0) where T is the matrix of eigen vectors of A , J is the exponential of the diagonal matrix of the eigen values of A. In Maple I compose the eigen values and vectors and then construct the three matrices. But when the matrices are multiplied to get the components of the vector m(t) the error " Maple computation engine no longer executing. No further computation possible" appears in XMAPLE running in UNIX. Directly below m(t)= evalm(T J T_inverse m(0)) I get the Error (in expand/bigprod) object too large. Please help me to get around this. Thanks ---------------------------------------------------------------------------- Raj K. Rajamani, The University of Utah, Dept. of Metallurgical Engg. Phone: 801-581-3107, Fax. 801-581-8119. From rajamani@mines.utah.edu Mon Aug 14 11:23:03 1995 Received: from bingham.mines.utah.edu by raven.math.ubc.ca (911016.SGI/1.14) id AA28963; Mon, 14 Aug 95 11:23:03 -0700 Received: from [128.110.128.169] (mammoth.mines.utah.edu [128.110.128.169]) by bingham.mines.utah.edu (8.6.10/8.6.5.Beta9) with SMTP id MAA02944 for ; Mon, 14 Aug 1995 12:24:59 -0600 Date: Mon, 14 Aug 1995 12:24:59 -0600 Message-Id: <199508141824.MAA02944@bingham.mines.utah.edu> X-Sender: rajamani@bingham.mines.utah.edu Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: Robert Israel From: rajamani@bingham.mines.utah.edu (Raj K. Rajamani) Subject: Re: object too large error in MAPLE Status: RO Dear Robert: I attach the text file below. I can call you and explain the code to you if that is helpful. Let me know by e-mail. > restart; > >with(linalg,matrix,vector,add,multiply,dotprod,transpose,inverse,leastsqrs,null >space,augment,diag): gc(20024); The value n defines the size of all matrices; Change n to 6 and you will get object too large error > n:=4; s:=array(1..n); b:=matrix(n,n); m:= array(1..n); bn:= array(1..n); F:=array(1..n); mf:=array(1..n); p:=2; xsize:= array(1..n); Gm:= matrix(n,p); GF:=matrix(n,p); GNUM:= matrix (n,p); param:=array(1..p) ; xavesize:=array(1..n); T_inv:=matrix(n,n); T:=matrix(n,n); > alias(Id=&*()) : > lambda:=[seq(-s[k],k=1..n)]; > > Here I define eigen vector matrix called T; it is nXn I was using nullspace(BS....) call to generate this matrix ; I could revert to that. To avoid object too large error I began writing my own routines as below. > f:=proc(i,j) if ij then >sum((b[i,l]*s[l])/(s[i]-s[j])*T[l,j], l=j..i-1); fi; fi; fi; end; f := proc(i,j) if i < j then 0 else if i = j then 1 else if j < i then sum(b[i,l]*s[l]/(s[i]-s[j])*T[l,j],l = j .. i-1) fi fi fi end We call twice to avoid recursive definition warning; I will fix it later, however the matrix as it comes out is correct. > T:=matrix(n,n,f): > T:=matrix(n,n,f); This is the analytical inverse of T matrix > for i from 1 to n do for j from 1 to n do if i=j then T_inv[i,j]:= >1/T[i,j]; else if jl=j..i-1)/T[i,i]; else if j>i then T_inv[i,j]:= 0 ; fi; fi; fi; >od: od: i:='i': j:='j': I check to see if the product is identity matrix > evalm(T&*T_inv); 1 J matrix defined > J:=diag(seq(exp(-s[k]*t),k=1..n)); k:='k': This is where it dies. Object too large error occurs for n=6 and above. A Utmost I want to go to n=11 hopefully!!!!!!!!!!!!!!!!!!!!!***************$$$$$$$$$$$$$$$$$$$$$$$$$ > m:=evalm(T &*J &*T_inv &*mf): > for i from 1 to n do m[i]:=unapply(m[i],t) od: i:='i': The rest below is numerical substitution... Disregard...... > for i from 1 to n do F[i]:=unapply(sum(m[j](t),j=i..n),t): od: j:='j': i:='i': ---------------------------------------------------------------------------- Raj K. Rajamani, The University of Utah, Dept. of Metallurgical Engg. Phone: 801-581-3107, Fax. 801-581-8119. Article: 19390 of sci.math.symbolic Path: unixg.ubc.ca!math.ubc.ca!israel From: israel@math.ubc.ca (Robert Israel) Newsgroups: sci.math.symbolic Subject: Re: Problem with 3D Animation using cylindrical coords Date: 1 Feb 1996 01:40:56 GMT Organization: University of British Columbia, Vancouver, B.C., Canada Lines: 33 Distribution: world Message-ID: <4ep5n8$iq7@nntp.ucs.ubc.ca> References: <4eofa2$f0c@news.cc.ucf.edu> NNTP-Posting-Host: galois.math.ubc.ca In article <4eofa2$f0c@news.cc.ucf.edu>, drollins@pegasus.cc.ucf.edu (David Rollins) writes: |> I was interested in doing some 3d animations of a problem best described by |> cylindrical coordinates. To test out how this would work I tried a simple |> example: |> |> with(plots): |> animate3d([1, theta, z], theta=0..2*Pi, z=-2..2, t=1..2, coords=cylindrical); |> |> This just plots a cylinder of radius one of height 4 and everything looks |> fine. Even though I put in an animation parameter t it does nothing in this |> example. |> Next I changed the above to |> |> animate3d([t, theta, z], theta=0..2*Pi, z=-2..2, t=1..2, coords=cylindrical); |> |> I would expect this to produce a cylindrical with radius increasing from 1 to |> 2 as t increases. It didn't! The z scale is correct but the radius scale is |> way off. When I include the axes the numbering on the x and y axis runs from |> -400 to 800 and -600 to 1200. How could this be? Any suggestions would be |> appreciated. animate3d doesn't work with non-Cartesian coordinates (at least in Release 3; I haven't checked it in Release 4 yet). What you can use instead is display([...], insequence=true). Try this: > display([seq(plot3d([j/10, theta, z], theta=0..2*Pi, z=-2 .. 2, coords=cylindrical), j=0 .. 10)], insequence=true, axes=BOXED); -- Robert Israel israel@math.ubc.ca Department of Mathematics (604) 822-3629 University of British Columbia fax 822-6074 Vancouver, BC, Canada V6T 1Y4 From israel@math.ubc.ca Mon Jan 22 12:12:47 1996 Received: from galois.math.ubc.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA16432; Mon, 22 Jan 96 12:12:47 -0800 Date: Mon, 22 Jan 96 12:12:47 -0800 From: Robert Israel Received: by galois.math.ubc.ca id MAA16902; Mon, 22 Jan 1996 12:14:23 -0800 Message-Id: <199601222014.MAA16902@galois.math.ubc.ca> To: ben@mt.luth.se Subject: Re: CLEAR MAPLE MEMORY, BUT HOW ? In-Reply-To: Mail from 'Ben Diedrichs ' dated: Sat, 20 Jan 1996 12:47:07 +0100 Cc: israel Status: RO Dear Ben, | Sorry in my delay of getting back to you. | There seems to be a slight time difference between the ends of the cable | connecting us. I think it's only the 9 hour time difference between our time zones. I didn't notice any delay. | Unfortunately, it doesn't | look good. The Maple status bar indicates that more and more memory is be= | ing = | used. Is there any other table that you can clear? The best I can suggest, as I said before, is to "save" the session in a file (after going just one or two times through the inner loop) and look at the file with a text editor to try to see what is being saved. For example, if you do > int(x^2+x, x=0..1); > save `session`; you will find in the `session` file, along with a whole bunch of other stuff, the line `int/indef`(_X^2+_X):=1/3*_X^3+1/2*_X^2; which indicates that this value has been saved in the remember table for `int/indef`. This, according to the grep utility, is the only place that "_X^2+_X" appears in the file. On the other hand, there are lots of other procedures that have option remember, e.g. some of the "simplify/..." procedures, and I don't know what else is happening in your case. If you think it is the integration that's causing you the trouble, and you're just integrating polynomials, it wouldn't be hard to write your own function for integrating polynomials (without any "remember"). Hope this helps. Robert From maple_gr@daisy.uwaterloo.ca Tue Feb 6 16:21:20 1996 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA12752; Tue, 6 Feb 96 16:21:20 -0800 Received: (from root@localhost) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id OAA09212 for maple-list-outgoing; Tue, 6 Feb 1996 14:53:31 -0500 Message-Id: <199602061953.OAA09212@daisy.uwaterloo.ca> From: Maple Group Subject: [MUG] Heaviside and Assume To: maple-list@daisy.uwaterloo.ca Date: Tue, 6 Feb 1996 14:39:30 -0500 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Maple Group -=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=- Date: Mon, 29 Jan 96 15:04:09 -0800 From: Robert Israel To: maple-list@daisy.uwaterloo.ca Subject: Heaviside and Assume karczma@calvin.info.unicaen.fr (Jerzy Karczmarczuk) writes: | I am sorry, but what is a "proper definition" of a singular distribution? | Had we used the Heaviside step only as a linear functional, its 'point' | behaviour would be irrelevant. If we treat it as a normal function, I can | only quote the French classics: "Tu l'as voulu, Georges Dandin!". | | I think that it is a very good idea to leave H(0) undefined in the new release | of Maple. If somebody is interested in convoluting the Heaviside function | with something singular, he must decide himself what he is doing. I agree, in the context of distributions, the value of H(0) is pretty much irrelevant. However, a unit step function is useful for all sorts of things other than the "standard" use of the Heaviside function in the context of distributions, and in many of those other uses you do want a value at 0. For example, before "piecewise" reached its current state of perfection this was a handy substitute. Actually, I'm not completely convinced that having H(0) undefined is such a good idea, even in the context of distributions. In principle, any meaningful quantity should not depend on particular values. But numerical methods generally do evaluate the functions at a finite number of points. What will happen if you try numerical methods to solve a differential equation involving the Heaviside function and your algorithm finds that a term in the equation is undefined at x=0? Robert Israel israel@math.ubc.ca Department of Mathematics (604) 822-3629 University of British Columbia fax 822-6074 Vancouver, BC, Canada V6T 1Y4 -=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=- From: gdmiller@loki.stanford.edu (greg d. miller) Subject: Heaviside and Assume To: maple-list@daisy.uwaterloo.ca Date: Tue, 30 Jan 1996 19:23:04 -0800 (PST) I hope not to appear strident in continuing this thread, but I would like to follow up on Jerzy Karczmarczuk's comment on my suggested definition of Heaviside. First of all, the context of the Dirac function is that it is the limiting case of something called a generalized function, which implies a great deal more than that implied by calling it a singular distribution. While a generalized function is not one of a particular form (e.g. gaussian), it possesses certain properties which affect significantly its behavior in its limit. This behavior is very important to us who use the Dirac, its derivatives, and Heaviside. We need to remain self-consistent in our definitions and not single out one particular function of the set for a non- consistent definition. Briefly, then, permit me to discuss Dirac and Heaviside to point out the implications of consistent definitions. I assume we all would like Dirac(x)=Dirac(-x) for all real x. If we can agree on this then we have to agree that Dirac(x) is strictly even. In turn, then, we are forced to agree that the integral of Dirac from -infinity to zero is equal to one half the integral from -infinity to infinity. If we wish Dirac to be the derivative of Heaviside, then we are forced to agree that Heaviside evaluated at zero be one half the integral of Dirac from -infinity to infinity. Finally, let's look at this one by using integration by parts. Designate Dirac as D, and Heaviside by H. Note that D=H`. For brevity, designate integration with I(f), meaning the integral of f from -infinity to infinity. I(D*H)=I(H`*H)=H(0). I(H`*H)=H(infinity)^2-H(-infinity)^2-I(H`*H) 2*I(H`*H)=1 I(H`*H)=1/2 Therefore H(0)=1/2 I have difficulty seeing how one can define Heaviside otherwise without also addressing the definitions of Dirac and its derivatives. It would seem to me that defining a function like Heaviside with H(0)=0 would generate as its derivative a function whose value is zero at zero, but is singular in the limit as x approaches zero only when approached from positive infinity. Such a function is surely useful for some problems, but must be divorced from Dirac. Thanks for the bandwidth. Greg Miller gdmiller@loki.stanford.edu -=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=- Date: 1 Feb 1996 15:42:49 -0800 From: "Casselman Tom" Subject: Heaviside and Assume To: maple-list@daisy.uwaterloo.ca I too have a critical "bible" on generalized functions that I refer to: An Introduction To Fourier Analysis and Generalized Functions M. J. Lighthill Cambridge University Press London, 1958 Read this little gem (79 pages!) if you can find it. I keep mine locked up in a safe!! :-) My belief is that by definition a generalized function, G(x) has no value at x=0 and one never uses the "bAre" GF anyway. One is always integrating, differentiating a GF with a good or almost good function. I agree with Maple developers, a GF like the Heaviside function should be undefined at its singularity. Tom Casselman From maple_gr@daisy.uwaterloo.ca Tue Feb 6 16:20:21 1996 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA12743; Tue, 6 Feb 96 16:20:21 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id OAA08802 for maple-list-outgoing; Tue, 6 Feb 1996 14:45:05 -0500 Message-Id: <199602061945.OAA08802@daisy.uwaterloo.ca> From: c05172@newton.sr2.takuma-ct.ac.jp Subject: [MUG] Solving Non-linear Diff. Equations To: maple-list@daisy.uwaterloo.ca Date: Fri, 2 Feb 96 13:25:57 JST Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: c05172@newton.sr2.takuma-ct.ac.jp Hi:) I am a foreign student of Takuma National College of Technology, Kagawa Prefecture, Japan. I am trying to model a pendulum bob suspended by a string and is attached to a cart(motor) that is able to move in the x-axis. The parameters are M: the effective mass of the cart, m: mass of the bob, l: the length of the string, mu: the coefficient of friction, g: acceleration due to gravity, x: the position of the cart, theta: the angle the pendulum makes with respect to the vertical axis. Positive theta is on the same direction with positive x. With the conventions above, and using Lagrange's formula, the ff. system of differential equations is derived. THETA:=diff(theta(t),t,t)=-1/l*diff(x(t),t,t)*cos(theta(t))-g/l*sin(theta(t)); DIST:=(M+m)*diff(x(t),t,t)+m*l*diff(theta(t),t,t)*cos(theta(t))-m*l*diff(theta(t),t)^2*sin(theta(t))+mu*diff(x(t),t)=u; u: the effective Force acting in the positive x direction. if we take M>>m DIST becomes DIST:=1/M*(-mu*diff(x(t),t)+u); I tried solving this as it is but MAPLEV3 is unable to get an answer for x(t), and theta(t)....Linearizing the equation for theta in the vicinity of theta=0(sin(theta(t))=theta(t), cos(theta(t))=0) will give an approximate solution, though...But since I am interested in the value of theta at the vicinity of pi/2, when the tension of the string becomes negative, I am unable to get an accurate solution. Please, anybody who is familiar with this type non-linear system simulation, help me... Sincerely, Nelio Medina c05172@newton.sr2.takuma-ct.ac.jp p.s. for the force u, i tried an impulse and a cosine signal... From israel@math.ubc.ca Mon Feb 12 09:46:30 1996 Received: from galois.math.ubc.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA09015; Mon, 12 Feb 96 09:46:30 -0800 Date: Mon, 12 Feb 96 09:46:30 -0800 From: Robert Israel Received: by galois.math.ubc.ca id JAA03069; Mon, 12 Feb 1996 09:48:27 -0800 Message-Id: <199602121748.JAA03069@galois.math.ubc.ca> To: JHARRIS@math.otago.ac.nz Subject: Re: Why 'GAMMA' instead of 'Gamma' In-Reply-To: Mail from '"JHarris" ' dated: 12 Feb 1996 14:22:18 GMT+1200 Cc: israel Status: RO Dear Prof. Harris: | Rather than bothering the entire MUG or sci.math.symbolic groups, I thought | I might just ask you, the obvious leading expert. Thanks, but I'm really not that much of an expert. Maybe the real experts are too busy to waste much time on these groups. | In Maple one uses 'Beta' rather than 'beta' for the beta function, | 'Pi' rather than 'pi' for 3.14159..., | 'Psi' rather than 'psi' for the psi function, and | 'Zeta' rather than 'zeta' for the zeta function | since in each case the later word denotes the corresponding Greek letter | itself. Actually, it's a bit muddled: except in the case of Pi, Zeta and Chi, a Greek letter name with its first character in uppercase is printed as the corresponding Greek capital letter (where the necessary font facilities exist, I guess). A Greek letter name with its first character in lowercase is printed as the Greek lowercase letter. Pi and Zeta, as you say, are used for the constant pi and the zeta function, which are printed in lowercase. "Chi", on the other hand, has nothing to do with Greek, its name stands for "hyperbolic cosine integral". But, for example, the lambda function in the numtheory package is written in lowercase, so there isn't a consistent rule that functions whose names are Greek are written with a capital letter. | So why doesn't Maple use | 'Gamma' rather than 'GAMMA' to denote the gamma function? A good question, which has also occurred to me. As far as I know, GAMMA is the only Maple function that is written all in uppercase and is not an abbreviation or acronym. I suppose that this was done way back near the beginning of the development of Maple, before anybody had thought of a consistent naming policy, and it would be too hard to change it now. Note that the lowercase "gamma" is used for Euler's constant (and more generally gamma(n) = limit(sum(ln(k)^n/k, k=1..n) - ln(m)^(n+1)/(n+1), m=infinity). "Gamma", on the other hand, doesn't seem to be used for anything. If you prefer it to GAMMA, you can use it as an alias: > alias(Gamma=GAMMA): This could go in your initialization file (maple.ini or .mapleinit or whatever, depending on your operating system). Maybe some of the real Maple insiders would have more to say about this. I'd be interested to see their answers - why don't you post the question in sci.math.symbolic or MUG? Robert Israel israel@math.ubc.ca Department of Mathematics (604) 822-3629 University of British Columbia fax 822-6074 Vancouver, BC, Canada V6T 1Y4 From maple_gr@daisy.uwaterloo.ca Wed Feb 15 20:23:17 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA13250; Wed, 15 Feb 95 20:23:17 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.9/8.6.9) id UAA05195 for maple-list-outgoing; Wed, 15 Feb 1995 20:34:17 -0500 Message-Id: <199502160134.UAA05195@daisy.uwaterloo.ca> From: Joe Riel Subject: [MUG] Distributive over Equality To: maple-list@daisy.uwaterloo.ca (Maple User Group) Date: Wed, 15 Feb 1995 12:28:59 -0800 (PST) Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Joe Riel Maple distributes multiplication and division over relations, e.g. > eq := a = b: > eq*c; a*c = b*c Why doesn't it also distribute addition, subtraction, and a host of other operators over relations, particularly equalities? The map function can always be used, but it seems simpler and more obvious to do > eq+c; a+c = b+c rather than > map(x -> x+c, eq); I did some experimenting and noticed that the error comes from the `simpl/relopsum` procedure, which permits adding relations, among other things. This does allow one to use the following technique (chosen to minimize re-entering "c", which presumably would be more complex in a real problem). > c: > eq + ("="); a+c = b+c This isn't too bad. It's easier than the map function. Joe Riel From maple_gr@daisy.uwaterloo.ca Wed Feb 15 21:06:10 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA13387; Wed, 15 Feb 95 21:06:10 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.9/8.6.9) id UAA05207 for maple-list-outgoing; Wed, 15 Feb 1995 20:34:21 -0500 Message-Id: <199502160134.UAA05207@daisy.uwaterloo.ca> From: fc03@lehigh.edu (Frederick W. Chapman) Subject: [MUG] Re: dsolve in Release 3 - Chapter 2 To: maple-list@daisy.uwaterloo.ca Date: Wed, 15 Feb 1995 19:40:31 EST Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: fc03@lehigh.edu (Frederick W. Chapman) >>> From: Antonio Paulo Almeida > >I've came across something that seems to be another problem >with dsolve in Release 3. Actually, as it turns out, Release 2 gives the WRONG ANSWER to this problem, whereas Release 3 gives the CORRECT ANSWER, but in a less convenient form. In fact, there are at least two significant problems with the form of the solution given by Release 3: (1) it is difficult to extract a basis of the solution space from the answer given by Release 3, and (2) it is difficult to separate complex-valued solutions into their real and imaginary parts. For more information on this -- as well a review of what the Poets have said about computer algebra systems -- please see my comments below. Fred Chapman Lehigh University * * * * * * * * * * >Compare the two Maple V session transcriptions below, > ># First trying to solve it in Release 2 > > |\^/| Maple V Release 2 (CEMUL) >._|\| |/|_. Copyright (c) 1981-1992 by the University of Waterloo. > \ MAPLE / All rights reserved. MAPLE is a registered trademark of > <____ ____> Waterloo Maple Software. > | Type ? for help. > >> # This is the differential equation >> deq:=6*epsilon^4*diff(q1[0](x1),x1$6)-161*epsilon^2*diff(q1[0](x1),x1$4): > > >> deq:="-2205*diff(q1[0](x1),x1$2)=0; > > / 6 \ / 4 \ > 4 | d | 2 | d | > deq := 6 epsilon |------ q1[0](x1)| - 161 epsilon |------ q1[0](x1)| > | 6 | | 4 | > \ dx1 / \ dx1 / > > / 2 \ > | d | > - 2205 |------ q1[0](x1)| = 0 > | 2 | > \ dx1 / > >># solving it in Release 2 > >> dsolve(deq,q1[0](x1)); > > > 2 3 > q1[0](x1) = _C1 + _C2 x1 + _C3 x1 + _C4 x1 > > 1/2 1/2 1/2 1/2 > 2 7 23 3 x1 > + _C5 exp(1/6 -----------------------) > epsilon > > 1/2 1/2 1/2 1/2 > 2 7 23 3 x1 > + _C6 exp(- 1/6 -----------------------) > epsilon > >> done Done WRONG... :-) The x1^2 and x1^3 terms are NOT solutions of the original ODE, as the following computations in Release 3 show: > simplify(subs(q1[0](x1) = x1^2, deq)); -4410 = 0 > simplify(subs(q1[0](x1) = x1^3, deq)); - 13230 x1 = 0 > Now trying to solve it in Release 3 > > > |\^/| Maple V Release 3 (IST Lisboa) >._|\| |/|_. Copyright (c) 1981-1994 by Waterloo Maple Software and the > \ MAPLE / University of Waterloo. All rights reserved. Maple and Maple V > <____ ____> are registered trademarks of Waterloo Maple Software. > | Type ? for help. >> deq:=6*epsilon^4*diff(q1[0](x1),x1$6)-161*epsilon^2*diff(q1[0](x1),x1$4): > >>deq:="-2205*diff(q1[0](x1),x1$2)=0; > > / 6 \ / 4 \ > 4 | d | 2 | d | > deq := 6 epsilon |------ q1[0](x1)| - 161 epsilon |------ q1[0](x1)| > | 6 | | 4 | > \ dx1 / \ dx1 / > > / 2 \ > | d | > - 2205 |------ q1[0](x1)| = 0 > | 2 | > \ dx1 / > >># Using dsolve in Release 3 > >>dsolve(deq,q1[0](x1)); > > / ----- \ > | \ | > q1[0](x1) = _C2 + _C3 x1 + | ) _C1[_R] exp(_R x1)| > | / | > | ----- | > \_R = %1 / > > 2 2 4 4 >%1 := RootOf(- 2205 - 161 _Z epsilon + 6 _Z epsilon ) >From this form, we can see that Release 3 does NOT include spurious "solutions" such as x1^2 or x1^3. >># expanding the RootOf ["In this part, I have deleted extra things that were repeated."] [Note the internal rhyme in the style of Edgar Allen Poe (see below).] >> sol_eq:=": > >> allvalues(sol_eq); > >q1[0](x1) = _C2 + _C3 x1 > > 1/2 1/2 1/2 1/2 1/2 1/2 > 21 (23 + 1609 ) 21 (23 + 1609 ) x1 > + _C1[1/6 -----------------------] exp(1/6 --------------------------), > epsilon epsilon > >q1[0](x1) = _C2 + _C3 x1 > > 1/2 1/2 1/2 1/2 1/2 1/2 > 21 (23 + 1609 ) 21 (23 + 1609 ) x1 > + _C1[- 1/6 -----------------------] exp(- 1/6 --------------------------) > epsilon epsilon > > , > >q1[0](x1) = _C2 + _C3 x1 > > 1/2 1/2 1/2 1/2 > I (- 483 + 21 1609 ) I (- 483 + 21 1609 ) x1 > + _C1[1/6 -------------------------] exp(1/6 ----------------------------) > epsilon epsilon > > , > >q1[0](x1) = _C2 + _C3 x1 > > 1/2 1/2 1/2 1/2 > I (- 483 + 21 1609 ) I (- 483 + 21 1609 ) x1 > + _C1[- 1/6 -------------------------] exp(- 1/6 ----------------------------) > epsilon epsilon > >># Now the solution has an imaginary part. Why? The answer is that the characteristic equation of the ODE has complex roots, which Release 3 computed correctly, but Release 2 neglected to find. >>done > >Even if one uses the assume facility to "tell" Maple that x1 is real positive >the solution given by Release 3 is the same. > >It seems to me that dsolve has not received the proper attention >when Release 3 was being developed. Release 2 seems to be more efective >to compute the solution of ordinary differential equations. In view of new information I hope you will agree that Release 3 is indeed an improvement over Release 2 with respect to ACCURACY. However, I would like to raise some EASE OF USE ISSUES concerning the CONVENIENCE of the form of the answer. Continuing the Release 3 Maple session, I defined > ans := allvalues(dsolve(deq, q1[0](x1))): which is the last output displayed above. This result is a somewhat complicated data structure: it is a SEQUENCE, and each element of the sequence is an EQUATION; the right hand side (RHS) of each equation is a solution of the ODE, as we now verify: > seq(expand(eval(subs(ans[i], deq))), i=1..4); 0 = 0, 0 = 0, 0 = 0, 0 = 0 Note that each equation in the sequence gives a 3-dimensional solution for a problem with a 6-dimensional solution space; for example: > ans[4]; q1[0](x1) = _C2 + _C3 x1 1/2 1/2 1/2 1/2 I (- 483 + 21 1609 ) I (- 483 + 21 1609 ) x1 + _C1[- 1/6 -------------------------] exp(- 1/6 ----------------------------) epsilon epsilon The basis functions 1 and x1 are repeated in each of these 4 forms, and the third basis function in each of the 4 forms is unique, giving 6 independent solutions. This leads to... *************************************************************************** PROBLEM #1: It would be much more convenient for the user to have Maple express the solution as a single linear combination of all 6 basis functions, instead of as 4 linear combinations of 6 basis functions taken 3 at a time with 2 functions repeated. (If this sounds like a combinatorial nightmare, that's because it is!) *************************************************************************** If we want to express the solution as a linear combination, over the REAL numbers, of REAL-VALUED basis functions, we encounter another problem. Maple distinguishes four different versions of the arbitrary constant _C1 by indexing _C1 with the roots of a polynomial; this causes problems for "evalc" if we try to separate a complex-valued solution into its real and imaginary parts: > evalc(ans[4]); Error, (in evalc/evalc) unable to compute coeff It is the indexing of _C1 which is the source of the problem: > op(1, op(3, rhs(ans[4]))); 1/2 1/2 I (- 483 + 21 1609 ) _C1[- 1/6 -------------------------] epsilon > evalc("); Error, (in evalc) unable to compute coeff Removing the coefficient _C1[...stuff...] eliminates the problem: > op(2, op(3, rhs(ans[4]))); 1/2 1/2 I (- 483 + 21 1609 ) x1 exp(- 1/6 ----------------------------) epsilon > evalc("); 1/2 1/2 1/2 1/2 (- 483 + 21 1609 ) x1 (- 483 + 21 1609 ) x1 cos(1/6 --------------------------) - I sin(1/6 --------------------------) epsilon epsilon In summary, we have... *************************************************************************** PROBLEM #2: "evalc" cannot handle arbitrary constants which are indexed by complex numbers, and this impedes the separation of complex-valued solutions into their real and imaginary parts. *************************************************************************** >In this situation the following Shakespeare quotation seems appropriate > > MUCH ADO ABOUT NOTHING > >to describe the features of dsolve in Release 3. > >Antonio Almeida I cannot agree there, but I can provide some other relevant quotations. After working with the beta test version of Maple V Release 3, Shakespeare liked the package so much that he wrote: So are you to my thoughts as food to life, Or as sweet-seasoned showers are to the ground... After reading Shakespeare's book, "Maple V for Poets", Milton penned these words: To the shame of slow endeavoring art, Thy easy numbers flow... In contrast, after wrestling with the Mathematica documentation, Edgar Allen Poe described his experiences in this way: Once upon a midnight dreary, while I pondered, weak and weary Over many a quaint and curious volume of forgotten lore, While I nodded, nearly napping, suddenly there came a tapping, As of someone gently rapping, rapping at my chamber door. "'Tis a Mathematica salesman rapping at my chamber door. Only this, and nothing more." He goes on to use phrases like "filled me with fantastic terrors never felt before", "thing of evil", etc. There you have it -- the Poets' choice is clear! All in good fun, Fred o -------------------------------------------------------------------------- o | Frederick W. Chapman, Mathematical Software Specialist, Lehigh University | | Office Phone: (610) 758-3218 Internet E-mail: fc03@Lehigh.Edu | o -------------------------------------------------------------------------- o | "The ink of the scholar is more sacred than the blood of the martyr." | o -------------------------------------------------------------------------- o From maple_gr@daisy.uwaterloo.ca Thu Feb 16 12:07:23 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA18826; Thu, 16 Feb 95 12:07:23 -0800 Received: (from root@localhost) by daisy.uwaterloo.ca (8.6.9/8.6.9) id IAA21917 for maple-list-outgoing; Thu, 16 Feb 1995 08:49:14 -0500 Message-Id: <199502161349.IAA21917@daisy.uwaterloo.ca> From: "J. Guenter Hauck" <100303.115@compuserve.com> Subject: [MUG] Automatically loading a worksheet when maple starts? To: "Maple (User_Group)" Date: 16 Feb 95 05:14:23 EST Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: "J. Guenter Hauck" <100303.115@compuserve.com> Re: Automatically loading a worksheet when maple starts? Matthew Daniell Cutts writes: >> We'd like to have Maple automatically load a worksheet (call it "generic.ms") whenever maple >> starts up. Is this possible? Yes, it is possible. a) MAPLE-WIN: In the file WIN.INI, Section [Extensions] add the line C:\MAPLEV3\BIN\WMAPLE53.EXE=^.MS and, assuming your's GENERIC.MS is in C:\MAPLEV3\EXAMPLES, create in Windows' PROGRAM MANAGER: FILE, NEW a new >program< GENERIC, setting NAME: GENERIC RUN= c:\maplev3\examples\generic.ms WORKING DIRECTORY= c:\maplev3\bin Thereafter, clicking on the icon GENERIC, Maple will start with the worksheet GENERIC.MS. In this way you could add program icons as many you need. (The change of the WIN.INI above mentioned you could perform via the FILE MANAGER also.) b) MAPLE-DOS: Create a new batch file GENERIC.BAT with the lines cd\ cd maplev3\bin maple.exe c:\maplev3\examples\generic.ms cd\ and put GENERIC.BAT in one of the directories, called in the line PATH= .... of the AUTOEXEC.BAT. Restart your computer. Now, typing GENERIC at the DOS prompt, maple will start with the worksheet GENERIC.MS. (You should take into consideration to create a separate directory C:\BATCH for all the .bat files and to enclose C:\BATCH in the PATH= ). I hope I could help you. -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- Prof. Dr. J. G. Hauck (Dresden) e-Mail: 100303.115@compuserve.com Phone/Fax: +49 351 471 7712 -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- From maple_gr@daisy.uwaterloo.ca Thu Feb 16 13:24:07 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA19533; Thu, 16 Feb 95 13:24:07 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.9/8.6.9) id IAA21849 for maple-list-outgoing; Thu, 16 Feb 1995 08:48:39 -0500 Message-Id: <199502161348.IAA21849@daisy.uwaterloo.ca> From: George Labahn Subject: [MUG] Re: dsolve in Release 3 - Chapter 2 To: maple-list@daisy.uwaterloo.ca Date: Wed, 15 Feb 1995 21:32:51 -0500 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: George Labahn |\^/| Maple V Release 3 (University of Waterloo) ._|\| |/|_. Copyright (c) 1981-1994 by Waterloo Maple Software and the \ MAPLE / University of Waterloo. All rights reserved. Maple and Maple V <____ ____> are registered trademarks of Waterloo Maple Software. | Type ? for help. Fredrick Chapman writes: # Actually, as it turns out, Release 2 gives the WRONG ANSWER to this problem, # whereas Release 3 gives the CORRECT ANSWER, but in a less convenient form. # In fact, there are at least two significant problems with the form of the # solution given by Release 3: (1) it is difficult to extract a basis of the # solution space from the answer given by Release 3, ---------------- # One can get the basis form of the solution directly using the output = basis # option for dsolve. > deq:=6*epsilon^4*diff(q1[0](x1),x1$6)-161*epsilon^2*diff(q1[0](x1),x1$4)-2205* > diff(q1[0](x1),x1$2)=0; / 6 \ / 4 \ 4 | d | 2 | d | deq := 6 epsilon |------ q1[0](x1)| - 161 epsilon |------ q1[0](x1)| | 6 | | 4 | \ dx1 / \ dx1 / / 2 \ | d | - 2205 |------ q1[0](x1)| = 0 | 2 | \ dx1 / > dsolve(deq,q1[0](x1)); / ----- \ | \ | q1[0](x1) = _C2 + _C3 x1 + | ) _C1[_R] exp(_R x1)| | / | | ----- | \_R = %1 / 2 2 4 4 %1 := RootOf(- 2205 - 161 _Z epsilon + 6 _Z epsilon ) # which is actually quite a nice compact answer - the kind that in some sense # is exactly what is presented in an introductory differential equations # course (but of course the roots of the characteristic polynomial are # always simple in those cases). # This form of the answer is not meant to work with such # commands as allvalues since _C[R], a constant indexed by a root of a # becomes _C[ specific complicated root ] - not a useful object. # In this case it is MUCH better to just ask for the basis of solutions # directly via # > dsolve(deq,q1[0](x1),output=basis); 2 2 4 4 [1, x1, exp(RootOf(- 2205 - 161 _Z epsilon + 6 _Z epsilon ) x1)] # which can be converted to radicals via > map(allvalues," ); 1/2 1/2 1/2 21 (23 + 1609 ) x1 [1, x1, exp(1/6 --------------------------), epsilon 1/2 1/2 1/2 21 (23 + 1609 ) x1 exp(- 1/6 --------------------------), epsilon 1/2 1/2 I (- 483 + 21 1609 ) x1 exp(1/6 ----------------------------), epsilon 1/2 1/2 I (- 483 + 21 1609 ) x1 exp(- 1/6 ----------------------------)] epsilon # and which can then be seperated into real and imaginary parts via > base1 := evalc( " ); 1/2 1/2 1/2 21 (23 + 1609 ) x1 base1 := [1, x1, exp(1/6 --------------------------), epsilon 1/2 1/2 1/2 21 (23 + 1609 ) x1 exp(- 1/6 --------------------------), cos(%1) + I sin(%1), epsilon cos(%1) - I sin(%1)] 1/2 1/2 (- 483 + 21 1609 ) x1 %1 := 1/6 -------------------------- epsilon # From this one can pick an alternate form for the basis and form a new # general answer. Indeed in this case one can do > base2 := [base1[1], base1[2], base1[3], base1[4], evalc(Re(base1[5])), > evalc(Im(base1[5]))]; 1/2 1/2 1/2 21 (23 + 1609 ) x1 base2 := [1, x1, exp(1/6 --------------------------), epsilon 1/2 1/2 1/2 21 (23 + 1609 ) x1 exp(- 1/6 --------------------------), epsilon 1/2 1/2 1/2 1/2 (- 483 + 21 1609 ) x1 (- 483 + 21 1609 ) x1 cos(1/6 --------------------------), sin(1/6 --------------------------)] epsilon epsilon # and get a general answer as > > sum( c[i]*base2[i], i=1..6 ); 1/2 1/2 1/2 21 (23 + 1609 ) x1 c[1] + c[2] x1 + c[3] exp(1/6 --------------------------) epsilon 1/2 1/2 1/2 21 (23 + 1609 ) x1 + c[4] exp(- 1/6 --------------------------) epsilon 1/2 1/2 (- 483 + 21 1609 ) x1 + c[5] cos(1/6 --------------------------) epsilon 1/2 1/2 (- 483 + 21 1609 ) x1 + c[6] sin(1/6 --------------------------) epsilon - George Labahn From maple_gr@daisy.uwaterloo.ca Sun Feb 26 18:24:13 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA15850; Sun, 26 Feb 95 18:24:13 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.9/8.6.9) id SAA01406 for maple-list-outgoing; Sun, 26 Feb 1995 18:57:10 -0500 Message-Id: <199502262357.SAA01406@daisy.uwaterloo.ca> From: Maple Group Subject: [MUG] Memory usage during iterative matrix calculations To: maple-list@daisy.uwaterloo.ca Date: Sun, 26 Feb 1995 18:54:44 -0500 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Maple Group -=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=- Date: Thu, 23 Feb 1995 14:31:09 -0800 (PST) From: "Sean P. DeMerchant" To: maple-list@daisy.uwaterloo.ca Subject: Memory usage during iterative matrix calculations Raj, I cannot recreate your the massive memory usage you report, with the iterative evaluation of the same thing. Following are two excerpts from Maple sessions in which this did not occur. DEC Station 5000-200 running Ultrix > words(); 154753 > #about 447K > interface(version); Maple V, Release 3, DEC RISC UNIX, Mar 3 1994, CAMPUS WIDE HP-Apollo 9000-715 > words(); 93428 > #about 255K > interface(version); Maple V, Release 3, HP RISC UNIX, Mar 3 1994, CAMPUS WIDE > IBM RS/6000 [probably RS/6000-580 but I'm not sure] > words(); 72136 > #about 191K > interface(version); Maple V, Release 3, IBM RISC UNIX, Mar 3 1994, CAMPUS WIDE > If you could inform the MUG of the version of the software you are using, it may make it easier to find a solution. hoe this helps, Sean ------------------------------------------------------------------------------ Sean DeMerchant seandee@ms.washington.edu ------------------------------------------------------------------------------ -=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=- Date: Fri, 24 Feb 1995 12:49:09 -0400 To: maple-list@daisy.uwaterloo.ca From: wmcb@math.appstate.edu (Bill Bauldry) Subject: Memory usage during iterative matrix calculations >>> From: rajamani@bingham.mines.utah.edu (Raj K. Rajamani) > > Dear user group: > Please take a look at the following: > > >with(linalg);gc(1024): > >> A:=matrix([ [x,x^2,x^3],[exp(x),exp(2*x),exp(3*x)], [-x,-x^2,-x^3] ]); > >> x:=2; > >> for i from 1 to 10 do > ANUM:= map(eval,A); od; #matrix repeatedly evaluated numerically > > >Just to illustrate the point I show a 3X3 matrix whose elements are defined >as a function of the variable x. Next x is given the value 2. Then the >matrix is numerically evaluated ten times. After each evluation the memory >used up by Maple increases by 2 kilobytes. In an iterative problem where >the convergence may take over hundred iterations, Maple uses up all of the >20 Megabytes. Since the matrix is repeatedly evluated for different values >of x, why is Maple using more memory. In otherwords there should be a >single 3X3 space allocation for the numerical equivalent of A-matrix. Is >there a way to make Maple relenquish unused memory. Notice that I am using >garbage collection routine in the front. It seems something else is affecting your session. When I ran the loop on my Macintosh, the results were different: > for i from 1 to 10 do status; ANUM:= map(eval,A); zip((x,y)->y-x,[""],[status]); lprint(i,"); od: 1 [1444, 0, .350, 0, 0, 1281, 605, 1] 2 [0, 0, 0, 0, 0, 0, 0, 0] 3 [1254, 0, .517, 0, 0, -847, -119, 1] 4 [0, 0, 0, 0, 0, 0, 0, 0] 5 [1199, 0, .333, 0, 0, -9, -66, 1] 6 [0, 0, 0, 0, 0, 0, 0, 0] 7 [1152, 0, .367, 0, 0, -2, -28, 1] 8 [0, 0, 0, 0, 0, 0, 0, 0] 9 [1152, 0, .350, 0, 0, 0, -28, 1] 10 [0, 0, 0, 0, 0, 0, 0, 0] Curious patterns, though. Regards, Bill +=====================+=================================+ | Wm C Bauldry | e-mail: wmcb@math.appstate.edu | | Math. Sciences | phone: (704) 262-2355 | | Appalachian State U | dept: (704) 262-3050 | | Boone, NC 28608 | fax: (704) 265-8617 | +---------------------+---------------------------------+ | URL's ->: | | http://www.mathsci.appstate.edu/u/math/wmcb/wmcb.html | | http://lynx.math.appstate.edu/wmcb.html | +=====================+=================================+ -=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=- To: maple-list@daisy.uwaterloo.ca Date: Sun, 26 Feb 1995 19:20:14 Subject: Memory usage during iterative matrix calculations From: hf@glare.in-chemnitz.de (Holger Friedrich) >>> From: rajamani@bingham.mines.utah.edu (Raj K. Rajamani) > >with(linalg);gc(1024): >> A:=matrix([ [x,x^2,x^3],[exp(x),exp(2*x),exp(3*x)], [-x,-x^2,-x^3] ]); >> x:=2; >> for i from 1 to 10 do > ANUM:= map(eval,A); od; #matrix repeatedly evaluated numerically > >matrix is numerically evaluated ten times. After each evluation the memory >used up by Maple increases by 2 kilobytes. In an iterative problem where Memory used may in fact increase by about one kilobyte per loop if you choose to display all these results. It is much less than that if you suppress display of the results by terminating the loop with a colon, instead of a semicolon. In really complicated calculations, Maple will of course need much memory for the computations themselves as well. If garbage collections don't help, you can only save the intermediate results (or the session state) to a disk file and restart the Maple session. This should provide you with some fresh memory resources. Unfortunately, it seems you cannot wrap a loop or procedure around something involving a restart. So you must press some keys each time the RAM is full, and you want to save the variables and restart the session. -- Holger Friedrich Chemnitz, Germany hf@glare.in-chemnitz.de From maple_gr@daisy.uwaterloo.ca Sun Feb 26 18:35:13 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA15903; Sun, 26 Feb 95 18:35:13 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.9/8.6.9) id TAA01803 for maple-list-outgoing; Sun, 26 Feb 1995 19:01:25 -0500 Message-Id: <199502270001.TAA01803@daisy.uwaterloo.ca> From: Antonio Paulo Almeida Subject: [MUG] dsolve in Release 3 - Epilogue To: maple_group@daisy.uwaterloo.ca Date: Sat, 25 Feb 1995 19:33:03 GMT Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Antonio Paulo Almeida Dear MUGers, In a previous message I've raised some issues concerning dsolve in Release 3. I gave an example where Release 2 returned the solution where the imaginary part was converted to trigonometric functions, whereas in Release 3 the solution was returned with the imaginary part "unconverted". The procedure below filters the solution returned by Release 3 in order to have only exponentials and trigonometric functions instead of exponentials with imaginary arguments. ########################################################################### FilterSolution:=proc(Solution:list) local NumberOfSolutions, i, ActualSolution, ActualOp, ConjugateList, SolutionList: ConjugateList:=[]: SolutionList:=[]: for ActualSolution in Solution do for i to nops(op(2,ActualSolution)) while not has(op(i,op(2,ActualSolution)),'I') do if nops(op(i,op(2,ActualSolution)))=1 then ActualOp:=1 else ActualOp:=op(2,op(i,op(2,ActualSolution))) fi: if member(ActualOp,SolutionList) then next fi: SolutionList:=[ActualOp,op(SolutionList)] od: if i>nops(op(2,ActualSolution)) then next fi: ActualOp:=op(2,op(i,op(2,ActualSolution))): if not member(evalf(op(1,ActualOp)),map(< evalf(subs(I=-I,op(1,x))) | x>, ConjugateList)) then ConjugateList:=[op(ConjugateList),ActualOp] fi od: [op(SolutionList),op(map(,ConjugateList))]: RETURN(sort(map(, "))) end: # FilterSolution ########################################################################## It would be nice to have a similar possibility in a future Release. I sincerely hope that this will be taken in consideration by Maple developers. |\^/| Maple V Release 3 (IST Lisboa) ._|\| |/|_. Copyright (c) 1981-1994 by Waterloo Maple Software and the \ MAPLE / University of Waterloo. All rights reserved. Maple and Maple V <____ ____> are registered trademarks of Waterloo Maple Software. | Type ? for help. > eq111:=-161*epsilon^2*diff(q1[0](x1),x1$4)+6*epsilon^4*diff(q1[0](x1),x1$6); / 4 \ / 6 \ 2 | d | 4 | d | eq111 := - 161 epsilon |------ q1[0](x1)| + 6 epsilon |------ q1[0](x1)| | 4 | | 6 | \ dx1 / \ dx1 / > eq111:="+2205*diff(q1[0](x1),x1$2); / 4 \ / 6 \ 2 | d | 4 | d | eq111 := - 161 epsilon |------ q1[0](x1)| + 6 epsilon |------ q1[0](x1)| | 4 | | 6 | \ dx1 / \ dx1 / / 2 \ | d | + 2205 |------ q1[0](x1)| | 2 | \ dx1 / ^ > sol_list:=[allvalues(dsolve(eq111,q1[0](x1)))]; sol_list := [ q1[0](x1) = _C2 + _C3 x1 1/2 1/2 1/2 1/2 1/2 1/2 21 (23 + I 551 ) 21 (23 + I 551 ) x1 + _C1[1/6 ------------------------] exp(1/6 ---------------------------), epsilon epsilon q1[0](x1) = _C2 + _C3 x1 1/2 1/2 1/2 1/2 1/2 1/2 21 (23 + I 551 ) 21 (23 + I 551 ) x1 + _C1[- 1/6 ------------------------] exp(- 1/6 ---------------------------) epsilon epsilon , 1/2 1/2 %1 %1 x1 q1[0](x1) = _C2 + _C3 x1 + _C1[1/6 -------] exp(1/6 --------), epsilon epsilon 1/2 1/2 %1 %1 x1 q1[0](x1) = _C2 + _C3 x1 + _C1[- 1/6 -------] exp(- 1/6 --------)] epsilon epsilon 1/2 %1 := 483 - 21 I 551 > # Using the FilterSolution procedure > > > sol_list1:=FilterSolution(sol_list); sol_list1 := [1, x1, exp(1/12 %2) sin(%1), exp(1/12 %2) cos(%1), exp(- 1/12 %2) cos(%1), exp(- 1/12 %2) sin(%1)] 1/2 1/2 1/2 21 (- 46 + 12 30 ) x1 %1 := 1/12 ----------------------------- epsilon 1/2 1/2 1/2 21 (46 + 12 30 ) x1 %2 := --------------------------- epsilon > # Building a solution > > sum(evaln(A[i])*sol_list1[i],i=1..nops(sol_list1)); A[1] + A[2] x1 + A[3] exp(1/12 %2) sin(%1) + A[4] exp(1/12 %2) cos(%1) + A[5] exp(- 1/12 %2) cos(%1) + A[6] exp(- 1/12 %2) sin(%1) 1/2 1/2 1/2 21 (- 46 + 12 30 ) x1 %1 := 1/12 ----------------------------- epsilon 1/2 1/2 1/2 21 (46 + 12 30 ) x1 %2 := --------------------------- epsilon > # Checking the solution > > simplify(subs(q1[0](x1)=",eq111)); 0 > quit bytes used=20674804, alloc=1769148, time=31.63 PS: The procedure above is by no means generic. It solved the problem I had and similar, but there are differential equations where it didn't work so well. ------------------------------------------------ | Antonio Almeida | |----------------------------------------------| | LEMAC - Instituto Superior Tecnico | | Av. Rovisco Pais 1, 1096 Lisboa Codex | | Portugal | | Phone: (351) (1) 8417917 | | Fax: (351) (1) 8414045 | | e-mail: aalmeida@lemac18.lemac.ist.utl.pt | | dsc31_01@beta.ist.utl.pt | ------------------------------------------------ From maple_gr@daisy.uwaterloo.ca Tue Feb 28 14:36:50 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA27383; Tue, 28 Feb 95 14:36:50 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.9/8.6.9) id JAA17812 for maple-list-outgoing; Tue, 28 Feb 1995 09:53:19 -0500 Message-Id: <199502281453.JAA17812@daisy.uwaterloo.ca> From: "Sean P. DeMerchant" Subject: [MUG] Re: Enhancing a Package To: Joe Riel Date: Mon, 27 Feb 1995 19:22:27 -0800 (PST) Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: "Sean P. DeMerchant" Joe, If you wish to see any Maple file [or almost any, kernel bases functions not included] use the following example as a guideline: [The big secret is the interface command] |\^/| Maple V Release 3 (University of Washington) ._|\| |/|_. Copyright (c) 1981-1994 by Waterloo Maple Software and the \ MAPLE / University of Waterloo. All rights reserved. Maple and Maple V <____ ____> are registered trademarks of Waterloo Maple Software. | Type ? for help. Warning, `ODE` is implicitly declared local Warning, `out` is implicitly declared local > interface(verboseproc=2); > print(linalg); table([ vectdim = readlib('linalg/vectdim') ref = readlib('linalg/gausselim') crossprod = readlib('linalg/crossprod') definite = readlib('linalg/definite') eigenvals = readlib('linalg/eigenvals') eigenvects = readlib('linalg/eigenvect') ... rowdim = readlib('linalg/rowdim') coldim = readlib('linalg/coldim') ]) > print(plots); table([ tubeplot = readlib('plots/tubeplot') contourplot = readlib('plots/contplot') setoptions = readlib('plots/setoptions') conformal = readlib('plots/conformal') ... sparsematrixplot = readlib('plots/smplot') textplot3d = readlib('plots/textplot3d') ]) hope this helps, Sean ------------------------------------------------------------------------------ Sean DeMerchant seandee@ms.washington.edu ------------------------------------------------------------------------------ From maple_gr@daisy.uwaterloo.ca Thu Mar 2 16:47:49 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA09194; Thu, 2 Mar 95 16:47:49 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.9/8.6.9) id KAA21462 for maple-list-outgoing; Thu, 2 Mar 1995 10:17:34 -0500 Message-Id: <199503021517.KAA21462@daisy.uwaterloo.ca> From: Joe Riel Subject: [MUG] Factoring Expressions To: maple-list@daisy.uwaterloo.ca (Maple User Group) Date: Wed, 1 Mar 1995 13:54:05 -0800 (PST) Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Joe Riel Recently a MUG'r asked whether it is possible to factor integers from an expression. Normally this isn't possible because Maple will automatically distribute an integer factor over a sum, however, the following trick can be used (I saw this in the ifactor routine), A very crude factoring routine which serves to illustrate the trick: fact := proc(p) local i,g; if not type(p,`+`) then RETURN(p) fi; g := op(1,p); for i in p do g := gcd(g,i) od; if g <> 1 then ``(g)*factor(p/g) else p fi end: Now we can apply it to an expression, fact(5*x+5); (5) (x + 1) The trick is that the blank function, ``() is being used to prevent Maple from distributing the integer over the sum. If you want to return the expression to the usual form, do the following, subs(`` = , "): "; 5 x + 5 Joe Riel From maple_gr@daisy.uwaterloo.ca Thu Mar 2 19:37:54 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA10181; Thu, 2 Mar 95 19:37:54 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.9/8.6.9) id KAA21448 for maple-list-outgoing; Thu, 2 Mar 1995 10:17:31 -0500 Message-Id: <199503021517.KAA21448@daisy.uwaterloo.ca> From: Robert Israel Subject: [MUG] Re: Solving a Second Order ODE To: maple-list@daisy.uwaterloo.ca Date: Wed, 1 Mar 95 13:25:10 -0800 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Robert Israel Tailan Chi wrote (in the corrected version of the question): > The basic form of the differential equation looks as follows. > y"(x) + p(x)y'(x) + q(x)y(x) = r(x) > where y(x) must satisfy y(0) = alpha, y(x*) = f(x*) and y'(x*) = f'(x), with > alpha being a constant, and x* being the other boundary and f(x*) being a > known function of x. Let yp be a particular solution of the DE with y(0) = alpha. Let y1 be a solution of the homogeneous DE y" + p y' + q y = 0 with y1(0) = 0 and y1'(0) <> 0. Both of these are available in Maple, either explicitly or as numerical procedures. Moreover, you can also get the derivatives of these functions, even if the solution is numeric, by writing the DE's as systems: y'=v, v' = r - p v - q y. Now the solution you want is of the form y = yp + A y1 for some constant A. You want to satisfy: yp(x*) + A y1(x*)= f(x*) and yp'(x*) + A y1'(x*) = f'(x*). Think of this as a system of two equations in the unknowns A and x*. You probably can't solve it symbolically, but it should work out numerically (barring pathological cases). fsolve should be able to do it. Note that you probably will want to tell Maple how to differentiate yp, y1 and their derivatives, and you can do this by defining functions `diff/yp` etc. Robert Israel israel@math.ubc.ca Department of Mathematics University of British Columbia Vancouver, BC, Canada V6T 1Y4 From israel@math.ubc.ca Fri Mar 3 11:00:58 1995 Received: from galois.math.ubc.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA13668; Fri, 3 Mar 95 11:00:58 -0800 Date: Fri, 3 Mar 95 11:00:58 -0800 From: Robert Israel Received: by galois.math.ubc.ca id AA18991; Fri, 3 Mar 95 11:05:03 PST Message-Id: <9503031905.AA18991@galois.math.ubc.ca> To: lopez@nextwork.rose-hulman.edu Subject: Re: [MUG] Re: Solving a Second Order ODE In-Reply-To: Mail from 'Robert Lopez ' dated: Fri, 3 Mar 1995 09:54:40 -0500 Cc: israel Status: RO Robert, Yes, there is an existence question. There will certainly be some functions f(x) for which second order contact is impossible, and others for which it is possible. The number of conditions (3) is not really significant, because there is the extra degree of freedom in x*. So, when a solution does exist, it can be stable under smooth perturbations of f and the DE. e.g. take the DE y'' + y = 0, initial condition y(0) = 0, f(x) = 1. y = A sin(x) has second-order contact with f(x) when A = 1, x* = Pi/2. Make a sufficiently small, smooth change in f(x) or the DE and there still should be solutions (by some sort of Implicit Function Theorem argument). E.g. take f(x) = 1 + a x where a is small, and you have to solve the equations A sin(x*) = 1 + a x* A cos(x*) = a Two equations in A, x* and a. > with(linalg): > eq1:= A * sin(x) - 1 - a*x: > eq2:= A * cos(x) - a: > det(jacobian([eq1,eq2],[A,x])); 2 2 - sin(x) A - A cos(x) + cos(x) a > eval(subs(A=1, x=Pi/2, a=0, ")); -1 Since this is not 0, the solution exists for a in a neighbourhood of 0. (Actually I think it does for all a). Robert Robert Israel israel@math.ubc.ca Department of Mathematics University of British Columbia Vancouver, BC, Canada V6T 1Y4 From maple_gr@daisy.uwaterloo.ca Mon Mar 6 17:19:50 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA28341; Mon, 6 Mar 95 17:19:50 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.9/8.6.9) id PAA13326 for maple-list-outgoing; Mon, 6 Mar 1995 15:08:13 -0500 Message-Id: <199503062008.PAA13326@daisy.uwaterloo.ca> From: haraldp@haydn.uwaterloo.ca Subject: [MUG] Maple-Integration To: maple-list@daisy.uwaterloo.ca Date: Sun, 05 Mar 95 13:39:01 -0100 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: haraldp@haydn.uwaterloo.ca Hi MUG, Could anyone please tell me why Maple doesn't evaluate the following integral after assumption has been made. What should I do to get Maple to evaluate the correct answer: 1/(n-1)? -------------------------------------------------------------------------------- > F:=Int(x^ (-n),x=1..infinity)=int(x^ (-n),x=1..infinity); infinity / (- n + 1) | (- n) x 1 F := | x dx = limit ---------- + ----- | x -> infinity- - n + 1 n - 1 / 1 -------------------------------------------------------------------------------- > assume (n>1); -------------------------------------------------------------------------------- > value(rhs(F)); (- n~ + 1) x 1 limit ----------- + ------ x -> infinity- - n~ + 1 n~ - 1 -------------------------------------------------------------------------------- Cheers, Harald Pleym ################################################################### # # # Harald Pleym Department of Environmental Technology # # Associate Professor Telemark Institute of Technology # # 3900 PORSGRUNN # # NORWAY # # # # e-mail: haraldp@tmih.no # # Fax: -47-35-557547 # ################################################################### From maple_gr@daisy.uwaterloo.ca Tue Mar 7 16:23:31 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA04588; Tue, 7 Mar 95 16:23:31 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.9/8.6.9) id JAA19300 for maple-list-outgoing; Tue, 7 Mar 1995 09:52:17 -0500 Message-Id: <199503071452.JAA19300@daisy.uwaterloo.ca> From: Keith Geddes Subject: [MUG] Re: Forcefactoring To: maple-list@daisy.uwaterloo.ca Date: Mon, 6 Mar 1995 15:23:34 -0800 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Keith Geddes > >> From: Joe Riel > > Using the method of the blank function which I pointed out in a previous > post (sorry for the multiple postings but I had lost this thread), > one can implement the forcefactor routine as, > > forcefactor := (p,q) -> ``(q)*expand(p/q): > > This works with integers and integer fractions for q, which the other > routines I have seen do not. > > forcefactor(x/3+a, 1/3); > > (1/3) (x + 3 a) > > expand("); > > 1/3 x + a > > > The part I haven't quite figured out is why does expand work? Is the > blank function known by expand? > > Joe Riel Yes, the blank function is known by expand. The source file for this looks like: `expand/` := proc() args end: In other words, applying expand to the null-string function ``(x) simply returns the argument(s). So applying expand to ``(x) * ``(y) yields x * y . Keith Geddes From maple_gr@daisy.uwaterloo.ca Fri Mar 10 16:39:41 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA25852; Fri, 10 Mar 95 16:39:41 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.9/8.6.9) id OAA09107 for maple-list-outgoing; Fri, 10 Mar 1995 14:43:34 -0500 Message-Id: <199503101943.OAA09107@daisy.uwaterloo.ca> From: sowell@unomaha.edu (Glenn Sowell) Subject: [MUG] Bug in dsolve To: maple_group@daisy.waterloo.edu Date: Fri, 10 Mar 1995 08:37:55 +0600 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: sowell@unomaha.edu (Glenn Sowell) First, let me show you something that works. Take a generic, first-order, linear, homogeneous ODE : > deq1 := diff( y(x), x ) + P(x)*y(x) = 0; / d \ deq1 := |---- y(x)| + P(x) y(x) = 0 \ dx / > sol1 := dsolve( deq1, y(x) ); / | sol1 := y(x) = exp(- | P(x) dx) _C1 | / > sol2 := dsolve( { deq1, y(x0)=y0 }, y(x) ); x / | sol2 := y(x) = exp(- | P(u) du) y0 | / x0 This is just what we would expect. I like the way Maple clearly shows the integrating factor. Now for the problem--Consider the inhomogeneous case. Maple does fine on the general solution, but fails on the case with the initial condition. > deq := diff( y(x), x ) + P(x) * y(x) = Q(x); / d \ deq := |---- y(x)| + P(x) y(x) = Q(x) \ dx / > sol1 := dsolve( deq, y(x) ); / / / / | | | | sol1:=y(x)=exp(- | P(x) dx) | exp(| P(x) dx) Q(x) dx + exp(- | P(x) dx) _C1 | | | | / / / / # This is correct. The problem is in trying to use dsolve() with initial # conditions > > sol2 := dsolve( { deq, y(x0)=y0 }, y(x) ); x x x x / / / / | | | | sol2:=y(x)=exp(- | Q(u) du) exp(| Q(u) du) | Q(u) du + exp(- | Q(u) du) y0 | | | | / / / / x0 x0 x0 x0 -------------------------------------------------------------------------------- # What happened to the P's? And how did the exponential factor get pulled # out of the real Q integral? # Any ideas? As always, thanks for the information. Glenn Sowell sowell@unomaha.edu Dept. of Physics University of Nebraska at Omaha Omaha, NE 68182-0266 USA (402) 554-3724 From maple_gr@daisy.uwaterloo.ca Fri Mar 10 17:10:53 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA26927; Fri, 10 Mar 95 17:10:53 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.9/8.6.9) id OAA09120 for maple-list-outgoing; Fri, 10 Mar 1995 14:43:57 -0500 Message-Id: <199503101943.OAA09120@daisy.uwaterloo.ca> From: Maple Group Subject: [MUG] Reordering factors To: maple-list@daisy.uwaterloo.ca Date: Fri, 10 Mar 1995 14:42:57 -0500 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Maple Group >From: Malcolm Brooks (msb@ise.canberra.edu.au) > >Joe Riel and others have been posting items on forcefactoring recently. I >have a similar cosmetic problem which I have been unable to solve using >various methods they have suggested, particularly the blank function idea. > >Basically, I want to rewrite Expression A as A Expression. For example >the solution to y'=2xy comes back as y(x) = e^(x^2) _C1 and I want to >rewrite the rhs as _C1 e^(x^2). ============= There are only two ways you can change the order of a Maple expression. (No claims to elegance here, but it may help) The first is that when the expression is created for the first time in the Maple session, you create it in the order you want. You can do this (hack) by putting at the beginning of your Maple session good := _C1*exp(x^2): Now whenever exp(x^2)*_C1 is created, it will be simplified to _C1*exp(x^2) Hence ru7:4109> maple |\^/| Maple V Release 3 (Ren. Stud. Sublic ETH) ._|\| |/|_. Copyright (c) 1981-1994 by Waterloo Maple Software and the \ MAPLE / University of Waterloo. All rights reserved. Maple and Maple V <____ ____> are registered trademarks of Waterloo Maple Software. | Type ? for help. > good := _C1*exp(x^2): > dsolve( diff(y(x),x)=2*x*y(x), y(x) ); 2 y(x) = _C1 exp(x ) The second way is to use sort. Sort is the only command that will reorder the terms in an expression. Note, you can't move the _C2 infront of a Maple constant like sqrt(2). ru7:4111> rmaple Research version /home/rutishauser/ru2/maple/internal/bin.sun10/mapleV |\^/| Maple V Research (Unregistered Version) ._|\| |/|_. Copyright (c) 1981-1994 by Waterloo Maple Software and the \ MAPLE / University of Waterloo. All rights reserved. Maple and Maple V <____ ____> are registered trademarks of Waterloo Maple Software. | Type ? for help. > dsolve( diff(y(x),x)=2*x*y(x), y(x) ); 2 y(x) = exp(x ) _C1 > sort(",[_C1,exp(x^2)]); 2 y(x) = _C1 exp(x ) Mike >From maple_gr@daisy.uwaterloo.ca Fri Mar 10 10:46:47 1995 Received: from epsilon.qmw.ac.uk (epsilon.qmw.ac.uk [138.37.6.3]) by daisy.uwaterloo.ca (8.6.9/8.6.9) with SMTP id KAA29274 for ; Fri, 10 Mar 1995 10:46:22 -0500 Received: from laplace.maths.qmw.ac.uk by epsilon.qmw.ac.uk with SMTP-DNS (PP) id <18368-0@epsilon.qmw.ac.uk>; Fri, 10 Mar 1995 15:45:17 +0000 Received: from euclid.maths.qmw.ac.uk by laplace.maths.qmw.ac.uk; Fri, 10 Mar 95 15:44:16 GMT From: Francis J Wright Date: Fri, 10 Mar 95 15:47:07 GMT Message-Id: <29376.9503101547@euclid.maths.qmw.ac.uk> To: maple-list@daisy.uwaterloo.ca In-Reply-To: <199503091451.JAA25657@daisy.uwaterloo.ca> (MalcolmB@oak.canberra.edu.au) Subject: Re: [MUG] Reordering factors Status: RO > From: Malcolm Brooks (msb@ise.canberra.edu.au) > > Basically, I want to rewrite Expression A as A Expression. For example > the solution to y'=2xy comes back as y(x) = e^(x^2) _C1 and I want to > rewrite the rhs as _C1 e^(x^2). I think that the only reliable way to stop Maple from essentially randomly commuting products is to express them in terms of &*, which itself is not very pretty (in my opinion). Dr Francis J. Wright School of Mathematical Sciences | Email: F.J.Wright@QMW.ac.uk Queen Mary & Westfield College | Telephone: +44 171-975 5453 (direct) Mile End Road, London E1 4NS, UK | Fax: +44 181-981 9587 (dept.) From maple_gr@daisy.uwaterloo.ca Mon Mar 13 16:46:20 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA14572; Mon, 13 Mar 95 16:46:20 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.9/8.6.9) id LAA16559 for maple-list-outgoing; Mon, 13 Mar 1995 11:54:57 -0500 Message-Id: <199503131654.LAA16559@daisy.uwaterloo.ca> From: Yuri Muzychka Subject: [MUG] Re: Bug in dsolve To: maple-list@daisy.uwaterloo.ca Date: Sun, 12 Mar 1995 14:14:38 -0500 (EST) Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Yuri Muzychka Hi; Another curious bug in dsolve involves solving an ode with a mixed boundary condition. If you pass the ODE and the two conditions to dsolve you will get the solution but only when the initial or boundary conditions do not involve the the solution. ie try solving; ode:=diff(y(x),x,x)-m^2*y(x)=0 subject to; BC1:=D(y)(0)=1; BC2:=C*y(1)+D(y)(1)=0; dsolve({ode, BC1, BC2},y(x)); where C is a constant. Not that the problem is stated in a non-dimensioal form. It represents heat transfer from a fin. The problem arises when Maple tries to apply the second condition. You will get a solution which has y(1) appearing in it. Maple does not know how to handle this problem. I have not checked to see if the solution returned is correct if you place y(1) in the one returned by maple. ie take the correct solution evaluated at y(1) and substitute it. If on the other hand you solve the ode first then apply the conditions yourself and use solve to solve for the constants you will get the correct solution. sol:=dsolve(ode, y(x)); y(x):=unapply(rhs(sol),x); BC1:=y(0)=1; BC2:=D(y)(1)+C*y(1)=0; constants:=solve({BC1,BC2},{_C1,_C2}); assign(constants); y(x):=y(x); Its strange that maple's dsolve does not solve the ode first and then apply the conditions like you would by hand, in the example above. Anyone have any comments. Please note I have left out the output because I had no time to include the solution file for both cases. Yuri Muzychka (Grad Student) Microelectronics Heat Transfer Lab Thermal Engineering Group University of Waterloo From maple_gr@daisy.uwaterloo.ca Mon Mar 13 16:48:56 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA14818; Mon, 13 Mar 95 16:48:56 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.9/8.6.9) id LAA16534 for maple-list-outgoing; Mon, 13 Mar 1995 11:54:47 -0500 Message-Id: <199503131654.LAA16534@daisy.uwaterloo.ca> From: "Riel, Joseph" Subject: [MUG] RE: Reordering factors To: maple-list Date: Fri, 10 Mar 95 17:51:00 PST Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: "Riel, Joseph" > From: Malcolm Brooks (msb@ise.canberra.edu.au) > > Basically, I want to rewrite Expression A as A Expression. For example > the solution to y'=2xy comes back as y(x) = e^(x^2) _C1 and I want to > rewrite the rhs as _C1 e^(x^2). > I'm sure there's something very simple that I'm missing. Anyone care to > enlighten me please? > I do not know an elegant way to accomplish this. The sort function appears to be useable, but is limited and the help screens do not not adequately document its limitations. Following are a pair of functions which might accomplish what you want, normsort attempts to reorder a product so that the strings appear before functions; it has problems with sums in products. The basic idea comes from the observation that sort(x*y, [y,x]) ; y*x --------------------------------------------------- normsort := proc(x) if type(x,'string') then x elif type(x,`+`) then map(normsort,x) elif type(x,`*`) then map(proc(x) if type(x,`^`) then op(1,x) else x fi end, [op(x)]); select(<(not type(x,{'numeric',`+`}))|x>,"); sort(x,sort(", normorder)) fi end: normorder := proc(a,b) if type(a,'name') then true elif type(b,'name') then false else true fi end: > y := exp(x)*a; exp(x)*a > normsort(y); a*exp(x) > y; a*exp(x) Joe Riel From maple_gr@daisy.uwaterloo.ca Tue Mar 14 13:16:24 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA22260; Tue, 14 Mar 95 13:16:24 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.9/8.6.9) id JAA11893 for maple-list-outgoing; Tue, 14 Mar 1995 09:28:27 -0500 Message-Id: <199503141428.JAA11893@daisy.uwaterloo.ca> From: Joe Riel Subject: [MUG] Re: Reordering factors To: maple-list@daisy.uwaterloo.ca Date: Mon, 13 Mar 1995 13:20:17 -0800 (PST) Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Joe Riel As Michael Monagan (I presume) explained there are two ways to arrange an expression, create it that way or sort it. A useful trick for rearranging an existing expression which cannot be sorted, for example a product of sums, is to convert the expression to a list, sort the list, substitute a new name for one of the variables, and then convert the list back to an expression. y := (a+b)*(c+d); y := (a+b)(c+d) we want to swap the terms of the product. map(op, [2,1], "); [c+d,a+b] subs(a=A, "); [c+d,A+b] convert(",`*`); (c+d)(A+b) If changing a name is undesireable there are a few other options, one is to use the null-string, ``*(c+d)*(a+b); (c+d)(a+b) however, this is chiefly cosmetic and may cause problems later on. Another possibility is to convert the expression to a list, delete all references to the expression [may be impossible], garbage collect, and then rebuild the expression from the list in the desired sequence. restart: y := (a+b)*(c+d); y := (a+b)(c+d) y := map(op, [2,1], "); y := [c+d,a+b] ":":gc(): y := convert(y,`*`); y := (c+d)(a+b) Joe Riel From maple_gr@daisy.uwaterloo.ca Mon Mar 20 15:20:00 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA23714; Mon, 20 Mar 95 15:20:00 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.9/8.6.9) id KAA21270 for maple-list-outgoing; Mon, 20 Mar 1995 10:13:18 -0500 Message-Id: <199503201513.KAA21270@daisy.uwaterloo.ca> From: JANTZEN@ucis.vill.edu (Bob Jantzen, drbob, or ms_ani) Subject: [MUG] animating sinusoidally parametrized curves to large arguments To: MUG@daisy.uwaterloo.ca Date: Sun, 19 Mar 1995 13:30 EST Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: JANTZEN@UCIS.VILL.EDU (Bob Jantzen, drbob, or ms_ani) I am doing an undergraduate seminar using MAPLE to explore mathematics, and in analyzing a coupled oscillator system in two dependent variables, I both plotted and animated the solution curve in the space of these two variables. I wanted the students to see the difference between periodic behavior where the two independent frequencies have a rational number ratio, and aperiodic behavior where this ratio is irrational. However, I noticed that for large values of the independent variable, the plots and animation get very crude, showing a smaller number of points plotted and connected by straight lines for each interval of time comparable to the larger of the two periods involved. The following example shows what I mean. Just take a simple parametrized circle and animate it for many revolutions. Since I have no idea how MAPLE is doing the animation, I have no idea about coaxing it to improve the results. I am sure someone in the user's group does know and could enlighten the rest of us. [I am using Release 3 for Windows on a PC.] > x:= t-> cos(t); y -> sin(t); > animate([x(s*u),y(s*u),s=0..1], u=0..60, frames=60, scaling=true, color=black); Animating curves seems to be not only fun, but also useful in visualizing certain results. Yet there seem to be few examples in my big selection of books on MAPLE which really use this command effectively and provide helpful hints for extending it to other similar types of applications. To animate a given parametrized curve for a given interval a<= t <= b , I just use a linear parametrization of the interval [a,u] in terms of a parameter s running between 0 and 1, where u is the animation parameter and s parametrizes the curve plotted within a given frame. This was the most naive way I could think of animating a parametrized curve. thanks for any input, Bob Jantzen Villanova University (in western suburb of Philadelphia) jantzen@ucis.vill.edu dept of math sciences\ 800 lancaster ave\ villanova university\ villanova, pa 19085-1699 usa From maple_gr@daisy.uwaterloo.ca Mon Mar 20 15:35:14 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA23816; Mon, 20 Mar 95 15:35:14 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.9/8.6.9) id KAA21310 for maple-list-outgoing; Mon, 20 Mar 1995 10:13:42 -0500 Message-Id: <199503201513.KAA21310@daisy.uwaterloo.ca> From: Preben Als Holm Subject: [MUG] Curious D-behavior To: maple_gr@daisy.uwaterloo.ca Date: Mon, 20 Mar 1995 10:21:45 +0100 (MET) Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Preben Als Holm Can anyone explain the following rather curious behavior of the differential operator D: h:= t -> f(3*t): D(h); t -> 3D(f)(3t) f:=g: D(h); D(h) I had hoped for the response to 'D(h);' the response we get from: unapply( diff( h(t),t), t); t -> 3D(g)(3t) Preben Alsholm IFAK, Bygning 377 The Technical University of Denmark DK 2800 Lyngby, Denmark From maple_gr@daisy.uwaterloo.ca Tue Mar 21 15:05:01 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA29205; Tue, 21 Mar 95 15:05:01 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.9/8.6.9) id JAA01568 for maple-list-outgoing; Tue, 21 Mar 1995 09:58:35 -0500 Message-Id: <199503211458.JAA01568@daisy.uwaterloo.ca> From: Francis J Wright Subject: [MUG] Re: Curious D-behavior To: maple-list@daisy.uwaterloo.ca, diakpa@unidhp.uni-c.dk Date: Tue, 21 Mar 95 10:40:52 GMT Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Francis J Wright > >> From: Preben Als Holm > > Can anyone explain the following rather curious behavior of the > differential operator D: I think the answer is that procedure bodies are not fully evaluated, so that the assignment to f has no effect. One solution is to substitute for f, which does work. This is a trick that is used quite a lot in the Maple library code. > h := t -> f(3*t); h := t -> f(3 t) > f := g; f := g > eval(h); # No change t -> f(3 t) > f := 'f': H := subs(f=g, eval(h)); # But this works H := t -> g(3 t) > D(H); t -> 3 D(g)(3 t) Dr Francis J. Wright School of Mathematical Sciences | Email: F.J.Wright@QMW.ac.uk Queen Mary & Westfield College | Telephone: +44 171-975 5453 (direct) Mile End Road, London E1 4NS, UK | Fax: +44 181-981 9587 (dept.) From maple_gr@daisy.uwaterloo.ca Thu Mar 23 17:32:39 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA10197; Thu, 23 Mar 95 17:32:39 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.9/8.6.9) id NAA19099 for maple-list-outgoing; Thu, 23 Mar 1995 13:26:28 -0500 Message-Id: <199503231826.NAA19099@daisy.uwaterloo.ca> From: Preben Als Holm Subject: [MUG] Curious D-behavior II To: maple-list@daisy.uwaterloo.ca Date: Thu, 23 Mar 1995 14:54:06 +0100 (MET) Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Preben Als Holm Since my last inquiry about the D-operator I have run into the following rather puzzling behavior: h:= t -> f(3*t, g(t)): D("); # OK t -> 3 D[1](f)(3t,g(t))+D[2](f)(3t,g(t)) D(g)(t) D("); # NOT OK Error, (in D/procedure) univariate operand h1:=D(h): D("); # Not OK Error, (in D/procedure) univariate operand D(h1); # Surprise! OK t -> 9 D[1,1](f)(3t,g(t))+3 etc. etc... alias(); # Another (but unrelated) surprise I, diff1, int1 The behavior is the same if the function g is made concrete. Any comments are appreciated. Preben Alsholm IFAK, Bygning 377 The Technical University of Denmark DK 2800 Lyngby, Denmark From maple_gr@daisy.uwaterloo.ca Mon Mar 27 16:42:37 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA27742; Mon, 27 Mar 95 16:42:37 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.9/8.6.9) id KAA04252 for maple-list-outgoing; Mon, 27 Mar 1995 10:32:48 -0500 Message-Id: <199503271532.KAA04252@daisy.uwaterloo.ca> From: Robert Israel Subject: [MUG] Re: Equations involving algebraic numbers To: maple-list@daisy.uwaterloo.ca Date: Mon, 20 Mar 95 15:41:55 -0800 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Robert Israel >> From: Robert Israel Lawrence Lohr wrote: > I have > obtained the solutions for a number of equations with each solution y:=f(x) > containing the familiar "RootOf" expression, inside of which are > coefficients which are various trigonimetric functions of the variable > x. Although each solution y can be evaluted numerically for selected > values of the variable x, I have not been able to plot the functions over > any range of x. How do I convert my equations containing "RootOf" > expressions to forms which can be graphed! One thing you can do is to substitute "fsolve" for "RootOf". For example: > y:= RootOf(y + tan(y)=x, y); y := RootOf(_Z + tan(_Z) - x) > plot(subs(RootOf=fsolve, y), x=0..1); 2.25 AA | AAAA | AAAA | AAAA | AAA 2.2 AAA | AAA | AAAA | AAAA 2.15 AAAAA | AAAA | AAAA | AAAA | AAAA 2.1 AAAA | AAAA | AAAA | AAAAA | AAAA 2.05 AAAAA | AAAAAA ***------------+--------------+-------------+--------------+--------------+ 0 0.2 0.4 x 0.6 0.8 1 One problem with this is that when (as in this case) there are several branches of the solution, you don't know which branch you're going to get. A partial solution is to specify an interval in which you want the solution to be. > f01:= t -> fsolve(t, _Z, _Z=0..1); > plot(subs(RootOf=f01, y), x=0..1); | AA | AAAA | AAAA 0.4 AAAA | AAAA | AAAA | AAAA | AAAA 0.3 AAAA | AAAA | AAAA | AAAA 0.2 AAAA | AAA | AAA | AAAA | AAAA 0.1 AAAA | AAAA | AAAA | AAAA 0 **-------------+--------------+-------------+--------------+--------------+ 0 0.2 0.4 x 0.6 0.8 1 Hope this helps. Robert Israel israel@math.ubc.ca Department of Mathematics University of British Columbia Vancouver, BC, Canada V6T 1Y4 From maple_gr@daisy.uwaterloo.ca Tue Mar 28 14:22:30 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA04368; Tue, 28 Mar 95 14:22:30 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.9/8.6.9) id IAA23523 for maple-list-outgoing; Tue, 28 Mar 1995 08:49:55 -0500 Message-Id: <199503281349.IAA23523@daisy.uwaterloo.ca> From: Joe Riel Subject: [MUG] Re: Bug in 'coeff' To: maple-list@daisy.uwaterloo.ca Date: Mon, 27 Mar 1995 20:15:37 -0800 (PST) Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Joe Riel Dear Stanley, Excuse the extreme lateness of this reply, I kept your posting because it appeared interesting and was just wading through some old e-mail when it popped out. Your solution seems dangerous, I'm not sure it would be wise to modify the coeff routine. I suspect that it is a built-in function for good reason, probably to speed up performance. A less drastic modification is to change the laplace routine, specifically `laplace/transfct` so that it collects the terms before calling coeff. This can be done by changing the second statement in `laplace/transfct` to, # changed line, was u := op(1,expr); u := collect(op(1,expr),t); I wasn't aware that it was possible to redefine built-in procedures in the way you outlined, this is especially useful for "tracing" those functions, i.e. determining their arguments when an error occurs. Thanks for the post. Joe Riel > > >> From: Stanley Houghton > > BUG IN BUILT-IN ROUTINE: COEFF > > We have a problem than initially arose in Laplace transforms. We > have tracked it down to the routine `coeff` and even have a > work-round to offer! > > If you call > > coeff(a*(t+b),t,1) > or > coeff(a*(t+b),t,0) > > it fails with the message "unable to compute coeff". If we replace a > by a numerical value, both work without a problem. > > We tried the usual uses of 'assume', of course, but without success. > > It is cured if we expand the first parameter to coeff using the following > patch: > > unprotect(coeff); > coeff:= > proc( ) > proc( ) options builtin; 65 end (expand(args[1]),args[2..nargs]) > end; > protect(coeff); > > If we now repeat the above attempt, it works correctly yielding values > > a > and > a*b > > respectively as you would expect. > > > > We actually encountered the problem trying to evaluate a laplace > transform of the expression > > sin(a*t)*Heaviside(t-Pi) > > This is equivalent to the transform of > > sin(a*(t+Pi)) > > which fails as above when Maple tries to find the coefficient of t (ie a) > and the constant term (a*Pi). > > I hope this helps. Until we have a new version of 'coeff', we can manage > with the redefinition (work-round). > > Merry Christmas and all the best for 1995 > > Stan Houghton > > > > PS I will forward this on to Waterloo and the MUG to ensure that they > are aware of it. > > > From maple_gr@daisy.uwaterloo.ca Fri Mar 31 18:31:09 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA07927; Fri, 31 Mar 95 18:31:09 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.9/8.6.9) id MAA07110 for maple-list-outgoing; Fri, 31 Mar 1995 12:46:17 -0500 Message-Id: <199503311746.MAA07110@daisy.uwaterloo.ca> From: JANTZEN@ucis.vill.edu (Bob Jantzen, drbob, or ms_ani) Subject: [MUG] limits of piecewise continuous functions: cannot evaluate Boolean To: MUG@daisy.uwaterloo.ca Date: Fri, 31 Mar 1995 11:29 EST Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: JANTZEN@UCIS.VILL.EDU (Bob Jantzen, drbob, or ms_ani) This is a calculus teaching problem: If one defines a piecewise continuous function of one variable > f:= x -> if x<=1 then x^2 else 2*x+1 fi; and try to evaluate its limit at any input value, > limit(f(x),x= 0); you get "Error, cannot evaluate Boolean". Is there a way to overcome this? [The same thing happens if you plot the function and use its value and a variable rather than its name, [use "plot(f,0..2);" instead of "plot(f(x),x=0..2);"] as I was just reading in the rather nice and very recent Brooks Cole book 1995 CalcLabs for Maple V by Boggess and 7 friends, but the name call fixes that.] thanks bob jantzen math sciences villanova university near philly From maple_gr@daisy.uwaterloo.ca Tue Apr 4 20:32:02 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA28942; Tue, 4 Apr 95 20:32:02 -0700 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.9/8.6.9) id PAA13437 for maple-list-outgoing; Tue, 4 Apr 1995 15:43:44 -0400 Message-Id: <199504041943.PAA13437@daisy.uwaterloo.ca> From: Jonathan Thornburg Subject: [MUG] Maple V Release 3 still has sqrt() sign bugs To: maple-list@daisy.uwaterloo.ca Date: Tue, 4 Apr 1995 01:10:01 -0700 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Jonathan Thornburg Prior to Maple V Release 3, Maple sometimes made the transformation sqrt(x) --> I*sqrt(-x) even though this isn't always valid. Maple V Release 3 was supposed to fix this, and only make such transformations if they could be proved correct. Unfortunately, it seems the transformations are sometimes still being made incorrectly. Consider the following Maple input file: ==================== # Maple input file to demonstrate sqrt() sign problems # fact := 1 - sin(theta)^2 * sin(phi)^2; B31 := sin(phi) * cos(phi) / sqrt(fact); temp1 := diff(B31, phi); temp2 := simplify(temp1); # these two results should be the same # ... but they come out different! result1 := simplify(subs(phi=0, temp1)); result2 := simplify(subs(phi=0, temp2)); ==================== Notice that the two final results should be the same. However, as the comments indicate, they are computed as different! Using Maple V Release 3 on a Sun 4/25 running SunOS 4.1.3, we have: ==================== Script started on Mon Apr 3 15:02:37 1995 % maple |\^/| Maple V Release 3 (University of British Columbia) ._|\| |/|_. Copyright (c) 1981-1994 by Waterloo Maple Software and the \ MAPLE / University of Waterloo. All rights reserved. Maple and Maple V <____ ____> are registered trademarks of Waterloo Maple Software. | Type ? for help. > read `sqrt.sign.bug3.in`; 2 2 fact := 1 - sin(theta) sin(phi) sin(phi) cos(phi) B31 := ------------------------------ 2 2 1/2 (1 - sin(theta) sin(phi) ) 2 2 cos(phi) sin(phi) temp1 := ------------------------------ - ------------------------------ 2 2 1/2 2 2 1/2 (1 - sin(theta) sin(phi) ) (1 - sin(theta) sin(phi) ) 2 2 2 sin(phi) cos(phi) sin(theta) + ------------------------------- 2 2 3/2 (1 - sin(theta) sin(phi) ) bytes used=1000116, alloc=786288, time=2.42 temp2 := - 4 2 2 4 2 2 I (- cos(phi) - 2 cos(theta) cos(phi) + cos(phi) cos(theta) + cos(theta) ) ------------------------------------------------------------------------------- 2 2 2 2 3/2 (- cos(phi) - cos(theta) + cos(theta) cos(phi) ) result1 := 1 result2 := -1 > quit(); bytes used=1210904, alloc=786288, time=3.12 % exit script done on Mon Apr 3 15:03:01 1995 ==================== Notice that the two results are different! ( result1 is correct; result2 is wrong.) The I factor in the numerator of temp2 strongly suggests that the problem is indeed an erronious sqrt(x) --> I*sqrt(-x) transformation. (If theta and phi are real, then 0 <= fact <= 1 and hence all the expressions in this computation should be real.) I have tried to use the new assume() facility to tell Maple more about what's going on here, but to no avail: - The results are unchanged by saying assume(theta, real); assume(phi, real); before starting the calculation. - The results are unchanged by using simplify(..., assume=real) instead of simplify() . - The results are unchanged by saying assume(fact, RealRange(0,1)); just after fact is computed. For the nonce I have a workaround for the problem [use sqrt(abs(...)) instead of sqrt(...) ], but this is clearly a kludge. Is my Maple broken, or is this bug really still present in V.3? And if so, are there any tricks I can play with the assume facility to work around it in a nicer manner? - Jonathan Thornburg University of British Columbia / Physics Dept / "In a study of schoolboys, an educator discovered a correlation between size of feet and quality of handwriting. The boys with the larger feet were, on the average, older." Wallis/Roberts, "The Nature of Statistics" From maple_gr@daisy.uwaterloo.ca Tue Apr 4 21:59:46 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA29906; Tue, 4 Apr 95 21:59:46 -0700 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.9/8.6.9) id PAA13657 for maple-list-outgoing; Tue, 4 Apr 1995 15:51:48 -0400 Message-Id: <199504041951.PAA13657@daisy.uwaterloo.ca> From: Maple Group Subject: [MUG] limits of piecewise continuous functions To: maple-list@daisy.uwaterloo.ca Date: Tue, 4 Apr 1995 15:43:19 -0400 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Maple Group -=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=- Date: Mon, 3 Apr 95 12:20:23 -0700 From: Robert Israel To: maple-list@daisy.uwaterloo.ca Subject: limits of piecewise continuous functions: cannot evaluate Boolean Bob Jantzen wrote: |> If one defines a piecewise continuous function of one variable |> > f:= x -> if x<=1 then x^2 else 2*x+1 fi; |> and try to evaluate its limit at any input value, |> > limit(f(x),x= 0); |> you get "Error, cannot evaluate Boolean". |> Is there a way to overcome this? Basically, "if" is not the best thing to use when doing calculus with piecewise continuous functions. Maple tries to evaluate the function at a symbolic argument "x", and can't decide whether "x<=1" is true or false. One thing you can do instead is to use the Heaviside function. > f:= x -> x^2 + Heaviside(x-1) * (2*x+1-x^2); > limit(f(x), x=0); 0 There's one complication: Maple has trouble with two-sided limits involving the Heaviside function at the point of discontinuity, but one-sided limits should work all right. Robert Israel israel@math.ubc.ca Department of Mathematics University of British Columbia Vancouver, BC, Canada V6T 1Y4 -=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=- Date: Mon, 3 Apr 1995 16:47:59 -0400 From: Dan Dubois To: jantzen@ucis.vill.edu Subject: limits of piecewise continuous functions: cannot evaluate Boolean Dear Dr. Jantzen: Thank you for your enquiry: > This is a calculus teaching problem: > If one defines a piecewise continuous function of one variable > > f:= x -> if x<=1 then x^2 else 2*x+1 fi; > and try to evaluate its limit at any input value, > > limit(f(x),x= 0); > you get "Error, cannot evaluate Boolean". > Is there a way to overcome this? >[...] The problem is due to Maple's order of evaluation. When invoking the following command for example: > plot(f(x),x=0..2); Maple first tries to calculate the value of f(x), before substituting the numeric value in for x. In the procedure, Maple cannot evaluate the if statement, as it cannot compare the size of x to 0. Thus the error message. As you've pointed out: plot('f(x)',x=0..2); and plot(f,0..2); will return the expected plot. In the case of limit, calls are being made to other procedures as well and delaying evaluation once is not sufficient. Delaying evaluation twice will give the correct result. Defining your conditional expression with the piecewise() command will allow you to evaluate the limit directly: |\^/| Maple V Release 3 (WMS - Internal Production Version) ._|\| |/|_. Copyright (c) 1981-1994 by Waterloo Maple Software and the \ MAPLE / University of Waterloo. All rights reserved. Maple and Maple V <____ ____> are registered trademarks of Waterloo Maple Software. | Type ? for help. > f:= x -> if x<=1 then x^2 else 2*x+1 fi; f := proc(x) options operator,arrow; if x <= 1 then x^2 else 2*x+1 fi end > readlib(piecewise): > g:=x->piecewise(x<=1, x^2, 2*x+1); 2 g := x -> piecewise(x <= 1, x , 2 x + 1) > limit(g(x),x= 0); 0 I hope this helps. Sincerely, Dan -- ***************************************************************** * Daniel Dubois Tech. Phone: (519) 747-2505 * * Waterloo Maple Software Alt. Phone: (519) 747-2373 * * Technical Support Manager FAX : (519) 747-5284 * ***************************************************************** * email: support@maplesoft.com (support issues) * * ddubois@maplesoft.com (personal address) * * www : http://www.maplesoft.com * ***************************************************************** -=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=- From: Preben Als Holm Subject: Re:Piecewise To: maple-list@daisy.uwaterloo.ca Date: Tue, 4 Apr 1995 10:48:41 +0200 (METDST) Curiously enough, I don't have to readlib piecewise as do Herbert I. Brown, Ferdinand Gleisberg and apparently Bob Jantzen. Starting a fresh worksheet I write f:= x -> piecewise(x<=1, x^2, 2*x+1); and limit(f(x),x=0); and plot(f, 0..2); work. No need for readlib(piecewise) on my machine (I use Windows). Incidentally, I don't have to readlib unassign either. Preben Alsholm IFAK, The Technical University of Denmark -=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=- Date: Tue, 04 Apr 1995 12:30:15 +0100 To: maple-list@daisy.uwaterloo.ca From: mi372@mluri.sari.ac.uk (Colin Birch) Subject: limits of piecewise continuous functions: cannot evaluate Boolean Dear MUG Thank-you for the helpful answers to this question from Bob Jantzen. I had been having a similar problem with integration. **************************************************************************** ************** >>> From: JANTZEN@UCIS.VILL.EDU (Bob Jantzen, drbob, or ms_ani) >If one defines a piecewise continuous function of one variable > >> f:= x -> if x<=1 then x^2 else 2*x+1 fi; > >and try to evaluate its limit at any input value, > >> limit(f(x),x= 0); > >you get "Error, cannot evaluate Boolean". >Is there a way to overcome this? **************************************************************************** ******** #This is Bob Jantzen's original function: > f1 := x -> if x<=1 then x^2 > else 2*x+1 > fi; f1 := proc(x) options operator,arrow; if x <= 1 then x^2 else 2*x+1 fi end #This is the integration version of his problem > evalf(int(f1(x), x=0..2)); Error, (in f1) cannot evaluate boolean #Here is the piecewise version of his function > readlib(piecewise): > f2 := x -> piecewise(-1, x<=1, x^2, 2*x+1); 2 f2 := x -> piecewise(-1, x <= 1, x , 2 x + 1) #Unfortunately piecewise does not work for this integration: > evalf(int(f2(x), x=0..2)); Error, (in evalf/int) unexpected form of result from singular #Here is Andreas Jung's version of the function > f3 := x -> if not type(x, 'numeric') then 'procname(args)' > elif x<=1 then x^2 > else 2*x+1 > fi; f3 := proc(x) options operator,arrow; if not type(x,'numeric') then 'procname(args)' elif x <= 1 then x^2 else 2*x+1 fi end #This works. Well done Andreas! > evalf(int(f3(x), x=0..2)); 4.333333333 # I had found other work arounds, but this one is much better. However, I am a little disappointed that Maple cannot find the analytic solutions for definite integrals of this kind of piecewise continuous function. Incidentally, if the sudden change in value of the function is removed, numeric integration of piecewise sometimes works better: > f := x -> piecewise(x<=1, x^2, 2*x-1); 2 f := x -> piecewise(x <= 1, x , 2 x - 1) > evalf(int(f(x), x=0..2)); 2.333333333 # Nevertheless there are other examples that should work just as well, but fail: > f := x -> piecewise(x<=1, x^2, 1); 2 f := x -> piecewise(x <= 1, x , 1) > evalf(int(f(x), x=0..2)); Error, (in evalf/int) unexpected form of result from singular # Thus, although Andreas's solution is less compact, it is more reliable and versatile. Thank-you, Colin Birch -------------------------------------------------------------------------- Animals and Grazing Ecology Division, MLURI, Craigiebuckler, Aberdeen, AB9 2QJ, UK E-mail: mi372@mluri.sari.ac.uk Tel/Fax: +44 224 318611/311556 -------------------------------------------------------------------------- From maple_gr@daisy.uwaterloo.ca Mon Apr 10 13:22:32 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA00307; Mon, 10 Apr 95 13:22:32 -0700 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.9/8.6.9) id IAA05317 for maple-list-outgoing; Mon, 10 Apr 1995 08:36:13 -0400 Message-Id: <199504101236.IAA05317@daisy.uwaterloo.ca> From: Preben Als Holm Subject: [MUG] Integration of procedures To: maple-list@daisy.uwaterloo.ca Date: Wed, 5 Apr 1995 15:35:39 +0200 (METDST) Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Preben Als Holm I was surprised that Colin Birch in his latest letter didn't mention the following rather interesting method for integrating procedures (numerically). I read about in a letter to MUG from him on Feb 23: evalf(Int(sin, u=0..Pi)); 2.000000000 His was another example, but I was almost startled at the time to see that it indeed did work. I would have expected a syntax error message. It does not seem to matter whether Int or int is used. As another example take Bob Jantzen's f:= x -> if x<=1 then x^2 else 2*x+1 fi: evalf(Int( f, w=0..2)); 4.333333333 or using piecewise: g:= x -> piecewise( x<=1, x^2, 2*x+1): evalf( Int( g, t=0..2)); 4.333333333 I haven't seen this mentioned anywhere else than in Colin Birch's letter. Preben Alsholm IFAK, The Technical University of Denmark From maple_gr@daisy.uwaterloo.ca Fri May 5 14:36:18 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA13201; Fri, 5 May 95 14:36:18 -0700 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id JAA00525 for maple-list-outgoing; Fri, 5 May 1995 09:40:53 -0400 Message-Id: <199505051340.JAA00525@daisy.uwaterloo.ca> From: leroux@enst-bretagne.fr (Leroux UPS) Subject: [MUG] Graphic printing from Maple To: maple_group@daisy.waterloo.edu Date: Thu, 4 May 1995 18:03:58 +0200 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: leroux@enst-bretagne.fr (Leroux UPS) As far as I am concerned, I use Maple graphics for a book I am writing about using Maple in Physics on a PC 486. The graphic files are in postscript and the text files in TeX. I obtain them by writing everything as comments in my Maple worksheet. at the beginning of my worksheet, I add the comment: \input{lerouxl.tex} my worksheet, I add the comment: \input{lerouxl.tex} Before every graph, I write: >interface(plotdevice=postscript,plotdevice=fichier1.ps); >plot(...); as a comment, I add: xumapleplotb(fichier1.ps){8cm}; and, to return to normal graphic mode, I add: >interface(plotdevice=win); I save the file in "*.MS" format, (for example TEST.MS) and I use the option "save as" with tex mode (for example TEST.TEX) I use then tex.exe with option latex to obtain TEST.DVI, and next DVIPS to convert everything in postscript format. My file "lerouxl.tex" contains (among other things): \input{psfig} \newskip\Dessous \Dessous = -6mm \def\xumapleplotb#1#2{ \centerline{\vbox{\psfig{figure=#1,% height=#2,% width=#2,% angle=270}}} \vskip\Dessous } I hope this will be useful for somebody. ----------------------------------------- : A.Leroux : : leroux@enst-bretagne.fr : : Lycee Naval Brest (France) : : "My English is worse than my uncle's hat" : :(from the well known Assimil Method to learn English) : ----------------------------------------- From rajamani@mines.utah.edu Thu Aug 10 12:34:47 1995 Received: from bingham.mines.utah.edu by raven.math.ubc.ca (911016.SGI/1.14) id AA14436; Thu, 10 Aug 95 12:34:47 -0700 Received: from [128.110.128.169] (mammoth.mines.utah.edu [128.110.128.169]) by bingham.mines.utah.edu (8.6.10/8.6.5.Beta9) with SMTP id NAA20126 for ; Thu, 10 Aug 1995 13:36:47 -0600 Date: Thu, 10 Aug 1995 13:36:47 -0600 Message-Id: <199508101936.NAA20126@bingham.mines.utah.edu> X-Sender: rajamani@bingham.mines.utah.edu Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: israel@math.ubc.ca From: rajamani@bingham.mines.utah.edu (Raj K. Rajamani) Subject: object too large error in MAPLE Status: RO Dear Dr. Robert Israel: I take the liberty of asking you directly after seeing your expert advice to many inquiries over Maple User Group. Please spare a few minutes. I use similarity transformation of matrices to solve a system of diffl eqns. Say 7 of them. The diffl eqn is dm(t)/dt= A m(t) where A is a constant matrix made up of algebraic expressions . The solution is m(t)= T J T_inverse m(0) where T is the matrix of eigen vectors of A , J is the exponential of the diagonal matrix of the eigen values of A. In Maple I compose the eigen values and vectors and then construct the three matrices. But when the matrices are multiplied to get the components of the vector m(t) the error " Maple computation engine no longer executing. No further computation possible" appears in XMAPLE running in UNIX. Directly below m(t)= evalm(T J T_inverse m(0)) I get the Error (in expand/bigprod) object too large. Please help me to get around this. Thanks ---------------------------------------------------------------------------- Raj K. Rajamani, The University of Utah, Dept. of Metallurgical Engg. Phone: 801-581-3107, Fax. 801-581-8119. From maple_gr@daisy.uwaterloo.ca Fri Aug 11 12:38:27 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA00269; Fri, 11 Aug 95 12:38:27 -0700 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id JAA10634 for maple-list-outgoing; Fri, 11 Aug 1995 09:21:17 -0400 Message-Id: <199508111321.JAA10634@daisy.uwaterloo.ca> From: Joe Riel Subject: [MUG] Printing infix notation To: maple-list@daisy.uwaterloo.ca (Maple User Group) Date: Mon, 7 Aug 1995 17:45:41 -0700 (PDT) Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Joe Riel Any ideas on printing an aliased function in infix notation? I'd like the expression, > ex := x &//y; ex := x &// y to display as, x || y I tried aliasing the operator name, but then the expression was printed in functional rather than infix notation, > alias(`||` = `&//`): > ex; ||(x,y) I also tried creating a special print procedure, > `print/&//` := proc(a,b) ``.(convert(a,name))`.`||`.(convert(b,name)) end: that works, [it needs a bit of work to be more robust], > ex; x||y however, I wonder whether there is a better method. Can I just tell Maple to display the aliased symbol in infix notation? Why does Maple print in functional rather than infix notation when the operator aliased? Thanks, Joe Riel From maple_gr@daisy.uwaterloo.ca Mon Aug 14 15:43:56 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA07069; Mon, 14 Aug 95 15:43:56 -0700 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id MAA06308 for maple-list-outgoing; Mon, 14 Aug 1995 12:54:07 -0400 Message-Id: <199508141654.MAA06308@daisy.uwaterloo.ca> From: Joe Riel Subject: [MUG] Re: Dots To: maple-list@daisy.uwaterloo.ca Date: Fri, 11 Aug 1995 20:43:43 -0700 (PDT) Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Joe Riel Dear MUG, David Meade suggests entering (a=b)=c as a way to visually represent a=b=c. That is probably the simplest and the best method, it "prettyprints" the expression, something converting the expressions to names does not. Here is a tricky method which also prettyprints the expressions but does not have the asymmetrical parentheses, alas it parentheses each expression which isn't very attractive. macro(g = readlib(`tools/gensym`)): equals := proc() local i; convert([g(``)(args[1]), seq(op([g(`=`),g(``)(args[i])]), i = 2..nargs)],`*`) end: equals(a,b,c/d,d+5); (a) = (b) = (c/d) = (d + 5) The returned expression is a product; the `tools/gensym` procedure and the blank function (``) are used to prevent Maple from combining terms. Joe Riel From maple_gr@daisy.uwaterloo.ca Tue Aug 15 15:14:54 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA03279; Tue, 15 Aug 95 15:14:54 -0700 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id KAA09020 for maple-list-outgoing; Tue, 15 Aug 1995 10:27:10 -0400 Message-Id: <199508151427.KAA09020@daisy.uwaterloo.ca> From: Ted Stern Subject: [MUG] [MAPLE] [SUMMARY] non-commutative product `&*` (long!) To: Maple User Group Date: Mon, 14 Aug 1995 17:54:57 -0700 (PDT) Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Ted Stern Sorry for the bandwidth -- this is a summary of my efforts. I've come up with some rules for the non-commutative product operator in Maple, `&*`, so that I can expand and differentiate expressions with matrix- and vector-like quantities in them without actually needing anything from the `linalg` library. Thanks to Jim Gunson , whose `expand/&*` routine was the basis for mine. Jim is writing a much larger package, which is nearing beta development status, to handle linear algebra concepts such as inversion, etc. Thanks also to Michael Monagan -- even though I didn't end up using the code he sent me, it was a great intro to setting up a more complicated routine that uses recursion. My routines are fairly simple and don't get into linear algebra that much at all. In fact, I've put what ought to be a `simplify/&*` rule into `expand/&*` for my convenience. I use a trick (from Jim's code originally) for factoring constants out of the NC product that relies on sorting rules. This may be problematic for you -- one way to fix problems is to set some of your variables to constants using something like > InitConstants := constants; > constants := InitConstants, myvar1, myvar2, myvar3; If you figure out anything better, please let me know! Finally, as a personal note, I was quite surprised that the functionality of these routines was neither in standard MAPLE nor in any of the MAPLE references I looked in! Perhaps something like what I have done could be used as an example somewhere ... =========================================> University of Washington Ted Stern (206) 685-9304 Applied Mathematics Dept. stern@amath.washington.edu Box 352420 http://www.amath.washington.edu/~stern/ Seattle, WA 98195-2420 # # Need to create a type tester for `&*` # `type/&*`:= proc(x); if type(x,`function`) and op(0,x) = `&*` then RETURN(true); else RETURN(false); fi; end: # # Create an alias for the Identity: # alias(Id=&*()): # # Expansion rules for the Non-Commutative ("NC") product `&*`. # # The "sort" step for when an argument of `&*` is a product works only if the # vector- or matrix-like part of the product is the only term that is not assumed # to be a scalar or defined as a constant. If it doesn't work, check your # sort rules, or you might have a product where you ought to have a `&*`. # `expand/&*`:= proc() local i,j,n,z,x; options `(C) 1995 L. G. Stern `; # -------------------------------------------------- # Adapted from a version of `expand/&*` by # Jim Gunson , July 1995 # (who has written a more extensive set of routines for NC products on # matrices and vectors). Gunson's original version does not do full # recursion and doesn't simplify out 0's or the Identity as this version # does. # -------------------------------------------------- # # Loop through the arguments, checking to see if +, *, or &* expansion # rules apply # for i from 1 to nargs do x := args[i]; n := nops(x); if x = 0 then RETURN(0); elif type(x,`+`) then RETURN( expand(sum( `expand/&*`(args[1..i-1],op(j,x),args[i+1..nargs]) , j=1..n ))); elif type(x,`*`) then z := sort(x); n := nops(z); RETURN( expand(product(op(j,z),j=1..n-1) * `expand/&*`(args[1..i-1],op(n,z),args[i+1..nargs]))); elif type(x,`&*`) then # # This section makes the NC product associative. Then, by calling # `expand/&*` recursively, it checks through all arguments for sums, # products, and terms that are 0. Note that it handles the Identity # term, "&*()", automatically. # RETURN(`expand/&*`(args[1..i-1],op(expand([op(x)])),args[i+1..nargs])); fi; od; if nargs = 1 then # # Handle the case where `&*` has just a single argument # RETURN(expand(args[1])); elif nargs > 2 then # # The following "un-associates" the NC product and turns it back into # the "canonical" form, "a &* (b &* ( ... ) )" by recursing. # RETURN(expand(args[1]) &* `expand/&*`(args[2..nargs])); else # # no further expansion possible, and nargs must be 2 to get to this point, # so return the NC product of the two expanded arguments. # RETURN(expand(args[1]) &* expand(args[2])); fi; end: # # partial differentiation rule for `&*` # `diff/&*`:=(a,b,t) -> expand( diff(a,t) &* b + a &* diff(b,t) ): From deghare@daisy.uwaterloo.ca Sat Aug 26 11:36:37 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA25451; Sat, 26 Aug 95 11:36:37 -0700 Received: (from deghare@localhost) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id OAA19422; Sat, 26 Aug 1995 14:36:36 -0400 Date: Sat, 26 Aug 1995 14:36:36 -0400 From: Dave Hare Message-Id: <199508261836.OAA19422@daisy.uwaterloo.ca> To: israel@math.ubc.ca Subject: Re: MAPLE: local var of function Newsgroups: sci.math.symbolic In-Reply-To: <41lg0k$eoa@nntp.ucs.ubc.ca> References: <41jrt6$q6i@news.ust.hk> <41l1ei$1e3@news.ust.hk> Organization: University of Waterloo Cc: Status: RO In article <41lg0k$eoa@nntp.ucs.ubc.ca> you write: >In article <41l1ei$1e3@news.ust.hk>, >Poon sheung hung wrote: >> >>> duplicate := (x,n) -> local j; seq(x, j=1..n); >>syntax error: >>duplicate := (x,n) -> local j; seq(x, j=1..n); >> ^ >>which in the book is said to be valid, but error arises when trying it out. >> > >For some strange reason, Maple deleted the local variable declaration >in "->" functions for Release 3. You can do it without the "local j;". >Maple will figure out that "j" is supposed to be a local variable. >Ignore the warning message that tells you this. > > >> duplicate := (x,n) -> seq(x, j=1..n); >Warning, `j` is implicitly declared local > >duplicate := > > (x,n) -> local j; seq(x, j = 1 .. n) Yeah, but then in the next release (in beta test now), this "j" is assumed to be a global variable, messing things up yet again: > duplicate := (x,n) -> seq(x,j=1..n); Warning, `j` in call to `seq` is not local duplicate := (x,n) -> seq(x, j = 1 .. n) As a goofy sort of work-around, you can actually do this: > duplicate := proc(x,n) local j; option operator,arrow; seq(x,j=1..n); end; duplicate := (x,n) -> local j; seq(x, j = 1 .. n) Dave Hare Symbolic Computation Group University of Waterloo From deghare@daisy.uwaterloo.ca Sun Aug 27 16:03:24 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA12337; Sun, 27 Aug 95 16:03:24 -0700 Received: (from deghare@localhost) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id TAA05143 for israel@math.ubc.ca; Sun, 27 Aug 1995 19:03:17 -0400 Date: Sun, 27 Aug 1995 19:03:17 -0400 From: Dave Hare Message-Id: <199508272303.TAA05143@daisy.uwaterloo.ca> To: israel@math.ubc.ca Subject: Re: MAPLE: local var of function Status: RO > From: Robert Israel > > Yeah, but then in the next release (in beta test now), this "j" is assumed > > to be a global variable, messing things up yet again: > > > > > duplicate := (x,n) -> seq(x,j=1..n); > > Warning, `j` in call to `seq` is not local > > duplicate := (x,n) -> seq(x, j = 1 .. n) > > > Yes. I guess the logic behind this is that "seq" now treats its > index variable differently. > > > i:= 3: > > seq(i, i=1..4); > 1, 2, 3, 4 > > i; > 3 > > Since any previous value of the variable is preserved after the call > to "seq" (a very welcome change), it's effectively a local variable > anyway. But it isn't, actually. If something happens to interrupt the computation prematurely, the value of i will change: > f := i -> if i=2 then ERROR() else i fi; f := proc(i) options operator,arrow; if i = 2 then ERROR() else i fi end > g := n -> seq(f(i),i=1..n); Warning, `i` in call to `seq` is not local g := n -> seq(f(i), i = 1 .. n) > i:=17: > g(i); Error, (in f) > i; 2 > > As a goofy sort of work-around, you can actually do this: > > > > > duplicate := proc(x,n) local j; option operator,arrow; seq(x,j=1..n); end; > > duplicate := (x,n) -> local j; seq(x, j = 1 .. n) > > > > I don't know why they outlawed the "local" declaration in functions defined > with "->". Perhaps if we complain, they'll put it back. Even better - It had something to do with the intricacies of parsing a semicolon in the midst of an incomplete maple statement. > they could just take out this warning altogether. Where there should be > a warning, perhaps, is in something like > > > f:= x -> int(x*t, t=0..x); > > because here the "t" is treated as a global variable, and that does > screw things up when it has a prior value. > > By the way, I've been unable to send e-mail to "beta1_r4@maplesoft.com", > which is the address the beta-testers were given for reporting back to > Maple. Do you know what's going on there? I will enquire. Dave From maple_gr@daisy.uwaterloo.ca Thu Aug 31 12:23:02 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA21753; Thu, 31 Aug 95 12:23:02 -0700 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id IAA10117 for maple-list-outgoing; Thu, 31 Aug 1995 08:54:32 -0400 Message-Id: <199508311254.IAA10117@daisy.uwaterloo.ca> From: "Douglas B. Meade" Subject: [MUG] Re: dsolve( ,numeric) and odeplot To: maple-list@daisy.uwaterloo.ca Date: Fri, 25 Aug 1995 18:51:04 -0400 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: "Douglas B. Meade" Olaf, To answer your question, you need to understand how the results from numeric dsolve work. Basically, what happens is that each time the solution is evaluated, Maple performs a numerical integration between the last value for which the function was called and the current value of the argument. The advantage of this is that each step in your odeplot requires only the integration over a short interval. However, if you evaluate the function in a ``random'' order, you often see behavior similar to what you report. (In other words, the hysterisis curve is not closed!) But, all is not lost. To reset the initial condition, simply re-execute the call to dsolve (this takes almost no time, since it does no real calculation). To illustrate, let's look at your example (which seems to have been missing a ) in the definition of the differential equation). ----- Begin Included Maple Session ----- > de:={x^2*diff(y(x),x$3)+(-3*x^2+x)*diff(y(x),x$2) +(4*x^2-2*x-2^2)*diff(y(x),x)+(-2*x^2+x+2^2)*y(x), y(1)=1,D(y)(1)=0,(D@@2)(y)(1)=3/2}: > f:=dsolve(de,y(x),type=numeric); f := proc(rkf45_x) ... end > f(1); 2 d d [x = 1, y(x) = 1., ---- y(x) = 0, ----- y(x) = 1.500000000000000] dx 2 dx > f(2); d [x = 2, y(x) = 2.204064080953448, ---- y(x) = 3.312884467174992, dx 2 d ----- y(x) = 7.041720496633914] 2 dx > f(1);\ d -6 [x = 1, y(x) = .999999994202989, ---- y(x) = -.4225970078597374*10 , dx 2 d ----- y(x) = 1.499999954641835] 2 dx > f:=dsolve(de,y(x),type=numeric); f := proc(rkf45_x) ... end > f(1); 2 d d [x = 1, y(x) = 1., ---- y(x) = 0, ----- y(x) = 1.500000000000000] dx 2 dx > ----- End Included Maple Session ----- I hope this helps to resolve your problem. Doug ---------------------------------------------------------------------------- Douglas B. Meade Phone: (803) 777-6183 FAX: (803) 777-3783 Department of Mathematics E-mail: meade@math.sc.edu USC, Columbia, SC 29208 URL: http://www.math.sc.edu/~meade/ From monagan@inf.ethz.ch Wed Sep 6 07:20:02 1995 Received: from neptune.ethz.ch by raven.math.ubc.ca (911016.SGI/1.14) id AA27994; Wed, 6 Sep 95 07:20:02 -0700 Received: from mendel.inf.ethz.ch (monagan@mendel.inf.ethz.ch [129.132.12.20]) by inf.ethz.ch (8.6.10/8.6.10) with ESMTP id QAA23680 for ; Wed, 6 Sep 1995 16:19:51 +0200 From: Michael Monagan Received: (monagan@localhost) by mendel.inf.ethz.ch (8.6.10/8.6.10) id QAA07310 for israel@math.ubc.ca; Wed, 6 Sep 1995 16:19:50 +0200 Date: Wed, 6 Sep 1995 16:19:50 +0200 Message-Id: <199509061419.QAA07310@mendel.inf.ethz.ch> To: israel@math.ubc.ca Status: RO Dear Robert, > elif type(f, `*`) then > convert([ seq( f * pd(op(i,f))/op(i,f), i=1..nops(f)) ], `+`) If we are going to go for a nice solution then sum( 'f*pd(op(i,f))/op(i,f)', i=1..nops(f) ) is probably better? Except for the 's Actually, you'll be glad to hear that those quotes are not necessary in the new Maple. We have separated the functionality of sum (explicit definite sums verses symbolic sums) into add( f*pd(op(i,f))/op(i,f), i=1..nops(f) ) keeping sum for symbolic sums. Mike From S.J.Houghton@bradford.ac.uk Thu Feb 15 01:40:37 1996 Received: from [143.53.2.7] by raven.math.ubc.ca (911016.SGI/1.14) id AA05237; Thu, 15 Feb 96 01:40:37 -0800 Received: from morph.acc.brad.ac.uk (user root) by discovery.brad.ac.uk; Thu, 15 Feb 1996 09:38:53 GMT Received: from smtp.brad.ac.uk (guv.acc.brad.ac.uk [143.53.1.141]) by morph.acc.brad.ac.uk (8.7.2) with SMTP id JAA26430 for ; Thu, 15 Feb 1996 09:40:45 GMT Message-Id: <2.2.16.19960215094028.4b7f2ba2@pop.brad.ac.uk> X-Sender: stan@pop.brad.ac.uk X-Mailer: Windows Eudora Pro Version 2.2 (16) Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Thu, 15 Feb 1996 09:40:28 +0000 To: Robert Israel From: Stanley J Houghton Subject: Re: [MUG] Re: sequence of functions Status: RO Robert Thanks for the insight. I too don't understand the reason for the line in unapply. Perhaps there are more complicated reasons in simplification processes that I haven't anticipated. As you say annoying but at least it functions correctly. I note that it is still in vn 4. Regards Stan At 17:12 06/02/96 -0800, you wrote: >>> From: Robert Israel > >Stanley J Houghton wrote: > >| However, this presents a new problem. The result I got was > >| x->x, (x->x)^2, (x->x)^3 > >| which is not what I expected. When you apply each element it >| functions correctly (eg as x->x^3) but, on exploring with op, it >| is definitely a proc raised to a power. > >It is the result of the following line in the definition of "unapply". > >if type(f,`^`) and type(op(2,f),integer) then > RETURN(unapply(op(1,f),x)^op(2,f)) fi; > >I don't know why this was included in "unapply". I'd consider it >harmless, if annoying. If you want to avoid it, you can do the >following: > >> interface(verboseproc=2); >> myunapply:= subs(`^`=nothing, eval(unapply)): > >And then use "myunapply" instead of "unapply". > > > > > > From maple_gr@daisy.uwaterloo.ca Fri Sep 29 17:01:50 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA17622; Fri, 29 Sep 95 17:01:50 -0700 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id OAA07942 for maple-list-outgoing; Fri, 29 Sep 1995 14:53:39 -0400 Message-Id: <199509291853.OAA07942@daisy.uwaterloo.ca> From: Robert Israel Subject: [MUG] Functional differentiation To: maple-list@daisy.uwaterloo.ca Date: Thu, 21 Sep 95 09:28:08 -0700 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Robert Israel jrc@umr.edu (James Friend) writes: |> Is there a quicker way to do these differentiations? To ensure that the nesting |> of the functions in Maple works correctly, an almost unending list of "subs" |> commands are necessary. This, seems to me, to be due to my complete lack of |> understanding of Maple's scoping rules. But since the scoping rules aren't |> really written down in any of Maple's many manuals and references that I've |> managed to find so far, I thought I'd ask you. Basically, the rule is quite simple: a formal parameter or local variable in a procedure or function definition can't be accessed outside of that definition (or even in another function defined within that definition). e.g.: > A:= x; > F:= x -> A + x; > F(y); x + y The "x" in the value of A is the global "x", even when A is evaluated within F, so it is not replaced by the actual parameter y. Another point to watch for is that the body of a function definition using -> or < | > is not evaluated when the function is defined, but only when it is called. So in the example above, > A:= z; > F(w); z + w When F was defined, A had the value x, but that didn't affect the definition of F. After A's value is changed to "z", the new value is used when F(w) is evaluated. If you want to define a function using the current values of variables, you can use "unapply" which makes an (evaluated) expression into a function. > G:= unapply(A + x, x); > G(w); w + z > A:= v; > G(w); w + v |> # Radial and tangential plate solution (from biharmonic equation): |> R:= nxx,rxx,A1,A2,A3,A4>: I don't know what you are trying to accomplish with this use of "subs". You could use > R:= (nx,rx,A1,A2,A3,A4) -> A1*BJ(nx,rx)+A2*BI(nx,rx)+A3*BK(nx,rx)+A4*BY(nx,rx); I suspect you don't really need a function with all these formal parameters. It would probably be simpler to use expressions with nx, rx, etc. as global symbolic variables. Make sure they are symbolic (i.e. haven't been assigned values): if necessary you can "unassign" them with > nx:= 'nx'; etc. When you do get something that you really want to be a function (because you want to evaluate it at different values of these variables), use "unapply". I hope this helps. Robert Israel israel@math.ubc.ca Department of Mathematics (604) 822-3629 University of British Columbia fax 822-6074 Vancouver, BC, Canada V6T 1Y4 From blackled@maplesoft.com Tue Oct 3 13:09:52 1995 Received: from wildecho.maplesoft.on.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA11914; Tue, 3 Oct 95 13:09:52 -0700 Received: by wildecho.maplesoft.on.ca id AA10646 (5.65c/IDA-1.4.4 for israel@math.ubc.ca); Tue, 3 Oct 1995 16:09:49 -0400 From: Andrew Blackledge Message-Id: <199510032009.AA10646@wildecho.maplesoft.on.ca> Subject: Re: Beta 2.0 To: israel@math.ubc.ca (Robert Israel) Date: Tue, 3 Oct 1995 16:09:49 -0400 (EDT) In-Reply-To: <9509291953.AA27720@galois.math.ubc.ca> from "Robert Israel" at Sep 29, 95 12:53:33 pm X-Mailer: ELM [version 2.4 PL23] Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 1081 Status: RO Thanks for the bug report. I have examined it and entered several of the bugs you pointed out into out bug database. About the configurization that you ask about below, I would just like to point out that this is already possible. You can use the following commands to do what you want: with(plots): setoptions3d(style=PATCH); Further, you can create a file in the bin.win directory called MAPLE.INI and put in it any Maple commands that you like. These commands will get executed when you execute your first command in the Maple session. > 7) The default style for 3d surfaces is now "hidden line". In > previous releases on Windows it was "patch" (although the > documentation did claim it was "hidden line"). Could this be > made configurable? For more info, please see ?setoptions ?setoptions3d ?plot,options ?plot3d,options Thanks again, Andrew Blackledge Waterloo Maple Inc. blackled@maplesoft.on.ca (519) 747-2373 x254 Quality Assurance Specialist http://www.maplesoft.on.ca From maple_gr@daisy.uwaterloo.ca Wed Oct 4 16:32:36 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA05897; Wed, 4 Oct 95 16:32:36 -0700 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id OAA00476 for maple-list-outgoing; Wed, 4 Oct 1995 14:16:37 -0400 Message-Id: <199510041816.OAA00476@daisy.uwaterloo.ca> From: Herbert Homeier t4720 Subject: [MUG] WWW support for maple To: maple-list@daisy.uwaterloo.ca Date: Tue, 26 Sep 95 08:57:22 +0100 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Herbert Homeier t4720 Path: uni-regensburg.de!rchs1!c5008 From: c5008@rchs1 (Herbert Homeier t4720) Newsgroups: sci.math.symbolic Subject: WWW support for maple Date: 25 Sep 1995 16:40:55 GMT Organization: University of Regensburg, Germany Lines: 56 Message-ID: <446m2n$37h@rrzs3.uni-regensburg.de> Reply-To: na.hhomeier@na-net.ornl.gov NNTP-Posting-Host: rchs1.chemie.uni-regensburg.de X-Newsreader: TIN [version 1.2 PL0] For all those that 1) are interested in the question how to launch maple by clicking on a worksheet link under a WWW browser and 2) have access to a version of maple that accepts the name of a worksheet as argument like MS Windows I have configured the WWW-server at rchs1.uni-regensburg.de to export .ms files with the MIME type text/x-maple This allows to configure maple as viewer for your WWW browser. On my PC, I use MS Windows maple and netscape. I configure maple as viewer for the above type by entering in the netscape viewer configuration a line f:\maplev3\bin\wmaple53.exe -b f:\maplev3\update -b f:\maplev3\lib (Use "Properties" of the program manager on the maple icon to find out what your input should be) You can try this on the URL http://rchs1.uni-regensburg.de/pub/maple_share/orbitals/orbitals.ms Unfortunately, I do not know a way to launch xmaple under UNIX because neither a maple worksheet can be opened by reading from it (so "xmaple foo.ms" or "xmaple < foo.ms" both fail to load the worksheet) and there seems to be no maple procedure to load a worksheet (There is no "load_worksheet(foo.ms)" or alike). If anybody knows a workaround for the last problem, I would be very interested in hearing about this. Also, I would like to discuss MIME types for maple applications. For instance, it should be possible to introduce a MIME type that allows to fetch and install a complete share library package just by clicking on a link in a WWW browser...., that one has a MIME type for 2-D and one for 3-D plots that open maple and the corresponding plot windows with all the nice things being possible with maple plots like rotating etc., all configured to be launched from a WWW browser. In this way, much of the export to html would be unnecessary. I would like interested parties who are running a WWW server and have interesting maple worksheets available, to export them under the mime type above. In this case, please drop me a note. I will collect these in a list that I will make available on WWW. Best regards Herbert --------------------------------------------------------------- Dr. Herbert H. H. Homeier Institut fuer Physikalische und Theoretische Chemie Universitaet Regensburg D-93040 Regensburg, Germany Phone: +49-941-943 4720 FAX : +49-941-943 2305 email: na.hhomeier@na-net.ornl.gov HOMEPAGE --------------------------------------------------------------- From maple_gr@daisy.uwaterloo.ca Tue Nov 14 16:25:28 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA25616; Tue, 14 Nov 95 16:25:28 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id QAA16902 for maple-list-outgoing; Tue, 14 Nov 1995 16:00:34 -0500 Message-Id: <199511142100.QAA16902@daisy.uwaterloo.ca> From: jarausch@igpm.rwth-aachen.de (Helmut Jarausch) Subject: [MUG] Help converting an expression list to a vector function To: maple-list@daisy.uwaterloo.ca Date: Thu, 09 Nov 1995 09:06:14 +0100 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: jarausch@igpm.rwth-aachen.de (Helmut Jarausch) Please help! I have a list of expressions (see f below) and (in general) a list of variables in these expressions (here only x and y). The problem now is to substitute these variables by Xvar[1] and Xvar[2] (etc) which poses no problem. But then this list should be converted to a function mapping Xvar onto a vector with components f[1] and f[2]. I tried unapply and even looked at the unapply code to see how it works. There I saw the "trick" to do subs on a template _ARG ->_CODE. I tried this myself but with varying success - I just don't understand what's going on. Here my example with(linalg): vsub := [x=`Xvar`[1],y=`Xvar`[2]]; f:= [x^2+y^2-1,2*x^2-y-1]; g := convert(f,vector); gr := subs(vsub,op(g)); gg := map(unapply,op(gr),Xvar); # gives # 2 2 2 # gg := [ Xvar -> Xvar[1] + Xvar[2] - 1, Xvar -> 2 Xvar[1] - Xvar[2] - 1 ] What I would like to have is # 2 2 2 # gg := Xvar -> [Xvar[1] + Xvar[2] - 1, 2 Xvar[1] - Xvar[2] - 1 ] The first one seems to work, i.e. Z:= vector(2,[1,2]); gg(Z); works as expected although it's not clear to me how it works and what is the difference between these two definitions? #The next two attempts don't work - why ? #gg:=subs({'_Body'=,'_Arg'='Xvar'},_Arg->_Body); #gg:=subs({'_Body'=convert(eval(gr),vector),'_Arg'=Xvar},_Arg->_Body); Thank you for any hints, Helmut Jarausch. From maple_gr@daisy.uwaterloo.ca Fri Nov 10 16:41:02 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA19143; Fri, 10 Nov 95 16:41:02 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id PAA12491 for maple-list-outgoing; Fri, 10 Nov 1995 15:23:25 -0500 Message-Id: <199511102023.PAA12491@daisy.uwaterloo.ca> From: Robert Israel Subject: [MUG] Re: plotting Diracs To: maple-list@daisy.uwaterloo.ca Date: Wed, 8 Nov 95 16:03:56 -0800 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Robert Israel Matthew Lent <73123.3560@compuserve.com> wrote: > is it possible to plot Dirac(n,t)? > I've tried discont=true, and discont, "does not recognize the Dirac." > here is an example of what i'm working on: > Y:=(sum(X(omega)*Dirac(omega-2*Pi*n),n=-N..N)); > plot(x,omega=lower..upper); I don't think that's really what you want to plot, since Dirac(t) is infinite at t=0. Perhaps you really want to plot with a function that is 1 at 0 and 0 otherwise. Or more precisely, you'd like to show "spikes" from y=0 to y=X(omega) at the points omega = 2*Pi*n. You can do it as follows: > plot({ seq([[2*Pi*n, 0], [2*Pi*n, X(2*Pi*n)]], n=-N..N) }); You can automate the process as follows. > dplot:= proc(f,r) local v,s; if type(r,`=`) then v:= lhs(r) else v:= r; fi; if type(f,`+`) then s:= convert(f,set) else s:= {f} fi; plot(map(spike,s,v), r, args[3..nargs]); end; > spike:= proc(f, v) local c,d, p; if type(f, `*`) then c:= eval(subs(Dirac=1, f)) else c:= 1 fi; d:= f/c; if not type(d, specfunc(anything,Dirac)) then ERROR(`Not a linear combination of Diracs`) fi; p:= solve(op(1,d),v); [[p, 0], [p, subs(v=p,c)]]; end; Usage: dplot(expr, v=a..b, other plot options) where expr is a sum of terms of the form coefficient(v) * Dirac(v - value) Plots a sequence of spikes at v = value, y = 0 to y = coefficient(value). Example: > dplot(sum(sin(Pi*x/10)*Dirac(x-n), n=1..10), x = 0..11); Robert Israel israel@math.ubc.ca Department of Mathematics (604) 822-3629 University of British Columbia fax 822-6074 Vancouver, BC, Canada V6T 1Y4 From maple_gr@daisy.uwaterloo.ca Fri Nov 10 16:45:57 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA19630; Fri, 10 Nov 95 16:45:57 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id OAA09976 for maple-list-outgoing; Fri, 10 Nov 1995 14:59:56 -0500 Message-Id: <199511101959.OAA09976@daisy.uwaterloo.ca> From: Ross Taylor Subject: [MUG] Re: Kronecker delta To: maple-list@daisy.uwaterloo.ca Date: Wed, 8 Nov 1995 09:25:47 -0500 (EST) Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Ross Taylor On Sat, 4 Nov 1995, Holger Friedrich wrote: > is it possible to define a Kronecker delta in a way that would allow > Maple to compute infinite sums of expressions involving the delta? Yes, I have dealt with this problem in another context (differentiation of arbitrary sums with respect to indexed variables). Here is an illustration: > read `c:/maple/sum/tdtest`: > A:= sum(x[i]*x[j]*delta[i,j],i=1..infinity); infinity ----- \ A := ) x[i] x[j] delta[i, j] / ----- i = 1 > `simplify/delta`("); 2 x[j] > The file tdtest can be obtained via anonymous ftp from omnigate.clarkson.edu in the /pub/maple directory. Let me know if it works (or does not work for you). Ross Taylor Dept Chemical Engineering Clarkson University Potsdam New York 13699-5705 taylor@sun.soe.clarkson.edu From RWANG@THUBAN.AC.HMC.EDU Tue Nov 7 15:53:05 1995 Received: from Thuban.AC.HMC.Edu by raven.math.ubc.ca (911016.SGI/1.14) id AA21263; Tue, 7 Nov 95 15:53:05 -0800 Received: from THUBAN.AC.HMC.EDU by THUBAN.AC.HMC.EDU (PMDF V4.3-7 #12338) id <01HXD897BDQ89JD63P@THUBAN.AC.HMC.EDU>; Tue, 7 Nov 1995 15:52:54 PST Date: Tue, 07 Nov 1995 15:52:34 -0800 (PST) From: RWANG@THUBAN.AC.HMC.EDU Subject: Re: maple integration In-Reply-To: Your message dated "Thu, 19 Oct 1995 17:13:59 -0700 (PDT)" <9510200014.AA28342@pascal.math.ubc.ca> To: Robert Israel Message-Id: <01HXD8DW25UY9JD63P@THUBAN.AC.HMC.EDU> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII Content-Transfer-Encoding: 7BIT Status: RO Dear Dr. Israel, Thanks for your detailed help on integration in Maple. I have been using your method to do integration fine until I encountered the following problem: int( cos(cos(a)*x+sin(a)*y)*cos(x+f)*exp(-(x*x+y*y)), x=-infinity..infinity, y=-infinity..infinity); where a and f are two parameters. I carry out this integral into two steps, as show below: cos(cos(a)*x+sin(a)*y)*exp(-y*y); combine(expand(convert(",exp)),exp); simplify(int(",y=-infinity..infinity)); "*cos(x+f)*exp(-(x*x)); combine(expand(convert(",exp)),exp); p0:=simplify(int(",x=-infinity..infinity)); When f=0, Maple gives back result: Pi/2*[ exp(-(cos(a)-1)/2)+exp((cos(a)-1)/2) ] However, when f is not zero, it takes Maple forever to run without producing any results, sometime I got "out of memory" message. Could you show me what is wrong here? Thanks a lot in advance. Ruye Wang Engineering Department Harvey Mudd College Claremont, CA 91711 (909) 607-3527 From maple_gr@daisy.uwaterloo.ca Tue Nov 7 17:01:58 1995 Received: from daisy.uwaterloo.ca by raven.math.ubc.ca (911016.SGI/1.14) id AA23941; Tue, 7 Nov 95 17:01:58 -0800 Received: from [Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00] ([Family 1: 00:00:00:00:00:00:00:00:00:00:00:00:00:00]) by daisy.uwaterloo.ca (8.6.12/8.6.12UW) id QAA11878 for maple-list-outgoing; Tue, 7 Nov 1995 16:29:49 -0500 Message-Id: <199511072129.QAA11878@daisy.uwaterloo.ca> From: Maple Group Subject: [MUG] Re: Do it yourself To: maple-list@daisy.uwaterloo.ca Date: Tue, 7 Nov 1995 16:07:27 -0500 Sender: owner-maple-list@daisy.uwaterloo.ca Precedence: bulk Reply-To: maple-list@daisy.uwaterloo.ca Errors-To: maple-test-request@daisy.uwaterloo.ca Status: RO >> From: Maple Group -=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=- Date: 3 Nov 1995 17:42:39 -0800 From: "Casselman Tom" Subject: Do it yourself To: maple-list@daisy.uwaterloo.ca Oh boy, Prof. Denzler "hit the nail right on the head". His note is a superb articulation of an endemic problem that many users of symbolic systems do not grasp: You must be a good mathematician to use programs like Maple effectively. You must invoke all the intuition and training you have to solve certain problems. Maple is not an artificial intelligence program, and even these have limiits! Use your brain! So, to the complainers and whiners who want a perfect world where they do not have to think - stop complaining and use your mathematical know how when using Maple. Tom Casselman Lockheed-Martin Palo Alto Research Laboratories -=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=- Date: Fri, 03 Nov 1995 21:10:59 -0500 From: "David L. Johnson" To: maple-list@daisy.uwaterloo.ca Subject: Do it yourself J. Denzler wrote: > While I agree with the comments about premature releases > in general and sloppyness in handling bugs, > it seems that many users have certain > misconceptions about what symbolic manipulation programs can > and cannot do. Well said. >Users should not permit themselves > to shift the responsibility to understand what they are doing > to the computer. I have seen plenty of postings (in all parts > of Maths) on this list that conveyed the impression on me that > users are trying to do exactly this. The bad news we have to > learn is that it doesn't work and will never work. > Yes. I was appalled to read a few weeks ago on sci.math.symbolc a complaint that Maple could not perform a certain double integral. It was one of those standard double integrals that is impossible to solve until you reverse the order of integration, where it becomes easy. The exercise was designed to train students in how to recognize the region of integration from the limits, and re-express it in terms of another double integral. What was really upsetting was the representative of one of the CAS programs who hammered away at the problem, doing everything short of actually reversing the order of integration, and using this tripe as justification of the superiority of his company's product. These programs are no substitute for basic understanding of the theory involved in the problem. Nor should they be (speaking as one whose income depends upon imparting that basic theory). > More harm is probably done by developers' attempts to support > such an attitude and illusion than by the bugs in their > software. Hear, Hear! While Waterloo does have to shoulder some of that responsibility, I suggest that Wolfram Research has done far more of that damage, with their `system for doing mathematics by computer'. >IMHO, blackbox integrators don't *have* bugs, they > *are* the bugs. Perhaps a bit overstated. > Developers should state > clearly what their algorithms are really doing and provide > enough low level tools to give the users the control they > deserve to have over what they are doing. Well, that has to be tempered with their clear need to preserve their control over the underlying code. While the algorithms need to be made clearer, you can't expect them to publish their code (and since that is the case, you can never be _certain_ of the result of such algorithms, without independent verification). -- David L. Johnson dlj0@lehigh.edu Department of Mathematics http://www.lehigh.edu/~dlj0/dlj0.html Lehigh University 14 E. Packer Avenue (610) 758-3759 Bethlehem, PA 18015-3174 (610) 828-3708