## 9779 Reputation

12 years, 65 days

## MaplePrimes Activity

### These are replies submitted by nm

It is better to have anti-derivative with no explicit complex number in it if the integrand is also free of complex numbers. Such anti-drivatives, even though it is correct is considered of lower quality.

opps. I forgot I did.

too many ode's and lose track.

Feel free to close this question then as duplicate.

You are right. I was trying different solution where this assumption is needed and kept this assumption there. Forgot to check if it is still needed or not.

This makes it little more strange that Maple did not find this solution.

Here is the one which needs the assumption I was looking at first

```ode:=diff(y(x), x) = sin(y(x)) + 1;
ic:=y(0)=Pi;
SOL:=y(x)=2*arccos(-(x/sqrt(4 + 4*x + 2*x^2)));
odetest(SOL,[ode,ic])  assuming x>-2; #assumption is needed

[0, 0]
```

sorry, I do not understand what you are asking as follow up above. It is better to ask new question if this is not related but you need to add more details. Not clear what is the question here.

I see ODESteps as designed for standard simple ODEs

But nothing could be simpler that this ode I gave it :)

I see.

I always have Physics updates in the libname path. This is the default as far as I know.

Actually in Maple 2024 there is bug (regardless of syntax used to simplify)

 > restart;

 > interface(version);

 > L := Matrix([[1 + w*sqrt((1 - cos(k))/(1 + cos(k)))*exp(-k/2)*I/lambda, rho*(exp(k/2) - exp(-k/2))*I/lambda], [rho*(exp((-k)/2) - exp(k/2))*I/lambda, 1 - w*sqrt((1 - cos(k))/(1 + cos(k)))*exp(k/2)*I/lambda]]);

 > LinearAlgebra:-Eigenvectors(L);

Error, (in evala) reducible RootOf detected.  Substitutions are {RootOf(_Z^2-tan(1/2*k)^2,index = 1) = -tan(1/2*k), RootOf(_Z^2-tan(1/2*k)^2,index = 1) = tan(1/2*k)}

 >

Compare to Maple 2023

 > restart;

 > interface(version);

 > L := Matrix([[1 + w*sqrt((1 - cos(k))/(1 + cos(k)))*exp(-k/2)*I/lambda, rho*(exp(k/2) - exp(-k/2))*I/lambda], [rho*(exp((-k)/2) - exp(k/2))*I/lambda, 1 - w*sqrt((1 - cos(k))/(1 + cos(k)))*exp(k/2)*I/lambda]]);

 > LinearAlgebra:-Eigenvectors(L);

 >

Yes this is much simpler. For Pi/2<x and x<Pi only it differentiates back to 1/sqrt(sin(x))

```anti:=-sqrt(2)*EllipticF(sqrt(2)*sqrt(sin(x)/(1 + sin(x))), sqrt(2)/2);
simplify(diff(anti,x)) assuming Pi/2<x and x<Pi
```

But Mathematica's anti seems to be valid for all x according to it:

yes, I thought it was strange that solve gives duplicate solutions also, that is why I put it in set. But I did not mention it, as I thought this could happen, even though I have not seen it before myself.

This came about when I was looking at integration of 1/sqrt(sin(x)) trying to see why can't get same solution as Mathematica's which is much simpler but I gave up

`int(1/sqrt(sin(x)),x)`

`Integrate[1/Sqrt[Sin[x]], x]`

Doing some checking, I do not think Mathematica's EllipticF and Maples' EllipticF are defined the same way.

But at the end I  could not find a way to make Maple's solution as simple as Mathematica's.

I did not know one can use (*  and *) in Maple to comment out multiline code. This must have been added to Maple in recent versions.

What I do is simply add  `if false then` before the code to be commented out and add `fi;` at the end.

```if false then
lots of code here
lots of code here
fi;```

As long as code inside is valid Maple code, this has same effect as commenting it out.

You could try to submit a bug report on this to Maplesoft customer support.

May be no one have asked officially for this change before.

I can't imagine it will be hard to add an option to change the length of recent files to display.

If I change the unkowns to a set instead of a list in the first attachement, in both cases an empty result is returned.

Not for me.

I actually had used set initially, changed to list when copying the example from my code.

