File: test_pdes.mac

package info (click to toggle)
maxima 5.21.1-2squeeze
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 94,928 kB
  • ctags: 43,849
  • sloc: lisp: 298,974; fortran: 14,666; perl: 14,325; tcl: 10,494; sh: 4,052; makefile: 2,975; ansic: 471; awk: 24; sed: 7
file content (55 lines) | stat: -rw-r--r-- 2,458 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* Original version of this file copyright 1999 by Michael Wester,
 * and retrieved from http://www.math.unm.edu/~wester/demos/PDEs/problems.macsyma
 * circa 2006-10-23.
 *
 * Released under the terms of the GNU General Public License, version 2,
 * per message dated 2007-06-03 from Michael Wester to Robert Dodier
 * (contained in the file wester-gpl-permission-message.txt).
 *
 * See: "A Critique of the Mathematical Abilities of CA Systems"
 * by Michael Wester, pp 25--60 in
 * "Computer Algebra Systems: A Practical Guide", edited by Michael J. Wester
 * and published by John Wiley and Sons, Chichester, United Kingdom, 1999.
 */
/* ----------[ M a c s y m a ]---------- */
/* ---------- Initialization ---------- */
showtime: all$
prederror: false$
/* ---------- Partial Differential Equations ---------- */
pde_solns(ll):=
   map(lambda([l],
              if apply("+", map(lambda([e], if e # 0 then 1 else 0), l)) >= 2
                 then
                 pl_solve(l)
              else
                 l),
       ll)$
/* A very simple PDE => g(x) + h(y) for arbitrary functions g and h */
'diff(f, x, 1, y, 1) = 0;
errcatch(pl_symmetry([lhs(%) - rhs(%)], [f], [x, y], [], ['diff(f, x)]));
/* Heat equation: the fundamental solution is 1/sqrt(4 pi t) exp(-x^2/[4 t]).
   If f(x, t) and a(x, t) are solutions, the most general solution obtainable
   from f(x, t) by group transformations is of the form u(x, t) = a(x, t)
   + 1/sqrt(1 + 4 e6 t) exp(e3 - [e5 x + e6 x^2 -  e5^2 t]/[1 + 4 e6 t])
   f([e^(-e4) (x - 2 e5 t)]/[1 + 4 e6 t] - e1, [e^(-2 e4) t]/[1 + 4 e6 t] - e2)
   See Peter J. Olver, _Applications of Lie Groups to Differential Equations_,
   Second Edition, Springer Verlag, 1993, p. 120 (an excellent book).  See also
   Heat.macsyma */
'diff(u, t) = 'diff(u, x, 2);
q: pl_symmetry([lhs(%) - rhs(%)], [u], [x, t], [], ['diff(u, t)]);
assume(u > 0, %x1 > 0, %x2 > 0, 4*%n2 > 1)$
pde_solns(q);
pl_sksol;
forget(u > 0, %x1 > 0, %x2 > 0, 4*%n2 > 1)$
remvalue(q)$
/* Potential equation on a circular disk---a separable PDE
   => v(r, theta) = a[0] + sum(a[n] r^n cos(n theta), n = 1..infinity)
                         + sum(b[n] r^n sin(n theta), n = 1..infinity) */
1/r * diff(r * diff(v(r, theta), r), r)
        + 1/r^2 * diff(v(r, theta), theta, 2) = 0;
subst(v, v(r, theta), %);
pl_symmetry([lhs(%) - rhs(%)], [v], [r, theta], [], ['diff(v, theta, 2)]);
pl_sksol;
remfunction(pde_solns)$
/* ---------- Quit ---------- */
quit();