nm

8799 Reputation

19 Badges

11 years, 317 days

MaplePrimes Activity


These are replies submitted by nm

@vv 

opps. I forgot I did.

too many ode's and lose track. 

Feel free to close this question then as duplicate.

@Preben Alsholm 

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]

 

@minhthien2016 

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.

@vv 

I see ODESteps as designed for standard simple ODEs

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

@vv 

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;

14724

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

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]]);

L := Matrix(2, 2, {(1, 1) = 1+I*w*((1-cos(k))/(1+cos(k)))^(1/2)*exp(-(1/2)*k)/lambda, (1, 2) = I*rho*(exp((1/2)*k)-exp(-(1/2)*k))/lambda, (2, 1) = I*rho*(exp(-(1/2)*k)-exp((1/2)*k))/lambda, (2, 2) = 1-I*w*((1-cos(k))/(1+cos(k)))^(1/2)*exp((1/2)*k)/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)}

 

NULL


 

Download eig_maple_2024.mw

 

Compare to Maple 2023


 

20660

restart;

20660

interface(version);

`Standard Worksheet Interface, Maple 2023.2, Windows 10, November 24 2023 Build ID 1762575`

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]]);

Matrix(2, 2, {(1, 1) = 1+I*w*sqrt((1-cos(k))/(1+cos(k)))*exp(-(1/2)*k)/lambda, (1, 2) = I*rho*(exp((1/2)*k)-exp(-(1/2)*k))/lambda, (2, 1) = I*rho*(exp(-(1/2)*k)-exp((1/2)*k))/lambda, (2, 2) = 1-I*w*sqrt((1-cos(k))/(1+cos(k)))*exp((1/2)*k)/lambda})

LinearAlgebra:-Eigenvectors(L);

Vector(2, {(1) = (1/2)*((`–`(I)*sqrt(`–`((`–`(1)+cos(k))/(1+cos(k))))*w*(exp(k)-1)+2*exp((1/2)*k)*lambda)*cos(k)-I*sqrt(`–`((`–`(1)+cos(k))/(1+cos(k))))*w*(exp(k)-1)+2*exp((1/2)*k)*lambda+sqrt(4*exp(`–`((1/2)*k))*cos(k)^2*exp((1/2)*k)*rho^2-8*cos(k)^2*(exp((1/2)*k))^2*rho^2+4*cos(k)^2*(exp((1/2)*k))^2*w^2+4*cos(k)^2*exp((1/2)*k)*exp((3/2)*k)*rho^2+cos(k)^2*(exp(k))^2*w^2+8*exp(`–`((1/2)*k))*cos(k)*exp((1/2)*k)*rho^2-2*cos(k)^2*exp(k)*w^2-16*(exp((1/2)*k))^2*rho^2*cos(k)+8*cos(k)*exp((1/2)*k)*exp((3/2)*k)*rho^2+4*exp(`–`((1/2)*k))*exp((1/2)*k)*rho^2+cos(k)^2*w^2-8*(exp((1/2)*k))^2*rho^2-4*w^2*(exp((1/2)*k))^2+4*exp((1/2)*k)*exp((3/2)*k)*rho^2-(exp(k))^2*w^2+2*w^2*exp(k)-w^2))/(exp((1/2)*k)*(1+cos(k))*lambda), (2) = (1/2)*((`–`(I)*sqrt(`–`((`–`(1)+cos(k))/(1+cos(k))))*w*(exp(k)-1)+2*exp((1/2)*k)*lambda)*cos(k)-I*sqrt(`–`((`–`(1)+cos(k))/(1+cos(k))))*w*(exp(k)-1)+2*exp((1/2)*k)*lambda-sqrt(4*exp(`–`((1/2)*k))*cos(k)^2*exp((1/2)*k)*rho^2-8*cos(k)^2*(exp((1/2)*k))^2*rho^2+4*cos(k)^2*(exp((1/2)*k))^2*w^2+4*cos(k)^2*exp((1/2)*k)*exp((3/2)*k)*rho^2+cos(k)^2*(exp(k))^2*w^2+8*exp(`–`((1/2)*k))*cos(k)*exp((1/2)*k)*rho^2-2*cos(k)^2*exp(k)*w^2-16*(exp((1/2)*k))^2*rho^2*cos(k)+8*cos(k)*exp((1/2)*k)*exp((3/2)*k)*rho^2+4*exp(`–`((1/2)*k))*exp((1/2)*k)*rho^2+cos(k)^2*w^2-8*(exp((1/2)*k))^2*rho^2-4*w^2*(exp((1/2)*k))^2+4*exp((1/2)*k)*exp((3/2)*k)*rho^2-(exp(k))^2*w^2+2*w^2*exp(k)-w^2))/(exp((1/2)*k)*(1+cos(k))*lambda)}), Matrix(2, 2, {(1, 1) = -(2*I)*rho*(1+cos(k))*(exp(k)-1)/(I*(exp(k)+1)*(1+cos(k))*w*sqrt((1-cos(k))/(1+cos(k)))-sqrt(2)*sqrt(((((1/2)*w^2+2*rho^2)*cos(k)-(1/2)*w^2+2*rho^2)*exp(2*k)+((`–`(4)*rho^2+w^2)*exp(k)+(1/2)*w^2+2*rho^2)*cos(k)+(`–`(4)*rho^2-w^2)*exp(k)-(1/2)*w^2+2*rho^2)*(1+cos(k)))), (1, 2) = -(2*I)*rho*(1+cos(k))*(exp(k)-1)/(I*(exp(k)+1)*(1+cos(k))*w*sqrt((1-cos(k))/(1+cos(k)))+sqrt(2)*sqrt(((((1/2)*w^2+2*rho^2)*cos(k)-(1/2)*w^2+2*rho^2)*exp(2*k)+((`–`(4)*rho^2+w^2)*exp(k)+(1/2)*w^2+2*rho^2)*cos(k)+(`–`(4)*rho^2-w^2)*exp(k)-(1/2)*w^2+2*rho^2)*(1+cos(k)))), (2, 1) = 1, (2, 2) = 1})

 


 

