Preben Alsholm

13613 Reputation

22 Badges

19 years, 226 days

MaplePrimes Activity

These are replies submitted by Preben Alsholm

@acer Thank you acer.

@acer I use that kind of thing in my maple.ini file , but in a version using sscanf called to my attention by Joe Riel a few years ago.

I need the digit after the period.
So I would use:

### Also parse: 
N:=parse(str[7 .. StringTools:-Search(".",str)+1]); # i.e. +1 instead of -1

This makes it possible in my maple.ini file to distinguish between versions as in
if N> 2023.2 then .... end if.

So I have been using this:

   N:=op(sscanf(VERSION, "Maple %f[0-9]"));  
   forget(evalf); #Otherwise the remember table will have an entry like 2019.2 = (2019.2, 10)
# I don't quite see the need for forget anymore.


@nm Try this:


sol:=y(x) = (exp(RootOf(-sin(x)*tanh(1/2*_Z+1/2*c__1)^2+sin(x)+exp(_Z)))+sin(x))/sin(x);
ode:=diff(y(x),x)-cot(x)*(y(x)^(1/2)-y(x)) = 0;


eval(rhs(sol1_0),x=-Pi/2); # 0
eval(rhs(sol2_0),x=-Pi/2); # 4
dsolve({ode,y(-Pi/2)=0});# y(x) = 0
solDs2:=simplify(value(solDs2)) assuming x<0,x>-Pi;
plot(rhs(solDs2)-rhs(sol2_0),x=-Pi..0,style=point); # basically zero
plot(rhs(solDs2),x=-Pi..0,0..15,color=red); p1:=%: 
plot(rhs~([sol1_0,sol2_0]),x=-Pi..0,0..15); p2:=%:


Interestingly you find two solution just as dsolve does, but one of the dsolve solutions is just the trivial y(x)=0.
Both yours and dsolve's can be correct since the initial value problem with y(-Pi/2) = 0 doesn't satisfy the requirements for uniqueness.
Note added:
Your sol1_0 isn't in fact a solution to the ode in the interval I consider here.
The value of sol1_0 at x=-Pi/4 is 1 - 2*2^(1/4) + sqrt(2) which is positive.
Using dsolve with that initial condition gives a solution that is valid on the interval
-27*Pi/32 ..-5*Pi/32.
On that interval sol1_0 and the dsolve solution differ:

@jestrup Sorry, now I get it. 
By "This could be relevant when using Maple for a test"  you mean that you don't want students to be able to access the AI formula assistant during a test.
As long as the students have a copy of Maple on their computers, I don't see any way you can do that except maybe for turning off your wi-fi.

@vv I tried the following for solve and for SolveTools:-SemiAlgebraic.

sol3:=solve({torus1<0,x>=0,y>=0,z>=0}, [x,y,z]);
numelems(sol3); # 3
sol2:=SolveTools:-SemiAlgebraic({torus1<0,x>=0,y>=0,z>=0}, [x,y,z]);
numelems(sol2); # 3
sol2[1]; #same as above
sol2[2]; #same as above
sol2[3]; #same as above

sol3 and sol2 appears to say the same pairwise.

I understand the output from solve in this way:

torus:= (x^2+y^2+z^2 + R^2-r^2)^2 - 4*R^2*(x^2+y^2):
sol1:=solve(torus1<0, [x,y,z]); # It should be easy for Maple
sol1[1]; # x = 0 is a requirement for this solution
sol1[2]; # x = 0 is also a requirement for this solution
### Thus this doesn't make any sense:
eval(sol1, [x=3,y=2,z=0]);

Note: From the output of eval(torus1, [x=3,y=2,z=0]) , however,  we can conlude that solve didn't find all solutions at all.

It works for me with a second order ode. In that case the equation is not turned into a system of first order.



########### 2nd order
ode := 3*diff(y(x), x, x) + 4*diff(y(x), x) + 2*y(x) = 0;


Note: If you continue the worksheet with the third order ode:
diff(y(x), x, x, x ) + 3*diff(y(x), x, x) + 4*diff(y(x), x) + 2*y(x) = 0;
Then after the "Too many levels of recursion" error the worksheet is ruined.
Try removing all output ( Ctrl+D), then after restart you are NOT back to normal.
You must copy the input code to a new worksheet.

I tried starting from x = 1 and found that for a solution to exist at zero in the limiting sense x -> 0 right,
it is necessary that D(y)(1) = 2*y(1).

u:=-1/3*dy1/x + 2/3*y1/x; # The last 2 terms

@Aung Why do you insist on turning
2*hypergeom([1/2, -k/2], [1 - k/2], csc(omega*T)^2);
into standard functions?

If you have any reason for using that expression it should be OK without turning it into standard functions.

@dharr All of these work:


@Aung Austin Roche reported on the bug fix, not your problem!
What you want to do is still a mystery to me.
The title of your question is "how to sovle this diffenential equation in maple worksheet",
which suggests that you want to solve a differential equation.

Even if the integral could be found you don't have a differential equation:
What you have right now is:

eq:=int((1 - omega)^(k + 1), omega = 0 .. 1) = C*int((1 - sigma*sin(2*Pi*N))^k, N = 0 .. N);
## Now with Physics update 1717 OK with N=0..N
eq2:=simplify(eq) assuming k>-2;
# What do you want to do with eq2?


@nm I experimented a little. Reducing the degree of the denominator from 3/2 helps to prevent crash:

u:=Int(1/alpha^(3/2)*sin(1/2*3^(1/2)*ln(alpha))*sin(alpha)*3^(1/2),alpha = 0 .. x);
u1:=Int(1/alpha^(3/2-10^(-6))*sin(1/2*3^(1/2)*ln(alpha))*sin(alpha)*3^(1/2),alpha = 0 .. x);
value(u1); # 1499999/1000000 # No crash

I kept going:

u:=Int(1/alpha^(3/2)*sin(1/2*3^(1/2)*ln(alpha))*sin(alpha)*3^(1/2),alpha = 0 .. x);
u2:=Int(1/alpha^(3/2-10^(-16))*sin(1/2*3^(1/2)*ln(alpha))*sin(alpha)*3^(1/2),alpha = 0 .. x);
value(u2); # 3/2-10^(-16) No crash
u3:=Int(1/alpha^(3/2+10^(-16))*sin(1/2*3^(1/2)*ln(alpha))*sin(alpha)*3^(1/2),alpha = 0 .. x);
value(u3); # 3/2+10^(-16) No crash
value(u); #  3/2 Crash

So the exponent of the denominator being exactly 3/2 seems critical.

@nm I still got the crash after having renamed my maple.ini file.

I notice that C_R uses Windows 10. I use Windows 11, but that could hardly make any difference (?)

I get the crash in Windows and with Physics:-Version() 1715 and also with the previous 1714.
I also get the crash if I rename the Physics Updates folder 2024 to something else, in my case 2024_temp.

If I use the workaround proposed by Thomas Richard I don't get any crash.

@Aung Let us look at your equation after first having replaced N with x as variable of integration and pi with Pi.
Since you say that k is a material constant I suppose we may assume that it is positive:
But we only need k>-2.

eq:=int((1 - omega)^(k + 1), omega = 0 .. 1) = C*int((1 - sigma*sin(2*Pi*x))^k, x = 0 .. N);
eq2:=simplify(eq) assuming k>-2;
# What do you want to do with eq2?


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