You must be using something else other than V 2024 Maple?  Here is worksheet showing that with set. It still hangs when using c__1,c__2 if dsolve(diff(y(x),x\$9)=1,arbitraryconstants=subscripted); is issued first.

It would be more buggy if using SET vs. LIST made difference I would think?

 > interface(version);

 > Physics:-Version();

 > restart;

 > dsolve(diff(y(x),x\$9)=1,arbitraryconstants=subscripted);

 > eqs:=[-1/2*arctanh(1/2*sqrt(1 + 2*c__1)*sqrt(2)/sqrt(c__1))*sqrt(2)/sqrt(c__1) = c__2, 1 = (-exp(2*c__2*sqrt(c__1)*sqrt(2)) + 1)*sqrt(c__1)*sqrt(2)/(exp(2*c__2*sqrt(c__1)*sqrt(2)) + 1)]; unknowns:={c__1,c__2}; time(); C_sol:=[timelimit(60,solve(eqs,unknowns))]; time()

Error, (in fsolve) time expired

 > restart; #try again but do not do the arbitraryconstants=subscripted now.

 > eqs:=[-1/2*arctanh(1/2*sqrt(1 + 2*c__1)*sqrt(2)/sqrt(c__1))*sqrt(2)/sqrt(c__1) = c__2, 1 = (-exp(2*c__2*sqrt(c__1)*sqrt(2)) + 1)*sqrt(c__1)*sqrt(2)/(exp(2*c__2*sqrt(c__1)*sqrt(2)) + 1)]; unknowns:={c__1,c__2}; time(); C_sol:=[timelimit(90,solve(eqs,unknowns))]; time()

 > #see? it finished instantly now.

Number 7, however, certainly shows a weakness that should be handled.

I think just adding a check for `+` is all is needed. I removed none differential equations from the tests. Now it passes all.

```q:=proc(eq::equation,yx::function)
local res,T;
T:=(lhs-rhs)(eq);
if not has(eq,diff) or not T::`+` then return eq end if;
res:=selectremove(has,T,yx);
res[1]=-res[2]
end proc:

test_cases := [
y(x) + diff(y(x),x) + cos(x) + g(y(x)) + diff(f(x),x) + 1/x = sin(x),
diff(f(x),x) + 1/x = sin(x),
x*diff(y(x),x) + x = y(x) + diff(y(x),x\$2),
x^2 + 1/y(x) + diff(y(x),x) + sin(x) = y(x)^2,
diff(y(x),x)= 0,
diff(y(x),x\$2)= 0,
diff(y(x),x\$2)+1= 0,
1/diff(y(x),x\$2)+1= 0,
1/diff(y(x),x\$2)= 0,
diff(y(x),x\$2) = y(x) - x];

```

Now

`convert(map(X->[X,q(X,y(x))],test_cases),Matrix)`

gives

Yes, passing the undetermined function (say y(x) ) is what I would also do. This simplifies things. But I am afraid your updated function still fails on some cases.

```q:=proc(eq::equation,yx::function) local res;
if not has(eq,diff) then return eq end if;
res:=selectremove(has,(lhs-rhs)(eq),yx);
res[1]=-res[2]
end proc:

test_cases := [
y(x) + diff(y(x),x) + cos(x) + g(y(x)) + diff(f(x),x) + 1/x = sin(x),
diff(f(x),x) + 1/x = sin(x),
y(x) + x = 0,
x*diff(y(x),x) + x = y(x) + diff(y(x),x\$2),
x^2 + 1/y(x) + diff(y(x),x) + sin(x) = y(x)^2,
1 + x = 0,
diff(y(x),x)= 0,
diff(y(x),x\$2) = y(x) - x,
sin(x)+y(x)=0];

```

Now

`convert(map(X->[X,q(X,y(x))],test_cases),Matrix)`

Gives

You have a sign error

`p(diff(y(x),x)+x=0)`

gives

Should be   -x on the RHS. I think you should have res[1]=-res[2] instead.  But I have not tried it on more examples.

I also tricked your function a little, and now it fails with

```ode:=y(x)+diff(y(x),x\$2)+diff(f(x),x)=sin(x);
p(ode);```

Error, (in p) invalid input: has expects 2 arguments, but received 3

 5 6 7 8 9 10 11 Last Page 7 of 79
﻿