nm

11353 Reputation

20 Badges

13 years, 19 days

MaplePrimes Activity


These are questions asked by nm

why setting interface(warnlevel=0); makes dsolve change the form of the final solution to an ODE?

Is this to be expected? Help on warnlevel 0 says to just suppress all warnings

In this example, both solutions are equivalent. One is just simpler than the other.

But now I am worried if this setting could affect dsolve in other ways not yet anticipated.
 

restart;

interface(version);

`Standard Worksheet Interface, Maple 2020.2, Windows 10, November 11 2020 Build ID 1502365`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 884 and is the same as the version installed in this computer, created 2020, November 25, 16:49 hours Pacific Time.`

interface(warnlevel=0);

3

ic:=y(0)=3:
ode := diff(y(x),x)*y(x)/(1+1/2*sqrt(1+diff(y(x),x)^2))=-x:
sol_1:=dsolve([ode,ic],y(x),singsol=all);

y(x) = -3+(1/3)*(-9*x^2+324)^(1/2), y(x) = 1+(1/3)*(-9*x^2+36)^(1/2)

restart;

ic:=y(0)=3:
ode := diff(y(x),x)*y(x)/(1+1/2*sqrt(1+diff(y(x),x)^2))=-x:
sol_2:=dsolve([ode,ic],y(x),singsol=all);

y(x) = -3+(-x^2+36)^(1/2), y(x) = 1+(-x^2+4)^(1/2)


 

Download warnlevel_difference.mw

btw, the same thing happens with warnlevel 2. i.e. answers look different.

But with warnlevel 3 and 4, now dsolve gives the same answer. 

SInce it seems default is warnlevel 3, it seems internally, dsolve takes different path depending on warnlevel setting? 

Edit

Here is a movie. I am using windows 10.

 

Edit: Here is another video. Tried now with fresh start of Maple. i.e. closed Maple and started it again.  Using worksheet. No other worksheet was open. This is what I found. Initially it gives the longer solution. After couple of tries, it then changed to the simpler one

 

Hello Maple experts;

We've talked about this subject before. odetest not verifying dsolve output. And very useful input was given:

https://www.mapleprimes.com/questions/227546-How-To-Make-Odetest-Verify-Dsolve

https://www.mapleprimes.com/questions/227638-How-To-Make-Odetest-Give-Zero-On-Its

Here, I thought to give a collection from my ode database of ode's that are solved by Maple, but odetest does not give zero, all in one place. 

I know this is a hard problem to get odetest to always verify its own solution. May be each case needs custom solution?

It would be nice if this area in Maple could be improved on more if possible (Maple is already a CAS leader in solving ODE's).

If some of the experts here like to see if they can get odetest to give zero on some of these examples, they are welcome to and will be useful to see. I only tried just simplify().

I depend on odetest to tell me if my solution is correct or not, and getting false negative makes me spend more time trying to find where my error in my solution, where there might be no error there, and it is just that odetest could not verify it.

These are all from different text books. I put the reference on each ODE where it was obtained from.

Two of these ODE can also hang or take very long time. I indicated that there so one might want to skip these two.

edit added new one, #1822, uploaded new worksheet


 

interface(version);

`Standard Worksheet Interface, Maple 2020.2, Windows 10, November 11 2020 Build ID 1502365`

Physics:-Version()

`The "Physics Updates" version in the MapleCloud is 884 and is the same as the version installed in this computer, created 2020, November 25, 16:49 hours Pacific Time.`

#796
#Book: Elementary differential equations with boundary value problems. William F. Trench. Brooks/Cole 2001
#Section: Section 1.2 Page 14
#Problem number: 9.
restart;
ode:=diff(y(x),x) = abs(y(x))+1;
sol:=dsolve(ode,y(x));
odetest(sol[1],ode):
simplify(%);

diff(y(x), x) = abs(y(x))+1

y(x) = -exp(-x)/_C1+1, y(x) = exp(x)*_C1-1

(-abs((-exp(-x)+_C1)/_C1)*_C1+exp(-x)-_C1)/_C1

#878
#Book: Elementary differential equations with boundary value problems. William F. Trench. Brooks/Cole 2001
#Section: Section 2.3 Page 55
#Problem number: 10.
restart;
ode:=diff(y(x),x) = x*(y(x)^2-1)^(2/3);
sol:=dsolve(ode,y(x));
odetest(sol,ode):
simplify(%);

diff(y(x), x) = x*(y(x)^2-1)^(2/3)

(1/2)*x^2-(-signum(y(x)^2-1))^(2/3)*y(x)*hypergeom([1/2, 2/3], [3/2], y(x)^2)/signum(y(x)^2-1)^(2/3)+_C1 = 0

-x*(4*y(x)^2*(y(x)^2-1)^(2/3)*signum(y(x)^2-1)^(1/3)*hypergeom([3/2, 5/3], [5/2], y(x)^2)+9*(y(x)^2-1)^(2/3)*signum(y(x)^2-1)^(1/3)*hypergeom([1/2, 2/3], [3/2], y(x)^2)+9*(-signum(y(x)^2-1))^(1/3))

#903
#Book: Elementary differential equations with boundary value problems. William F. Trench. Brooks/Cole 2001
#Section: Section 2.4 Page 57
#Problem number: 13.
restart;
ode:=diff(y(x),x)-y(x) = x*y(x)^(1/2);
ic:=y(0)=4;
sol:=dsolve([ode,ic],y(x));
odetest(sol,ode):
simplify(%);

diff(y(x), x)-y(x) = x*y(x)^(1/2)

y(0) = 4

y(x) = 16*(exp((1/2)*x))^2-8*x*exp((1/2)*x)+x^2-16*exp((1/2)*x)+4*x+4

-x*(((-8*x-16)*exp((1/2)*x)+x^2+4*x+16*exp(x)+4)^(1/2)-4*exp((1/2)*x)+x+2)

#1330
#Book: Differential equations and their applications, 3rd ed., M. Braun
#Section: Section 1.10. Page 80
#Problem number: 5.
restart;
ode:=diff(y(t),t) = 1+y(t)+y(t)^2*cos(t);
sol:=dsolve(ode,y(t)):
timelimit(60,odetest(sol,ode)); #WARNING, will either hang or take long time then timeout

diff(y(t), t) = 1+y(t)+y(t)^2*cos(t)

#1498
#Book: Differential Gleichungen, Kamke, 3rd ed
#Section: section 1.0
#Problem number: 25.
restart;
ode:=diff(y(x),x) = c*x^(-1+v)+b*x^(2*v)-a*y(x)^2;
sol:=dsolve(ode,y(x)):
odetest(sol,ode): #output too long to post

diff(y(x), x) = c*x^(-1+v)+b*x^(2*v)-a*y(x)^2

#1822
#Book: Advanced Mathematica, Book2, Perkin and Perkin, 1992
#Section: Chapter 11.3, page 316
restart;
ode:=x*y(x)*diff(y(x),x) = (y(x)^2-9)^(1/2);
ic:=y(exp(4)) = 5;
sol:=dsolve([ode,ic],y(x));
odetest(sol,[ode,ic]);
#needs:
odetest(sol,[ode,ic]) assuming x>1

x*y(x)*(diff(y(x), x)) = (y(x)^2-9)^(1/2)

y(exp(4)) = 5

y(x) = (9+ln(x)^2)^(1/2)

[-ln(x)*(csgn(ln(x))-1), 0]

[0, 0]

#1966
#Book: Differential equations for engineers by Wei-Chau XIE, Cambridge Press 2010
#Section: Chapter 2
#Problem number: 92.
restart;
ode:=2*x*diff(y(x),x)-y(x) = ln(diff(y(x),x));
sol:=dsolve(ode,y(x));
odetest(sol[1],ode):
simplify(%);
odetest(sol[2],ode);
simplify(%);

2*x*(diff(y(x), x))-y(x) = ln(diff(y(x), x))

y(x) = 1+(4*_C1*x+1)^(1/2)-ln((1/2)*(1+(4*_C1*x+1)^(1/2))/x), y(x) = 1-(4*_C1*x+1)^(1/2)-ln(-(1/2)*(-1+(4*_C1*x+1)^(1/2))/x)

-ln(2)+ln((1+(4*_C1*x+1)^(1/2))/x)-ln((2*x*_C1+(4*_C1*x+1)^(1/2)+1)/(x*(1+(4*_C1*x+1)^(1/2))))

-ln(2)+ln(-(-1+(4*_C1*x+1)^(1/2))/x)-ln((-2*x*_C1+(4*_C1*x+1)^(1/2)-1)/(x*(-1+(4*_C1*x+1)^(1/2))))

-ln(2)+ln((-(4*_C1*x+1)^(1/2)+1)/x)-ln((-2*x*_C1+(4*_C1*x+1)^(1/2)-1)/(x*(-1+(4*_C1*x+1)^(1/2))))

#2031
#Book: Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
#Section: Various 3
#Problem number: 57.
ode:=diff(y(x),x) = a*x^(n-1)+b*x^(2*n)+c*y(x)^2;
sol:=dsolve(ode,y(x)):
odetest(sol,ode):
simplify(%)

diff(y(x), x) = a*x^(n-1)+b*x^(2*n)+c*y(x)^2

(1/2)*(-20*(I*a*c*(n+6/5)*b^(3/2)+(1/5)*b*a*(2*x^(n+1)*b+a)*c^(3/2)+(6/5)*(n+4/3)*(I*b^(5/2)*x^(n+1)*c-b^2*c^(1/2)*(n+1)))*(n+1)*WhittakerW(-(I*c^(1/2)*a+(-2*n-2)*b^(1/2))/(b^(1/2)*(2*n+2)), 1/(2*n+2), (2*I)*b^(1/2)*c^(1/2)*x^(n+1)/(n+1))+WhittakerW(-I*c^(1/2)*a/(b^(1/2)*(2*n+2)), 1/(2*n+2), (2*I)*b^(1/2)*c^(1/2)*x^(n+1)/(n+1))*(-(7*I)*a*c*(n^2+(16/7)*n+8/7)*b^(3/2)-5*a^2*b*(n+6/5)*c^(3/2)+3*b^2*(2+n)*(n+4/3)*n*c^(1/2)+I*c^2*a^3*b^(1/2)))*_C1/(c^(3/2)*b^(3/2)*(I*c^(1/2)*a+(-3*n-4)*b^(1/2))*x^2*(WhittakerW(-I*c^(1/2)*a/(b^(1/2)*(2*n+2)), 1/(2*n+2), (2*I)*b^(1/2)*c^(1/2)*x^(n+1)/(n+1))*_C1+WhittakerM(-I*c^(1/2)*a/(b^(1/2)*(2*n+2)), 1/(2*n+2), (2*I)*b^(1/2)*c^(1/2)*x^(n+1)/(n+1))))

#2372
#Book: Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
#Section: Various 14
#Problem number: 407
ode:=diff(y(x),x)*(x^3+1)^(2/3)+(1+y(x)^3)^(2/3) = 0;
sol:=dsolve(ode,y(x)):
odetest(sol,ode):
simplify(%)

(diff(y(x), x))*(x^3+1)^(2/3)+(1+y(x)^3)^(2/3) = 0

-9*((4/9)*(1+y(x)^3)^(2/3)*Pi*3^(1/2)*LegendreP(-1/3, -1/3, (-y(x)^3+1)/(1+y(x)^3))*(-x^3)^(1/6)+(-(4/9)*(1+y(x)^3)^(1/3)*Pi*3^(1/2)*(x^3+1)^(1/3)*LegendreP(-1/3, -1/3, (-x^3+1)/(x^3+1))+GAMMA(2/3)*(-x^3)^(1/6)*((-y(x)^6-y(x)^3)*hypergeom([4/3, 5/3], [7/3], -y(x)^3)+x^3*(1+y(x)^3)^(1/3)*hypergeom([4/3, 5/3], [7/3], -x^3)*(x^3+1)^(2/3)))*(-y(x)^3)^(1/6))/((-x^3)^(1/6)*(9*hypergeom([4/3, 5/3], [7/3], -y(x)^3)*y(x)^3*(-y(x)^3)^(1/6)*(1+y(x)^3)^(1/3)*GAMMA(2/3)-4*Pi*3^(1/2)*LegendreP(-1/3, -1/3, (-y(x)^3+1)/(1+y(x)^3))))

#3035
#Book: Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
#Section: Various 37
#Problem number: 1118.
restart;
ode:=(diff(y(x),x)^2+1)^(1/2)+a*diff(y(x),x) = x;
sol:=[dsolve(ode,y(x))]:
odetest(sol[1],ode):
simplify(%);
odetest(sol[2],ode):
simplify(%)

((diff(y(x), x))^2+1)^(1/2)+a*(diff(y(x), x)) = x

((a^2+x^2-1)^(1/2)*(a^2-1)*((a^4+(x^2-1)*a^2+2*a*x*(a^2+x^2-1)^(1/2)+x^2)/(a^2-1)^2)^(1/2)+a^3+a*x^2+x*(a^2+x^2-1)^(1/2)-a)/((a^2+x^2-1)^(1/2)*(a^2-1))

-((-a^2+1)*(a^2+x^2-1)^(1/2)*((a^4+(x^2-1)*a^2-2*a*x*(a^2+x^2-1)^(1/2)+x^2)/(a^2-1)^2)^(1/2)+a^3+a*x^2-x*(a^2+x^2-1)^(1/2)-a)/((a^2+x^2-1)^(1/2)*(a^2-1))

#3036
#Book: Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
#Section: Various 37
#Problem number: 1119.
restart;
ode:=(diff(y(x),x)^2+1)^(1/2)+a*diff(y(x),x) = y(x);
sol:=[dsolve(ode,y(x))];
odetest(sol[1],ode):
simplify(%);
odetest(sol[2],ode):
simplify(%)

((diff(y(x), x))^2+1)^(1/2)+a*(diff(y(x), x)) = y(x)

[x-Intat(-(a-1)*(a+1)/(-a*_a+(_a^2+a^2-1)^(1/2)), _a = y(x))-_C1 = 0, x-Intat((a-1)*(a+1)/(a*_a+(_a^2+a^2-1)^(1/2)), _a = y(x))-_C1 = 0]

(((y(x)^2*a^2+a^4-2*y(x)*(y(x)^2+a^2-1)^(1/2)*a+y(x)^2-a^2)/(a^2-1)^2)^(1/2)*a^2-(y(x)^2+a^2-1)^(1/2)*a+y(x)-((y(x)^2*a^2+a^4-2*y(x)*(y(x)^2+a^2-1)^(1/2)*a+y(x)^2-a^2)/(a^2-1)^2)^(1/2))/(a^2-1)

(((y(x)^2*a^2+a^4+2*y(x)*(y(x)^2+a^2-1)^(1/2)*a+y(x)^2-a^2)/(a^2-1)^2)^(1/2)*a^2+(y(x)^2+a^2-1)^(1/2)*a-((y(x)^2*a^2+a^4+2*y(x)*(y(x)^2+a^2-1)^(1/2)*a+y(x)^2-a^2)/(a^2-1)^2)^(1/2)+y(x))/(a^2-1)

#3040
#Book: Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
#Section: Various 37
#Problem number: 1126.
restart;
ode:=a*x*(diff(y(x),x)^2+1)^(1/2)+x*diff(y(x),x)-y(x) = 0;
sol:=[dsolve(ode,y(x))];
odetest(sol[1],ode): #too large to display
odetest(sol[2],ode): #too large to display

a*x*((diff(y(x), x))^2+1)^(1/2)+x*(diff(y(x), x))-y(x) = 0

[x-exp(arcsinh(((-a^2*x^2+x^2+y(x)^2)^(1/2)*a+y(x))/((a^2-1)*x))/a)*_C1/((-a^2*x^2+a^2*y(x)^2+2*(-a^2*x^2+x^2+y(x)^2)^(1/2)*a*y(x)+x^2+y(x)^2)/((a^2-1)^2*x^2))^(1/2) = 0, x-exp(-arcsinh(((-a^2*x^2+x^2+y(x)^2)^(1/2)*a-y(x))/((a^2-1)*x))/a)*_C1/(-(a^2*x^2-a^2*y(x)^2+2*(-a^2*x^2+x^2+y(x)^2)^(1/2)*a*y(x)-x^2-y(x)^2)/((a^2-1)^2*x^2))^(1/2) = 0]

#3054
#Book: Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
#Section: Various 37
#Problem number: 1146.
restart;
ode:=ln(diff(y(x),x))+4*x*diff(y(x),x)-2*y(x) = 0;
sol:=[dsolve(ode,y(x))];
odetest(sol[1],ode):
simplify(%);
odetest(sol[2],ode):
simplify(%);

ln(diff(y(x), x))+4*x*(diff(y(x), x))-2*y(x) = 0

[y(x) = (1/2)*ln((1/4)*(-1+(16*_C1*x+1)^(1/2))/x)-1/2+(1/2)*(16*_C1*x+1)^(1/2), y(x) = (1/2)*ln(-(1/4)*(1+(16*_C1*x+1)^(1/2))/x)-1/2-(1/2)*(16*_C1*x+1)^(1/2)]

ln(2)+ln((8*x*_C1-(16*_C1*x+1)^(1/2)+1)/(x*(-1+(16*_C1*x+1)^(1/2))))-ln((-1+(16*_C1*x+1)^(1/2))/x)

ln(2)+ln((-8*x*_C1-(16*_C1*x+1)^(1/2)-1)/(x*(1+(16*_C1*x+1)^(1/2))))-ln((-1-(16*_C1*x+1)^(1/2))/x)

#3128
#Book: Differential Equations, By George Boole F.R.S. 1865
#Section: Chapter 7
#Problem number: 7.
restart;
ode:=y(x) = a*diff(y(x),x)+(diff(y(x),x)^2+1)^(1/2);
sol:=[dsolve(ode,y(x))];
odetest(sol[1],ode):
simplify(%);
odetest(sol[2],ode):
simplify(%);

y(x) = a*(diff(y(x), x))+((diff(y(x), x))^2+1)^(1/2)

[x-Intat(-(a-1)*(a+1)/(-a*_a+(_a^2+a^2-1)^(1/2)), _a = y(x))-_C1 = 0, x-Intat((a-1)*(a+1)/(a*_a+(_a^2+a^2-1)^(1/2)), _a = y(x))-_C1 = 0]

((y(x)^2+a^2-1)^(1/2)*a-y(x)-((y(x)^2*a^2+a^4-2*y(x)*(y(x)^2+a^2-1)^(1/2)*a+y(x)^2-a^2)/(a^2-1)^2)^(1/2)*(a^2-1))/(a^2-1)

(-(y(x)^2+a^2-1)^(1/2)*a-y(x)-((y(x)^2*a^2+a^4+2*y(x)*(y(x)^2+a^2-1)^(1/2)*a+y(x)^2-a^2)/(a^2-1)^2)^(1/2)*(a^2-1))/(a^2-1)

#3129
#Book: Differential Equations, By George Boole F.R.S. 1865
#Section: Chapter 7
#Problem number: 8.
restart;
ode:=x = a*diff(y(x),x)+(diff(y(x),x)^2+1)^(1/2);
sol:=[dsolve(ode,y(x))];
odetest(sol[1],ode):
simplify(%);
odetest(sol[2],ode):
simplify(%);

x = a*(diff(y(x), x))+((diff(y(x), x))^2+1)^(1/2)

[y(x) = (1/2)*x*(a^2+x^2-1)^(1/2)/((a-1)*(a+1))+(1/2)*ln(x+(a^2+x^2-1)^(1/2))*a^2/((a-1)*(a+1))-(1/2)*ln(x+(a^2+x^2-1)^(1/2))/((a-1)*(a+1))+(1/2)*a*x^2/((a-1)*(a+1))+_C1, y(x) = -(1/2)*x*(a^2+x^2-1)^(1/2)/((a-1)*(a+1))-(1/2)*ln(x+(a^2+x^2-1)^(1/2))*a^2/((a-1)*(a+1))+(1/2)*ln(x+(a^2+x^2-1)^(1/2))/((a-1)*(a+1))+(1/2)*a*x^2/((a-1)*(a+1))+_C1]

-((a^2+x^2-1)^(1/2)*(a^2-1)*((2*a*x*(a^2+x^2-1)^(1/2)+a^4+(x^2-1)*a^2+x^2)/(a^2-1)^2)^(1/2)+a^3+a*x^2+x*(a^2+x^2-1)^(1/2)-a)/((a^2+x^2-1)^(1/2)*(a^2-1))

((-a^2+1)*(a^2+x^2-1)^(1/2)*((a^4+(x^2-1)*a^2-2*a*x*(a^2+x^2-1)^(1/2)+x^2)/(a^2-1)^2)^(1/2)+a^3+a*x^2-x*(a^2+x^2-1)^(1/2)-a)/((a^2+x^2-1)^(1/2)*(a^2-1))

#3136
#Book: Differential Equations, By George Boole F.R.S. 1865
#Section: Chapter 7
#Problem number: 15
restart;
ode:=y(x) =x*diff(y(x),x)+a*x*(diff(y(x),x)^2+1)^(1/2);
sol:=[dsolve(ode,y(x))];
odetest(sol[1],ode):
simplify(%):# output too large
odetest(sol[2],ode):
simplify(%):# output too large

y(x) = x*(diff(y(x), x))+a*x*((diff(y(x), x))^2+1)^(1/2)

[x-exp(arcsinh(((-a^2*x^2+x^2+y(x)^2)^(1/2)*a+y(x))/((a^2-1)*x))/a)*_C1/((-a^2*x^2+a^2*y(x)^2+2*(-a^2*x^2+x^2+y(x)^2)^(1/2)*a*y(x)+x^2+y(x)^2)/((a^2-1)^2*x^2))^(1/2) = 0, x-exp(-arcsinh(((-a^2*x^2+x^2+y(x)^2)^(1/2)*a-y(x))/((a^2-1)*x))/a)*_C1/(-(a^2*x^2-a^2*y(x)^2+2*(-a^2*x^2+x^2+y(x)^2)^(1/2)*a*y(x)-x^2-y(x)^2)/((a^2-1)^2*x^2))^(1/2) = 0]

#3138
#Book: Differential Equations, By George Boole F.R.S. 1865
#Section: Chapter 7
#Problem number: 17
restart;
ode:=x+y(x)*diff(y(x),x) = a*(diff(y(x),x)^2+1)^(1/2);
sol:=[dsolve(ode,y(x))];
odetest(sol[1],ode): #WARNING. hangs. try with timelimit

[y(x) = (a*(tan(RootOf(a^2*_Z^2*cos(2*_Z)+2*_C1*a*_Z*cos(2*_Z)+4*sin(_Z)*a*x*_Z-a^2*_Z^2+_C1^2*cos(2*_Z)+a^2*cos(2*_Z)+4*sin(_Z)*_C1*x-2*_C1*a*_Z-_C1^2+a^2-2*x^2))^2+1)^(1/2)-x)/tan(RootOf(a^2*_Z^2*cos(2*_Z)+2*_C1*a*_Z*cos(2*_Z)+4*sin(_Z)*a*x*_Z-a^2*_Z^2+_C1^2*cos(2*_Z)+a^2*cos(2*_Z)+4*sin(_Z)*_C1*x-2*_C1*a*_Z-_C1^2+a^2-2*x^2)), y(x) = (a*(tan(RootOf(a^2*_Z^2*cos(2*_Z)+2*_C1*a*_Z*cos(2*_Z)-4*sin(_Z)*a*x*_Z-a^2*_Z^2+_C1^2*cos(2*_Z)+a^2*cos(2*_Z)-4*sin(_Z)*_C1*x-2*_C1*a*_Z-_C1^2+a^2-2*x^2))^2+1)^(1/2)-x)/tan(RootOf(a^2*_Z^2*cos(2*_Z)+2*_C1*a*_Z*cos(2*_Z)-4*sin(_Z)*a*x*_Z-a^2*_Z^2+_C1^2*cos(2*_Z)+a^2*cos(2*_Z)-4*sin(_Z)*_C1*x-2*_C1*a*_Z-_C1^2+a^2-2*x^2))]

 


edit 12/23/2020

Found one more.

#3647
restart;
ode:=diff(y(x),x)=2*(x*sqrt(y(x))-1)*y(x);
ic:=y(0)=1;
sol:=dsolve([ode,ic]);
odetest(sol,ode);

The above becomes zero only for x>-1 

ps. I added this to the worksheet, but since upload now does not work, did not re upload so not to lose the display above. Will do that later when it is working.

 

edit 12/25/2020

Found one more.

#3607
#Book: Fundamentals of Differential Equations. By Nagle, Saff and Snider. 9th edition. Boston. Pearson 2018.
#Section: Chapter 2, First order differential equations. Section 2.2 Exercises. page 46
#Problem number: 19.

restart;
ode:=1/2*diff(y(x),x) = (y(x)+1)^(1/2)*cos(x);
ic:=y(Pi)=0:
sol:=dsolve([ode,ic],y(x)):
res:=odetest(sol,ode);

edit 12/26/2020

Found one more

#3613
#Book: Fundamentals of Differential Equations. By Nagle, Saff and Snider. 9th edition. Boston. Pearson 2018.
#Section: Chapter 2, First order differential equations. Section 2.2 Exercises. page 46
#Problem number: 26.

restart;
ode:=(x+1)*diff(y(x),x)+y(x)^(1/2) = 0;
ic:=y(0) = 1;
sol:=dsolve([ode,ic],y(x));
res:=odetest(sol,ode);

PDEtools:-Solve(res=0,x) assuming real;

edit 1/10/2021

Found one more

#2406
#Book: Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
#Problem number: 406.

restart;
ode:=(x^3+1)^(2/3)*diff(y(x),x)+(y(x)^3+1)^(2/3) = 0;
sol:=dsolve(ode,y(x));

check:=simplify(odetest(sol,ode));  #tried other simplication, can't get it to zero. But sol is correct

 

Download examples_of_odes_that_do_not_odetest.mw

What do folks think about adding \, space automatically after Maple's Latex output for sqrt command?

This is all using the new Latex command. Not the orginal latex() command.

For me, it looks much better. I did some tests, and see no negative effect by always adding \, at the end of \sqrt{}

The reason is this: If there is a symbol after sqrt(.....)<HERE> then the math looks like the symbol is almost inside the integral, when it should be out. By adding \, this makes it more clear and better looking.

It is possible to write macro in Latex to do this in preamble I suppose. But if it can be done in the source, then that will be much better as it will always be there without the need to write complicated macro to change it later in Latex. 

Here are 4 expressions to compare

One can see the current problem area and the effect of adding \, automatically. The space was added for each case above in the second column, even for those where it was needed (second and third expressions) to show that adding space has no negative side-effect even when not needed.

Here is the above raw latex used, compiled on Tex Live 2020 on Linux,  and the Maple worksheet below that.

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{longtable}
\usepackage{mleftright}  
\mleftright

\begin{document}

\begin{longtable}{|p{3in}|p{3in}|}\hline
Default. No space after & With space added after\\\hline 
\[
\sqrt{\left(3+x \right)^{2}+1} a +\sin \left(x \right)
\]
&
\[
\sqrt{\left(3+x \right)^{2}+1}\, a +\sin \left(x \right)
\]\\\hline 
\[
\frac{\sqrt{\left(3+x \right)^{2}+1}}{5}+b
\]
&
\[
\frac{\sqrt{\left(3+x \right)^{2}+1}\,}{5}+b
\]\\\hline 
\[
\frac{\sqrt{x}}{5}+b
\]
&
\[
\frac{\sqrt{x}\,}{5}+b
\]
\\\hline 
\[
\frac{\sqrt{x^{2}+6} c}{5}+b
\]
&
\[
\frac{\sqrt{x^{2}+6}\, c}{5}+b
\]\\\hline 
\end{longtable}

\end{document}


 

interface(version);
Physics:-Version();

`Standard Worksheet Interface, Maple 2020.2, Windows 10, November 11 2020 Build ID 1502365`

`The "Physics Updates" version in the MapleCloud is 882. The version installed in this computer is 881 created 2020, November 21, 11:11 hours Pacific Time, found in the directory C:\Users\me\maple\toolbox\2020\Physics Updates\lib\`

restart;

Latex:-Settings(UseImaginaryUnit=i,
      UseColor = false,
      powersoftrigonometricfunctions= computernotation,
      leavespaceafterfunctionname = true,
      cacheresults = false
);

`* Partial match of  '`*UseImaginaryUnit*`' against keyword '`*useimaginaryunit*`' `

`* Partial match of  '`*UseColor*`' against keyword '`*usecolor*`' `

[powersoftrigonometricfunctions = computernotation, leavespaceafterfunctionname = true, cacheresults = false, useimaginaryunit = i, usecolor = false]

expr1:=sqrt((3+x)^2+1)*a+sin(x);
Latex(expr1)

((3+x)^2+1)^(1/2)*a+sin(x)

\sqrt{\left(3+x \right)^{2}+1} a +\sin \left(x \right)

expr2:=sqrt((3+x)^2+1)/5+b;
Latex(expr2)

(1/5)*((3+x)^2+1)^(1/2)+b

\frac{\sqrt{\left(3+x \right)^{2}+1}}{5}+b

expr3:=sqrt(x)/5+b;
Latex(expr3)

(1/5)*x^(1/2)+b

\frac{\sqrt{x}}{5}+b

expr4:=(sqrt((3+x^2)+3)*c)/5+b;
Latex(expr4)

(1/5)*(x^2+6)^(1/2)*c+b

\frac{\sqrt{x^{2}+6} c}{5}+b

 


(typo, should be sqrt, not int)

Download space_after_int.mw

I am having hard time understanding why Maple does this.

I have an integral, which maple could not integrate. So it returns int(....,x). Which is all fine. Then I used subsindets to force all terms in form e^(ln()+ln()+...) to expand in order to simplify the integrand, just for display purposes. 

subsindets returns back the integral unevaluated (as expected) but with integrand a little simpler, again as expected.

All is well so far.  

Then I find to my surprise, if I type the result back one more type, now the the integral actually evaluates.

Why? 

I have 2 questions on this.

1) If the original integral did not evaluate, why simplifying e^(ln()+ln()+...) makes it now evaluate? Did not Maple know this allready?

2) Why result back from subsindets remained unevaluated integral, and I had to type it again to see it now evaluates?

I found this after long time debugging, since this was done in code, not looking at screen. 

What happened is this: I store the result  of subsindets in a variable, and when I look at it in the debugger, I see int() still there, as expected.

I call a function to return back this result. I now see int() is gone!   So the act of just returning the result back, caused it to evaluate. Even though the orginal variable still had int() in it as. So returning the expression back, was equivalent to typing it again on the screen in the example below, which caused it to evaluate. 


Please see worksheet below.

interface(version);

`Standard Worksheet Interface, Maple 2020.2, Windows 10, November 11 2020 Build ID 1502365`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 882. The version installed in this computer is 881 created 2020, November 21, 11:11 hours Pacific Time, found in the directory C:\Users\me\maple\toolbox\2020\Physics Updates\lib\`

restart;

expr:=int(-1/2*exp((ln(a+cos(1/2*x)^2)+(-2*a-2)*ln(cos(1/2*x)))/a)*(-1+cos(x))/sin(1/2*x)/cos(1/2*x)/(a+cos(1/2*x)^2),x);

int(-(1/2)*exp((ln(a+cos((1/2)*x)^2)+(-2*a-2)*ln(cos((1/2)*x)))/a)*(-1+cos(x))/(sin((1/2)*x)*cos((1/2)*x)*(a+cos((1/2)*x)^2)), x)

#try again
expr;

int(-(1/2)*exp((ln(a+cos((1/2)*x)^2)+(-2*a-2)*ln(cos((1/2)*x)))/a)*(-1+cos(x))/(sin((1/2)*x)*cos((1/2)*x)*(a+cos((1/2)*x)^2)), x)

expr:=subsindets(expr,'specfunc( anything, exp )',f->(`if`(has(op(1,f),'ln'),expand(f),f)));

int(-(1/2)*(a+cos((1/2)*x)^2)^(1/a)*(-1+cos(x))/(cos((1/2)*x)^3*(cos((1/2)*x)^(1/a))^2*sin((1/2)*x)*(a+cos((1/2)*x)^2)), x)

#notice, the above is still int. Why is typing expr again, now makes it evaluate??
expr

-((4*a*exp(I*x)+exp((2*I)*x)+2*exp(I*x)+1)^(1/a)*exp(-((1/2)*I)*(2*csgn(I*exp(I*x)+I)*Pi*csgn(I*cos((1/2)*x))^2-2*csgn(I*exp(I*x)+I)*Pi*csgn(I*cos((1/2)*x))*csgn(I*exp(-((1/2)*I)*x))-2*Pi*csgn(I*cos((1/2)*x))^3+2*Pi*csgn(I*cos((1/2)*x))^2*csgn(I*exp(-((1/2)*I)*x))-Pi*csgn(I*exp(I*x))^3+2*Pi*csgn(I*exp(I*x))^2*csgn(I*exp(((1/2)*I)*x))-Pi*csgn(I*exp(I*x))*csgn(I*exp(((1/2)*I)*x))^2-Pi*csgn(I*a*exp(I*x)+((1/4)*I)*exp((2*I)*x)+((1/2)*I)*exp(I*x)+(1/4)*I)*csgn(I*a+(1/2)*I+((1/2)*I)*cos(x))^2+Pi*csgn(I*a*exp(I*x)+((1/4)*I)*exp((2*I)*x)+((1/2)*I)*exp(I*x)+(1/4)*I)*csgn(I*a+(1/2)*I+((1/2)*I)*cos(x))*csgn(I*exp(-I*x))+Pi*csgn(I*a+(1/2)*I+((1/2)*I)*cos(x))^3-Pi*csgn(I*a+(1/2)*I+((1/2)*I)*cos(x))^2*csgn(I*exp(-I*x))-4*x*a)/a)/((exp(I*x)+1)^(1/a))^2-2*(4*a*exp(I*x)+exp((2*I)*x)+2*exp(I*x)+1)^(1/a)*exp(-((1/2)*I)*(2*csgn(I*exp(I*x)+I)*Pi*csgn(I*cos((1/2)*x))^2-2*csgn(I*exp(I*x)+I)*Pi*csgn(I*cos((1/2)*x))*csgn(I*exp(-((1/2)*I)*x))-2*Pi*csgn(I*cos((1/2)*x))^3+2*Pi*csgn(I*cos((1/2)*x))^2*csgn(I*exp(-((1/2)*I)*x))-Pi*csgn(I*exp(I*x))^3+2*Pi*csgn(I*exp(I*x))^2*csgn(I*exp(((1/2)*I)*x))-Pi*csgn(I*exp(I*x))*csgn(I*exp(((1/2)*I)*x))^2-Pi*csgn(I*a*exp(I*x)+((1/4)*I)*exp((2*I)*x)+((1/2)*I)*exp(I*x)+(1/4)*I)*csgn(I*a+(1/2)*I+((1/2)*I)*cos(x))^2+Pi*csgn(I*a*exp(I*x)+((1/4)*I)*exp((2*I)*x)+((1/2)*I)*exp(I*x)+(1/4)*I)*csgn(I*a+(1/2)*I+((1/2)*I)*cos(x))*csgn(I*exp(-I*x))+Pi*csgn(I*a+(1/2)*I+((1/2)*I)*cos(x))^3-Pi*csgn(I*a+(1/2)*I+((1/2)*I)*cos(x))^2*csgn(I*exp(-I*x))-2*x*a)/a)/((exp(I*x)+1)^(1/a))^2+(4*a*exp(I*x)+exp((2*I)*x)+2*exp(I*x)+1)^(1/a)*exp(-((1/2)*I)*Pi*(2*csgn(I*exp(I*x)+I)*csgn(I*cos((1/2)*x))^2-2*csgn(I*exp(I*x)+I)*csgn(I*cos((1/2)*x))*csgn(I*exp(-((1/2)*I)*x))-2*csgn(I*cos((1/2)*x))^3+2*csgn(I*cos((1/2)*x))^2*csgn(I*exp(-((1/2)*I)*x))-csgn(I*exp(I*x))^3+2*csgn(I*exp(I*x))^2*csgn(I*exp(((1/2)*I)*x))-csgn(I*exp(I*x))*csgn(I*exp(((1/2)*I)*x))^2+csgn(I*a*exp(I*x)+((1/4)*I)*exp((2*I)*x)+((1/2)*I)*exp(I*x)+(1/4)*I)*csgn(I*a+(1/2)*I+((1/2)*I)*cos(x))*csgn(I*exp(-I*x))-csgn(I*a+(1/2)*I+((1/2)*I)*cos(x))^2*csgn(I*exp(-I*x))-csgn(I*a*exp(I*x)+((1/4)*I)*exp((2*I)*x)+((1/2)*I)*exp(I*x)+(1/4)*I)*csgn(I*a+(1/2)*I+((1/2)*I)*cos(x))^2+csgn(I*a+(1/2)*I+((1/2)*I)*cos(x))^3)/a)/((exp(I*x)+1)^(1/a))^2)/((a+1)*(exp(I*x)+1)^2)

 


 

Download why_it_now_evaluates.mw

Another simpler example, is just doing assignment to new variable. This causes evaluation.

restart;
expr:=int(-1/2*exp((ln(a+cos(1/2*x)^2)+(-2*a-2)*ln(cos(1/2*x)))/a)*(-1+cos(x))/sin(1/2*x)/cos(1/2*x)/(a+cos(1/2*x)^2),x);
expr:=subsindets(expr,'specfunc( anything, exp )',f->(`if`(has(op(1,f),'ln'),expand(f),f)));
#the above still has int() in it.

#this assignment, also causes evaluation
A:=expr;

 

What is the logic behind this. 

restart;
expr:=int(f(x),x);
lprint(algsubs(int=Int,expr));
lprint(subs(int=Int,expr));

gives


   int(f(x),x)

   Int(f(x),x)

So algsubs failed to replace int by Int

Looked at help. and see nothing. But I might have overlooked something. It says

It is a generalization of the subs command, which only handles syntactic substitution.

Generalization? If so, I expected it to work here. But may be there is a subtle reason why it did not? May be with algsubs, the replacement has to be algebraic expression and "int" is not, it is just a name.

Maple 2020.2
 

First 103 104 105 106 107 108 109 Last Page 105 of 199