rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

as of Maxima-5.21.1, depends() does not allow a similarity t #2023

Open rtoy opened 3 months ago

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-05 16:45:04 Created by nldias on 2011-08-21 13:29:11 Original: https://sourceforge.net/p/maxima/bugs/2255


Hi: my name is Nelson Dias, and I am an Associate Professor in Environmental Engineering at the Federal University of Paraná, Brazil.

Below is a classical problem: it transforms the PDE

(dPsi/dy)(d^2Psi/dxdy) - (dPsi/dx)(d^2Psi/dy^2) - nu*(d^3Psi/dy^3) = 0

into the ODE

2f''' + f f'' = 0

through the similarity transform

U = U*delta*eta,

delta = (nu*x/U)^(1/2),

eta = y/delta.

This is the classical Blasius solution for a laminar boundary-layer.

The code below transforms the PDE into the ODE:

delta : \(nu\*x/U\)^\(1/2\)$
eta : y/delta$
depends\(f,eta\)$
psi : U\*delta\*f$
eq : diff\(psi,y\) \* diff\(psi,x,1,y,1\) - diff\(psi,x\)\*diff\(psi,y,2\) - nu\*diff\(psi,y,3\)$
factor\(eq\);

In Maxima 5.20.1 it gives the right answer:

\(%i1\)                         batch\(psi-bla.max\)

batching /home/nldias/software/maxima-5.20.1/psi-bla.max
nu x 1/2
\(%i2\)                          delta : \(----\)
U
y
\(%i3\)                             eta : -----
delta
\(%i4\)                           depends\(f, eta\)
\(%i5\)                           psi : U delta f
\(%i6\) eq : - nu diff\(psi, y, 3\) - diff\(psi, x\) diff\(psi, y, 2\)
\+ diff\(psi, y\) diff\(psi, x, 1, y, 1\)
\(%i7\)                             factor\(eq\)
3                  2
d f                d f         2
\(2 -------------- + f --------------\) U
y      3           y      2
d\(----------\)      d\(----------\)
nu x               nu x
sqrt\(----\)         sqrt\(----\)
U                  U
\(%o7\)             - ----------------------------------------
2 x

but it fails for all the following versions:

5.21.1 5.22.1 5.23.2 5.24.0 5.25.0

giving the following error:

\(%i1\)                         batch\(psi-bla.max\)

read and interpret file: /home/nldias/software/maxima-5.25.0/psi-bla.max
nu x 1/2
\(%i2\)                          delta : \(----\)
U
y
\(%i3\)                             eta : -----
delta
\(%i4\)                           depends\(f, eta\)
y
depends: argument must be a symbol; found ----------
nu x
sqrt\(----\)
U
\-- an error. To debug this try: debugmode\(true\);

I don't know if this is a bug, but if it is not I would very much like to know what the alternative is for the code I used until Maxima-5.20.1. Similarity transforms are a big deal to me, and I would like to be able to continue to use this (and other Maxima examples) in my classes.

Sincerely

Nelson L. Dias

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-05 16:45:04 Created by crategus on 2011-08-21 22:02:33 Original: https://sourceforge.net/p/maxima/bugs/2255/#7567


Thank you very much for your bug report. I had a look at the problem. Because of a bug report the routine i-$dependencies has been reworked in 14.12.2009. At this time a check has been added to allow only dependencies from a symbol and not an expression. This might be too restrictive, but on the other hand, if we allow dependencies on expressions, we get expressions which have a syntax which is wrong for the function diff.

The following is generated with Maxima 5.20:

(%i1) depends(f, 2*x); (%o1) [f(2*x)] (%i2) diff(f, x); (%o2) 2*'diff(f,2*x,1) (%i3) ev(%), nouns; diff: second argument must be a variable; found 2*x -- an error. To debug this try: debugmode(true);

The problem is that the function diff does not allow the differentiation wrt an expression. Perhaps, we can extend the syntax of the function diff to allow the differentiation wrt an expression.

I will think again about this problem.

Dieter Kaiser

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-05 16:45:08 Created by willisbl on 2011-08-24 09:52:01 Original: https://sourceforge.net/p/maxima/bugs/2255/#17c6


Here is a workaround:

(%i45) load(pdiff)$

(%i46) U * (nu*x/U)^(1/2) * F(y/(nu*x/U)^(1/2))$

(%i47) diff(%,y) * diff(%,x,1,y,1) - diff(%,x)*diff(%,y,2) - nu*diff(%,y,3)$

(%i48) ratsubst(w,y/sqrt((nu*x)/U),%)$

(%i49) solve(%,diff(F(w),w,3));

(%o49) [F[(3)](w)=-(F(w)*F[(2)](w))/2]

If you have questions about this, send a note to the mailing list.