On Sunday 30 November 2008 22:18:24 Richard Fateman wrote:
> Rather than ask how to implement your traditional, yet ambiguous
> notation on Maxima, I suggest that you start by changing your notation
> completely to correspond to what is supported in Maxima.
Actually, I'd rather have a piece of code that is self-explanatory and has
some resemblance to what it mathematically means.
I've only used maxima for six weeks now so I write functions with what I know
and improve it later with what I've learned.
> I think this will then make your problem easy to compute, instead of
> hard to even explain.
I think this problem is not easy to compute and even harder to explain. And
this is just one simple recursion formula. But you are right that it is
easier to do both if you write good code.
> For example, Maxima can operate with computational functions, arrays,
> and array functions like n[i](x,y), and infix operations like +, *.
>
> The notation you present using includes operators like Dx and ', which
> are not supported.
I have no idea what you mean. the operator Dx should be a function in maxima,
and I don't use ' in the example code.
> If you define a function n of one argument, then
> n() or just n is wrong.
So? n always has one argument, which is k, the integer number of prolongations
that you want to have. The code doesn't even work yet, so handling wrong
input is not really an issue yet.
> if xi means x_i perhaps it should be
> X[i], and if it is a function of x and y
> perhaps X[i](x,y). and if y is a function of x, then perhaps it should
> always be written as y(x).
xi is xi. not x_i If I write xi, it will become a nice latex \xi in emacs,
which corresponds with the traditional way it is written in mathematics
literature. There is only one xi, which is xi(x,y)
> You have not distinguished between bound and local variables, either
Sorry about that ;-(
>
>
>
>
> n[1](x,y):= Totalderiv(n[0](x,y))
> -diff(y(x),x)*Totalderiv(X[i]x,y)); ;;; should be n[0](x,y(x)) ???
> n[k](x,,y):= Totalderiv(n[k-1](x,y))- diff(y(x),x,k)*Totalderiv(X[i]x,y));
> Totalderiv(z):=diff(z,x)+diff(y(x),x)*diff(z,y); ;;; totally ambiguous
> if z contains y, is y the same regardless?
I know my code was ambiguous and I also don't like it. but in that way, it
resembles the mathematical recursion equation the most.
y is never a function of x, but to get a dy/dx term, I needed to use either
y(x) or the 'diff(y,x). Why? Because this is the current limit of my maxima
knowledge.
> Please look at examples of using Maxima.
I think discussing my problem here is more fruitful than looking again at
maxima examples, although I am very grateful for the link to the macsyma code
of Hereman where similar problems are solved by using defrule and putting
everything in lists.
Thanks for your remarks,
Regards,
Nijso
> N.A.Beishuizen at ctw.utwente.nl wrote:
> > Hi Stavros and others,
> >
> > Ok, maybe there is a simpler way of tackling things.
> > Maybe you can help me out. Here is exactly what I want.
> > My maxima code is at the end of the messages.
> >
> > I want to obtain the kth prolongation, which can be obtained
> > recursively as:
> >
> > n(1) = Dx(n) - y' * Dx(xi)
> > n(k) = Dx(n(k-1)) - dy(k)/dx(k) * Dx(xi)
> >
> > y' is dy/dx and dy(k)/dx(k) is the kth derivative of y.
> > n and xi depend on x,y
> >
> > Dx is the total derivative, which is
> > Dx = d/dx + y' * d/dy
> >
> > so, for n(1):
> > n(1) = Dx(n) - y' * Dx(xi)
> > n(1) = (d/dx + y' * d/dy)*n - y'*(d/dx + y'*d/dy)*xi
> > n(1) = dn/dx + y'*(dn/dy - dxi/dx) + (y')^2 * dxi/dy
> >
> > short notation:
> > n(1) = n_x + y'*(n_y - xi_x) + (y')^2*xi_y
> >
> > for n(2):
> > n(2) = Dx(n(1)) - y'' * Dx(xi)
> > ..
> > n(2) = n_xx + (2n_xy -xi_xx)y' + (n_yy-2*xi_xy)(y')^2 - xi_yy*(y')^3
> > + (n_y - 2xi_x - 3*xi_y*y')*y''
> >
> >
> > My program is below, but it produces d^2y(x)/dydx terms for eta_(2),
> > which are zero.
> >
> >
> > the difficulty is that y does not depend on x, but dy/dx exists as a
> > separate independent variable.
> >
> > /* construct the total derivative */
> > total_derivative(f) :=
> > block([Dx],
> > /* maybe use 'diff(y,x) here?*/
> > D_x: diff(f,x) + diff(y(x),x)*diff(f,y),
> > expand(D_x)
> > )$
>
> Here you use both y(x) and y. How are they related?
>
> > eta_(j) :=
> > block([_eta:makelist(0,i,1,j+1) ],
> > depends([eta,xi],[x,y]),
> >
> > _eta[1] : eta,
> >
> > for i:1 thru j do (
> > _eta[i+1] : total_derivative(_eta[i]) -
> > diff(y(x),x)*total_derivative(xi) ),
> > expand(_eta)
> > )$
> >