2340 Reputation

4 years, 305 days

Can expression trees and/or DAG be displ...

Maple

Is the a print or plot function that can generate from an expression an expression tree

and/or the corresponding expression DAG

Taken from ?ProgrammingGuide,Chapter02

Maple

This is a simplified case from a colleague who could not get has to work.

While this

```I/sqrt(a);
has(%, sqrt(a));
I
------
(1/2)
a

false

```

is a technically correct output from Maple, false is mathematically an incorrect statement (IMO).

I think new users cannot find the explanation for that on their own because in other instances the output is true

```has(I/(1 - sqrt(a)), sqrt(a))

true

```

Are there better ways than

```I/sqrt(a);
has(%, sqrt(a))or has(%,1/sqrt(a));
I
------
(1/2)
a

true

```

Its a bit complicated to include allways the inverse of an expression to capture all instances of an expression.

Should has do this an give a warning that also the inverse is present?

Do I really get all values from this Roo...

Maple

I was about to verify two solutions of dsolve from here but could not find an agreement for negative values. This makes me wonder if all values are computed.

There is also a different behaviour that I do not understand when allvalues is given a RootOf expression or an equation containing a RootOf expression.

dsolve without method

 > ode:=diff(y(x), x) = (3*x - y(x) + 1)/(3*y(x) - x + 5); ic:=y(0)=0; dsolve({ode,ic}); plot(rhs(%),x=-10..10,numpoints=10); evalf(subs(x=3,%%)); evalf(subs(x=-3,%%%));
 (1)

dsolve with a particular method

 > sol:=dsolve([ode,ic],[dAlembert]); odetest(sol,[ode,ic]);
 (2)

Since allvalues fails on this expression for real valued x, rational and integer values are tried for punctual comaprision

 > subs(x=3,sol); allvalues(%); evalf(%)
 (3)

Two roots match the dsolve solution without method. However doing the same only on the right hand side produces different output. For some reason allvalues produces 3 RootOf expressions with a numerical root selector.

 > subs(x=3,rhs(sol)); allvalues(%); evalf(%)
 (4)

Why this change?
Now the same with a negative value. Now the root does not match the solution of the dsolve call without method.

 > subs(x=-3,sol); allvalues(%); evalf(%)
 (5)
 > subs(x = -3, rhs(sol)); allvalues(%); evalf(%);
 (6)
 >

Why does the interface command performs ...

Maple 2024

Maple formats output depending on typesetting options "extened" and "standard" for the GUI (or interface). An example taken from

```restart;
ts_standard:=proc(k::anything)
interface(typesetting=standard):
print(k);
interface(typesetting=extended):
NULL;
end proc:
k:=3/8*ln(55/52)+sin(x)+3/4*exp(x);
3   /55\            3
k := - ln|--| + sin(x) + - exp(x)
8   \52/            4

ts_standard(k);

```

Why is the input two times returned and why one time as a list?
Somehow the first interface statement is responsible for that.

I am only interested in the reformated input inside the list.
Is it possible to fix the code?

Other observation with typesetting=standard:

```restart;
interface(typesetting=standard);
expr:=cos(x)^2;
((x->x)=combine[trig])(expr);

((x->x)=combine[trig])(expr);#subsequent call
2   1            1
cos(x)  = - cos(2 x) + -
2            2```

(with Maple 2024.1 this only accurs in Math-1D)
but

```restart;
expr:=cos(x)^2;
interface(typesetting=standard);
((x->x)=combine[trig])(expr);
2
expr := cos(x)

extended

2   1            1
cos(x)  = - cos(2 x) + -
2            2
```

Interrupting an operation: What does it ...

Maple

GUI state after interupting with :

After switching to untitled 17 and back to test_timeout:

Sometimes it is necessary to switch back and forth twice.

Does this mean that the kernel did not receive the interupt?

 1 2 3 4 5 6 7 Last Page 1 of 29
﻿