rtoy / maxima

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

single quote does not block simplification #2513

Open rtoy opened 3 months ago

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-06 10:08:12 Created by dauti on 2022-03-12 14:23:47 Original: https://sourceforge.net/p/maxima/bugs/3955


The single quote does not always prevent evaluation as it should, e.g. (using a current Maxima compiled with CLISP):

Maxima branch_5_45_base_473_gb46e89eba https://maxima.sourceforge.io
[...]
(%i1) display2d:false$
(%i2) 'integrate(1+x,x)=integrate(1+x,x);
(%o2) 'integrate(x+1,x) = x^2/2+x

is okay. The left hand side is not evaluated, the right hand side is the solution, the computed integral.

But for a simpler expression, e.g.

(%i3) 'integrate(1,x)=integrate(1,x);
(%o3) x = x

I would expect 'integrate(1,x) = xas correct answer. The same happens for example for diff(). Why?

Best regards, Wolfgang

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-06 10:08:13 Created by macrakis on 2022-03-12 16:05:33 Original: https://sourceforge.net/p/maxima/bugs/3955/#e21a


This is working as designed.

Many noun-forms have simplifications (not evaluation) in the case where the main argument is free of the variable or other trivial cases:

'limit(a,x,3) => a
'integrate(a,x) => a*x
'integrate(a,x,3,5) => 2*x
'integrate(sin(x),x,q+1,q+1) => 0

One exception is diff, which does not assume that a is independent of x:

'diff(a,x) => 'diff(a,x)

You can see that these are simplifications, and not evaluations using the following tests:

'(limit(a,x,3)) => a       << no evaluation
simp:false$
'limit(a,x,3) => 'limit(a,x,3)  << no simplification
limit(a*a,x,3) => a*a    << evaluation but no simplification (to a^2)
integrate(x,x,-1,1) => 1/2 + (-1)*(1/2) << evaluation but no simplification

As it happens, 'integrate(a,x) => a*x happens because integrate is declared outative: the only case that is actually simplified is 'integrate(1,x) => x. So you can suppress all but the 1 case like this:

remove(integrate,outative)$
'integrate(a,x) => 'integrate(a,x)
'integrate(1,x) => x

If it is important to you to suppress the 1 case, you can remove the (equal (car y) 1) clause in simpinteg -- the beauty of open source!

Closing as not a bug.

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-06 10:08:16 Created by macrakis on 2022-03-12 16:06:17 Original: https://sourceforge.net/p/maxima/bugs/3955/#b6eb


rtoy commented 3 months ago

Imported from SourceForge on 2024-07-06 10:08:20 Created by peterpall on 2022-03-12 16:07:32 Original: https://sourceforge.net/p/maxima/bugs/3955/#0558


I don't seem to remember that the manual states one can do such a thing. But a

'(integrate(1,x));

seems to do the trick, for some reason.

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-06 10:08:23 Created by peterpall on 2022-03-12 18:40:59 Original: https://sourceforge.net/p/maxima/bugs/3955/#681c/ca10


On my nightly Build of wxMaxima it does show an integral sign.

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-06 10:08:27 Created by macrakis on 2022-03-12 18:59:34 Original: https://sourceforge.net/p/maxima/bugs/3955/#0c7b


wxMaxima is a front end.

In Maxima itself, the two cases display differently:

'(integrate(x,x));
   integrate(x, x)

'integrate(x,x);
   /
   [
   I x dx
   ]
   /

Similarly for limit:

'(limit(x,x,0));
   limit(x, x, 0)

'limit(x,x,0);

   limit  x
   x -> 0
rtoy commented 3 months ago

Imported from SourceForge on 2024-07-06 10:08:31 Created by dauti on 2022-03-13 06:45:57 Original: https://sourceforge.net/p/maxima/bugs/3955/#e21a/e857


Thanks a lot for the detailed explanation. Best regards, Wolfgang