Download eig_maple_2023.mw

 

 

@acer 

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:

@Carl Love 

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.

@segfault 

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.

@C_R 

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);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1744 and is the same as the version installed in this computer, created 2024, April 17, 19:33 hours Pacific Time.`

restart;

19628

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

y(x) = (1/362880)*x^9+(1/40320)*c__1*x^8+(1/5040)*c__2*x^7+(1/720)*c__3*x^6+(1/120)*c__4*x^5+(1/24)*c__5*x^4+(1/6)*c__6*x^3+(1/2)*c__7*x^2+c__8*x+c__9

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()

[-(1/2)*arctanh((1/2)*(1+2*c__1)^(1/2)*2^(1/2)/c__1^(1/2))*2^(1/2)/c__1^(1/2) = c__2, 1 = (-exp(2*c__2*c__1^(1/2)*2^(1/2))+1)*c__1^(1/2)*2^(1/2)/(exp(2*c__2*c__1^(1/2)*2^(1/2))+1)]

{c__1, c__2}

159.625

Error, (in fsolve) time expired

229.375

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

19628

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()

[-(1/2)*arctanh((1/2)*(1+2*c__1)^(1/2)*2^(1/2)/c__1^(1/2))*2^(1/2)/c__1^(1/2) = c__2, 1 = (-exp(2*c__2*c__1^(1/2)*2^(1/2))+1)*c__1^(1/2)*2^(1/2)/(exp(2*c__2*c__1^(1/2)*2^(1/2))+1)]

{c__1, c__2}

229.421

[]

229.562

#see? it finished instantly now.

 

 

Download why_solve_hangs_with_subscripted_SET_version_may_15_2024.mw

@Preben Alsholm 

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

 

 

@Preben Alsholm 

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

@Preben Alsholm 

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

 

 

@Kitonum 

Does not quit work.

P(y(x)+diff(y(x),x$2)+x=sin(x))

gives

The y(x) should be on the left side. OP said

and all source terms to be moved to the right side 

Which implies any terms without the dependent variable or its derivative.

 

1 2 3 4 5 6 7 Last Page 1 of 73