home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: sci.math.symbolic
- Path: sparky!uunet!spool.mu.edu!umn.edu!umeecs!zip!bagchi
- From: bagchi@eecs.umich.edu (Ranjan Drzzzzt! Bagchi)
- Subject: dumb maple question -- differential equations
- Message-ID: <BAGCHI.92Dec16184006@quip.eecs.umich.edu>
- Sender: news@zip.eecs.umich.edu (Mr. News)
- Organization: Recreational Creationists, Inc.
- Date: Wed, 16 Dec 1992 23:40:06 GMT
- Lines: 97
-
- Hi folk --
-
- I'm playing (for lack of a better word) with a system of
- ODE's, and having fed them to maple for a numeric solution, I'd like
- to do something with this solution.
-
- |\^/| Maple V Release 2 (University of Michigan)
- ._|\| |/|_. 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.
- > sys := {
- > f> (v1( diff(v1(t),t) = a1*v1(t) - b1*v1(t)*pr(t),
- > diff(v2(t),t) = a2*v2(t) - b2*v2(t)*pr(t),
- > diff(pr(t),t) = -c*pr(t) + d * pr(t) * v1(t) + e *pr(t)*v2(t)
- > };
-
- d
- sys := {---- v1(t) = a1 v1(t) - b1 v1(t) pr(t),
- dt
-
- d
- ---- v2(t) = a2 v2(t) - b2 v2(t) pr(t),
- dt
-
- d
- ---- pr(t) = - c pr(t) + d pr(t) v1(t) + e pr(t) v2(t)}
- dt
-
- > params := {a1 = 1, b1 = .3,a2 = 2, b2 = .6, c = 3, d = .7, e = .5};
-
- params := {a1 = 1, b1 = .3, a2 = 2, b2 = .6, c = 3, d = .7, e = .5}
-
- >
- union sysinit);
-
- > :> = dsolve(eqns,{v1(t),vsysinit := { v1(0) = 5, v2(0) = 5, pr(0) = 4};
-
- sysinit := {v1(0) = 5, v2(0) = 5, pr(0) = 4}
-
- >
- > eqns := subs(params,sys union sysinit);
-
- d
- eqns := {v1(0) = 5, v2(0) = 5, pr(0) = 4, ---- v1(t) = v1(t) - .3 v1(t) pr(t),
- dt
-
- d
- ---- v2(t) = 2 v2(t) - .6 v2(t) pr(t),
- dt
-
- d
- ---- pr(t) = - 3 pr(t) + .7 v1(t) pr(t) + .5 v2(t) pr(t)}
- dt
-
- >
- > pv := dsolve(eqns,{v1(t),v2(t),pr(t)},numeric);
- bytes used=302868, alloc=262096, time=0.72
- bytes used=309476, alloc=262096, time=0.78
- pv := proc(t) `dsolve/numeric/result2`(t,895108,[1,1,1]) end
-
- >> pv(1);
-
- {t = 1., v1(t) = 1.599162730, pr(t) = 5.059208376, v2(t) = .5114643376}
-
-
- ----------- end of session ------------
-
- There are several things I'd like to do with this data which
- I haven't had much luck with:
-
- 1) I'd like to break v1(t), v2(t), pr(t) into separate functions. While
- this sounds trivial, the only way I've been able to do it is with
-
- V1 proc(t) op(2,op(2,pv(t))) end;
-
- which looks fairly inelegant.
-
- 2) I'd like to collect a large (say 10000 point) array of data from each
- of the functions. Any attempt at this has taken what seems to be
- an unbearably long time. I've been using a do loop and putting data
- in each array bucket.
-
- 3) I'd like to plot these derived function. In the V1 I defined above,
- I get the following errors:
-
- > plot(V1,0..10);
- bytes used=1491904, alloc=1048384, time=5.58
- Error, (in f) wrong number (or type) of parameters in function type;
-
-
- help??
-
- -rj
- --
- Ranjan Bagchi Ranjan.Bagchi@umich.edu
- oo oooo o oo ooo oo oo oo o o oooo ooo o o oooooooo
-