explicit + expressions vs 'sum noun for use in mnewton/series solutions to PDEs etc
Subject: explicit + expressions vs 'sum noun for use in mnewton/series solutions to PDEs etc
From: dlakelan
Date: Sat, 06 Jun 2009 11:47:10 -0700
As is my wont these days, I'm solving some PDEs using fourier series and
collocation methods.
The idea is to construct a series that approximates the function of
interest, plug it into the PDE, and try to find the coefficients that
make the PDE true at a set of x values (the collocation points).
If I do this with large + expressions everything works fine, but it is
extremely slow. If I try to do it with 'sum nouns mnewton can not
differentiate with respect to the coefficients... here's a simplified
example.
T is the temperature of a rod heated in the center (x=0) whose far end
at x = 1 is held at constant temperature T=0. Due to the symmetry, I use
only cosine terms.
T:'sum(T[i]*cos(%pi * (i+1/2) * x ),i,0,3);
We know that the solution to the steady state problem with temperature
T=1 and x=0 and T=0 at x=1 is the linear gradient. can we solve for the
T[i] that gives the approximation to the linear gradient?
mnewton(makelist(subst(x=float(i/3),T=float(1-i/3)),i,0,3),makelist(T[i],i,0,3),[0,0,0,0]);
Mnewton iteration: 1
2 Norm of values 0.0
Unable to compute the LU factorization
Maxima encountered a Lisp error:
The value NIL is not of type CHARACTER.
Automatically continuing.
(the bit about iteration count and 2 norm are modifications that I made
to mnewton for tracking the progress)
If instead of 'sum I use the non-noun version, it works, but my
expressions become massive, and take a long time to solve. Is there a
way I can use the 'sum version and still have mnewton work with these
kinds of expressions? Do I need to define a gradef for sums of this form?
Thanks,
Dan