MaplePrimes Questions

This first order ode diff(y(x),x)=sqrt(x*y(x)+x); generates internal dsolve exception when called with IC y(0)=1

Attached worksheet. No error if no IC is used. tracelast is shown also.

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1844 and is the same as the version installed in this computer, created 2025, January 25, 22:5 hours Pacific Time.`

restart;

ode:=diff(y(x),x)=sqrt(x*y(x)+x);

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

IC:=y(0)=1;

y(0) = 1

dsolve(ode)

x^2/((-x^2+3*(x*y(x)+x)^(1/2))*(-x^3+9*y(x)+9))+3*(x*y(x)+x)^(1/2)/((-x^2+3*(x*y(x)+x)^(1/2))*(-x^3+9*y(x)+9))-c__1 = 0

dsolve([ode,IC])

Error, (in dsolve) invalid input: convert expects 2 or more arguments, but received 1

tracelast

 dsolve called with arguments: [diff(y(x), x) = (x*y(x)+x)^(1/2), y(0) = 1], arbitraryconstants = subscripted, atomizenames = true, build = false, numeric = false, type = none
 #(dsolve,80): error

 \`dsolve/IC\` called with arguments: [diff(y(x), x) = (x*y(x)+x)^(1/2), y(0) = 1], {y(x)}, skipimplicit = false, skippparticularsolforlinearODEs = true, solution = {}, usesolutions = particular and general
 #(\`dsolve/IC\`,64): draft := procname(_passed,':-usesolutions = "general"');

 \`dsolve/IC\` called with arguments: [diff(y(x), x) = (x*y(x)+x)^(1/2), y(0) = 1], {y(x)}, skipimplicit = false, skippparticularsolforlinearODEs = true, solution = {}, usesolutions = general
 #(\`dsolve/IC\`,229): ANS := \`dsolve/IC/implicit\`(ODEs,funcs,ICs,_rest,zz,':- computedgeneralsolution' = computedgeneralsolution);

 \`dsolve/IC/implicit\` called with arguments: {diff(y(x), x) = (x*y(x)+x)^(1/2)}, {y(x)}, [{y(0) = 1}], computedgeneralsolution = computedgeneralsolution, skippparticularsolforlinearODEs = true, solution = {}, usesolutions = general
 #(\`dsolve/IC/implicit\`,126): error

Error, (in dsolve) invalid input: convert expects 2 or more arguments, but received 1

 locals defined as: C_val = {_C1 = 1/18}, Y = y(x), extra = [implicit, singsol = all], ode = diff(y(x), x)-(x*y(x)+x)^(1/2), sol = (Array(1..1, {(1) = x^2/((-x^2+3*(x*y(x)+x)^(1/2))*(-x^3+9*y(x)+9))+3*(x*y(x)+x)^(1/2)/((-x^2+3*(x*y(x)+x)^(1/2))*(-x^3+9*y(x)+9))-_C1 = 0})), y = y, x = x, zz = {}, n = 1, N = 1, ans = (Array(1..1, {(1) = })), return_implicit = false, unable_to_make_explicit = (Array(1..1, {(1) = })), x0 = 0, soln = (y(x) = (1/9)*x^3-(2/3)*2^(1/2)*x^(3/2)+1, y(x) = (1/9)*x^3+(2/3)*2^(1/2)*x^(3/2)+1), max_DY = diff(y(x), x), CYn = CYn, Zn_or_NNn = {}, diff_ord = 1, high_degree = FAIL, indets_ode_Cn = {}, j = j, radical_solutions = radical_solutions, outputcontainsgeneralsolution = true, indicated_integrator = (), Ints = {}, integrator = integrator, implicit_soln = [x^2/((-x^2+3*(x*y(x)+x)^(1/2))*(-x^3+9*y(x)+9))+3*(x*y(x)+x)^(1/2)/((-x^2+3*(x*y(x)+x)^(1/2))*(-x^3+9*y(x)+9))-1/18 = 0], radicals_of_Y_in_implicit_soln = {(x*y(x)+x)^(1/2)}, SOL = SOL, assumptions = assumptions, covered = covered, evaluation_points_and_difford = [0, 0], k = k, previous_region = previous_region, region = region, series_solution = (), soln_series = soln_series, valid_solution = valid_solution

 


 

Download dsolve_internal_error_convert_feb_25_2025.mw

 

Hi,

I'm trying to use the Explore command to examine the effect of two parameters (mu and sigma) on the density function curve. The visualization isn't very optimal, especially with the mu parameter, and it's difficult to add options (range, color, gridlines, etc.). Any suggestions to optimize this idea? Thanks for your insights!

Q_Explore.mw

when we have ode equation we say what is type of equation then  i want solve by this method say the name of method and if possible i want to solve this equation by the method step by step too, maple can do that? also can we plot the solution or any geometricall presentation , also i have error in writing exact form of equation

restart

"with(Student[ODEs]): "

with(DETools)

ode1 := diff(y(x), x)+2*x*y(x) = x

diff(y(x), x)+2*x*y(x) = x

(1)

Type(ode1)

{linear, separable}

(2)

W := dsolve(ode1)

y(x) = 1/2+exp(-x^2)*c__1

(3)

odetest(W, ode1)

0

(4)

ODESteps(ode1)

"[[,,"Let's solve"],[,,(ⅆ)/(ⅆx) y(x)+2 x y(x)=x],["•",,"Highest derivative means the order of the ODE is" 1],[,,(ⅆ)/(ⅆx) y(x)],["•",,"Separate variables"],[,,((ⅆ)/(ⅆx) y(x))/(2 y(x)-1)=-x],["•",,"Integrate both sides with respect to" x],[,,∫((ⅆ)/(ⅆx) y(x))/(2 y(x)-1) ⅆx=∫-x ⅆx+`c__1`],["•",,"Evaluate integral"],[,,(ln(2 y(x)-1))/2=-(x^2)/2+`c__1`],["•",,"Solve for" y(x)],[,,y(x)=((e)^(-x^2+2 `c__1`))/2+1/2]]"

(5)

ode2 := (sin(x)*tan(x)+1)*dx-cos(x)*sec(y(x))^2*dy = 0

(sin(x)*tan(x)+1)*dx-cos(x)*sec(y(x))^2*dy = 0

(6)

Type(ode2)

Error, (in Student:-ODEs:-Type) could not determine the solving variable. Please specify it as an extra argument in the form: y(x)

 
 

NULL

Download ode-example.mw

i want try all number to my parameter for check the shape of plot there is any way for doing that?

restart

with(plots)

M := 4*b^2*beta*((a*y-2*alpha*t+x)*b^2+a*(-2*beta*t+a*(a*y-2*alpha*t+x)))/(-b^6*beta*y^2+(-4*t*y*beta^2+(-2*a^2*y^2+(4*(alpha*t-(1/2)*x))*y*a-4*(alpha*t-(1/2)*x)^2)*beta+3*a)*b^4+(-4*t^2*beta^3+4*a*t*(a*y-2*alpha*t+x)*beta^2-a^2*(a*y-2*alpha*t+x)^2*beta+6*a^3)*b^2+3*a^5)

alpha = 1; beta := 1; a := -1; b := -2; t := 0

alpha = 1

 

1

 

-1

 

-2

 

0

(1)

plots:-contourplot(M, x = -100 .. 100, y = -100 .. 100, title = contour, grid = [100, 100], colorbar = false)

 
 

NULL

Download control-trajectory.mw

Hi,

just a quick design question regarding my animation. The color "AliceBlue" disappears from my background... Could it be a background option issue?

Q_AlceBlue_background.mw

THis IC for Abel ode is not valid and should result in no solution. But instead of returning NULL, dsolve throws internal error called Error, (in dsolve) invalid limiting point

restart;

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1844 and is the same as the version installed in this computer, created 2025, January 25, 22:5 hours Pacific Time.`

ode:=diff(y(x),x)-x^a*y(x)^3+3*y(x)^2-x^(-a)*y(x)-x^(-2*a)+a*x^(-a-1) = 0;

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

DEtools:-odeadvisor(ode);
sol:=dsolve([ode,y(1)=1])

[_Abel]

Error, (in dsolve) invalid limiting point

tracelast;

 dsolve called with arguments: [diff(y(x), x)-x^a*y(x)^3+3*y(x)^2-x^(-a)*y(x)-x^(-2*a)+a*x^(-a-1) = 0, y(1) = 1], arbitraryconstants = subscripted, atomizenames = true, build = false, numeric = false, type = none
 #(dsolve,80): error

 \`dsolve/IC\` called with arguments: [diff(y(x), x)-x^a*y(x)^3+3*y(x)^2-x^(-a)*y(x)-x^(-2*a)+a*x^(-a-1) = 0, y(1) = 1], {y(x)}, skipimplicit = false, skippparticularsolforlinearODEs = true, solution = {}, usesolutions = particular and general
 #(\`dsolve/IC\`,64): draft := procname(_passed,':-usesolutions = "general"');

 \`dsolve/IC\` called with arguments: [diff(y(x), x)-x^a*y(x)^3+3*y(x)^2-x^(-a)*y(x)-x^(-2*a)+a*x^(-a-1) = 0, y(1) = 1], {y(x)}, skipimplicit = false, skippparticularsolforlinearODEs = true, solution = {}, usesolutions = general
 #(\`dsolve/IC\`,277): zz := map(op,{\`dsolve/IC/_C\`({ANS[i]},funcs,x,ics)});

 \`dsolve/IC/_C\` called with arguments: {y(x) = -exp(2*x^(-a+1)/(a-1))/(_C[1]-2*2^(2*(a+1)/(a-1))*(1/(-a+1))^((a+1)/(a-1))*(2^(-(5*a-3)/(a-1))*(1/(-a+1))^(-(a+1)/(a-1))*x^(2*a)*(-a+1)^2*(x^(-a+1)/(-a+1))^(1/(a-1))*(-4*x^(-a+1)*a^2/(-a+1)+8*a*x^(-a+1)/(-a+1)-4*x^(-a+1)/(-a+1)+2*a-2)*WhittakerM(-(a+1)/(a-1)+1/(a-1), -1/(a-1)+1/2, 4*x^(-a+1)/(-a+1))*exp(-2*x^(-a+1)/(-a+1))/((a+1)*(-3+a))-2^(-(3*a-1)/(a-1))*(1/(-a+1))^(-(a+1)/(a-1))*x^(2*a)*WhittakerM(-(a+1)/(a-1)+1/(a-1)+1, -1/(a-1)+1/2, 4*x^(-a+1)/(-a+1))*(-a+1)^2*(x^(-a+1)/(-a+1))^(1/(a-1))*exp(-2*x^(-a+1)/(-a+1))/((a+1)*(-3+a)))/(-a+1))^(1/2)+x^(-a)}, {y(x)}, x, [y(1) = 1]
 #(\`dsolve/IC/_C\`,1): ans := \`dsolve/IC/_C/do\`(solns,depvars,t,inits,'evaluated_ans', "default",':-giveup = giveup');

 \`dsolve/IC/_C/do\` called with arguments: {y(x) = -exp(2*x^(-a+1)/(a-1))/(_C[1]-2*2^(2*(a+1)/(a-1))*(1/(-a+1))^((a+1)/(a-1))*(2^(-(5*a-3)/(a-1))*(1/(-a+1))^(-(a+1)/(a-1))*x^(2*a)*(-a+1)^2*(x^(-a+1)/(-a+1))^(1/(a-1))*(-4*x^(-a+1)*a^2/(-a+1)+8*a*x^(-a+1)/(-a+1)-4*x^(-a+1)/(-a+1)+2*a-2)*WhittakerM(-(a+1)/(a-1)+1/(a-1), -1/(a-1)+1/2, 4*x^(-a+1)/(-a+1))*exp(-2*x^(-a+1)/(-a+1))/((a+1)*(-3+a))-2^(-(3*a-1)/(a-1))*(1/(-a+1))^(-(a+1)/(a-1))*x^(2*a)*WhittakerM(-(a+1)/(a-1)+1/(a-1)+1, -1/(a-1)+1/2, 4*x^(-a+1)/(-a+1))*(-a+1)^2*(x^(-a+1)/(-a+1))^(1/(a-1))*exp(-2*x^(-a+1)/(-a+1))/((a+1)*(-3+a)))/(-a+1))^(1/2)+x^(-a)}, {y(x)}, x, [y(1) = 1], evaluated_ans, default, giveup = giveup, usecansolve = false
 #(\`dsolve/IC/_C/do\`,133): Solns := map((u, S) -> map(limit,S,op(u)),csol,Solns);

 limit called with arguments: y(x) = -exp(2*x^(-a+1)/(a-1))/(_C[1]-2*2^(2*(a+1)/(a-1))*(1/(-a+1))^((a+1)/(a-1))*(2^(-(5*a-3)/(a-1))*(1/(-a+1))^(-(a+1)/(a-1))*x^(2*a)*(-a+1)^2*(x^(-a+1)/(-a+1))^(1/(a-1))*(-4*x^(-a+1)*a^2/(-a+1)+8*a*x^(-a+1)/(-a+1)-4*x^(-a+1)/(-a+1)+2*a-2)*WhittakerM(-(a+1)/(a-1)+1/(a-1), -1/(a-1)+1/2, 4*x^(-a+1)/(-a+1))*exp(-2*x^(-a+1)/(-a+1))/((a+1)*(-3+a))-2^(-(3*a-1)/(a-1))*(1/(-a+1))^(-(a+1)/(a-1))*x^(2*a)*WhittakerM(-(a+1)/(a-1)+1/(a-1)+1, -1/(a-1)+1/2, 4*x^(-a+1)/(-a+1))*(-a+1)^2*(x^(-a+1)/(-a+1))^(1/(a-1))*exp(-2*x^(-a+1)/(-a+1))/((a+1)*(-3+a)))/(-a+1))^(1/2)+x^(-a), _C[1] = exp((4*I)*Im(1/(a-1)))*infinity, parametric = false
 #(limit,2): return map(thisproc,_passed)

 limit called with arguments: y(x), _C[1] = exp((4*I)*Im(1/(a-1)))*infinity, parametric = false
 #(limit,33): error "invalid limiting point"

Error, (in dsolve) invalid limiting point

 locals defined as: ddir = ddir, dexpr = y(x), fexpr = fexpr, r = r, x = _C[1], fL = fL, L = exp((4*I)*Im(1/(a-1)))*infinity, efloat = efloat, lfloat = lfloat, ind_dexpr = ind_dexpr, ind_L = ind_L, lexpr = lexpr, t = t, limr = limr, liml = liml, pt = (_C[1] = exp((4*I)*Im(1/(a-1)))*infinity), inertfunctions = {}, limitX = limitX, parameters = parameters, Y = Y, limc = limc, cexpr = cexpr, texpr = texpr, bexpr = bexpr, limt = limt, limb = limb, param = param, c = c, N = N, Z = Z, P = P, o = o, e = e, uneval = uneval, i = i, A = A, cond = cond, ll = ll, rr = rr

 


 

Download internal_error_instead_of_no_solution.mw

Is there an equivalent of currentdir() which instead of returning current working directory, returns the directory of the file being read. So assume I have an ".mm" or ".mpl" file saved in some location and there is another file with a location fixed relative to this file, but not fixed in absolute location on the computer and not fixed relative with current working directory. One natural thing is to have a line in the first file that takes its current location (not current working location of the user!) and then use the fixed relative path info, and then gives the location of the second file to the user. Using currendir won't help here because current working directory is not necessarily the same as the location of the file you are reading, the first file. One may say the user is reading the first file so he knows already its location, right? Well, if the user is also the writer of the file, sure, not a problem, he can manually edit the lines of the file and put that location inside the file instead of using currentdir etc. However, if the user is not the writer and also does not know how to edit or whatever else reason, then the file should be able to inform Maple of its own location, so that's why something like currentdir() but not for the working directory, instead for currently being read file's directory is helpful. I checked FileTools package quickly and couldn't notice anything like what I want. Anyone have any clue on name of such command if exists or any other trick that does what I want (except expecting the user to do something ^_^ so all from the writer's side please ^_^).

Hi, I want to generate a matrix of variables, say, something like, 

n:=4:

Matrix(n, n, [[a_11, a_12, a_13, a_14], [a_12, a_22, a_23, a_24], [a_13, a_23, a_33, a_34], [a_14, a_24, a_34, a_44]]) :

How can I do it automatically for arbitrary values of n?

is(Im(x)*x = 0);
                              true

 

Surely, Im(i)*i != 0?

How can I convert sinh(x)/cosh(x) to tanh(x) ?

One of the most difficult/nice tasks from my collection of old problems:
Calculate Int(from 0 to 1)Int(from 0 to 1)[1/(1-x*y)]dxdy .

Lately, I get this error when uploading worksheet (using Green arrow) and also say show content

                 Failed to load the worksheet /maplenet/...

It only uploads the worksheet .mw, but it does not display the content as before.

How to correct this and why does it happen now?

I am using code form How-To-Find-The-Exact-Line-Number-And which is very useful in showing line number where exception happend in my .mla code.

The only issue is that all such messages are buffered by Maple, and only see them after the program is finished running, which can take hrs.

While the program is running, I only see the this

print(sprintf("error happened in %a: %s",
                lastexception[1],
                StringTools:-FormatMessage(lastexception[2..-1])));

But the output of the following code, do not show at same time:

if lasterrorlocus<>'lasterrorlocus' then
            print(lasterrorlocus);
            showsource();
end if; 

The above only shows when the whole code is finished running and returns. Not while it is running.

I'd like both to show up at same time. For some reason, it seems the the above either evaluated at the very end of the progam running, or showsource() is buffering it. I looked at help for command
showsource(), but see no settings to tell it not to buffer.

I tried to use fflush and FileTools:-Flush but not sure which file to use. Tried 'default' and 'STREAM' and both do not work.

It will be much more useful and easier to see the location of source code error, in same order with the other message printed, instead of all them at the very end.

To show this, below is an example. It is the same exact code by acer in the above question, I just changed my module to generate error, and put delay after that to simulate long running program.

The output shows that the list of source do not show right away, and only shows when the delay is completed. But the print message giving the exception name does show right away. First, here is screen shot showing what happens now

I'd like the put to show like this instead

Here is worksheet

Download A.mw

And here is A.mpl file, which should be put inside the same folder as indicated in A.mw, for example, C:\\tmp

#see https://www.mapleprimes.com/questions/233724-How-To-Find-The-Exact-Line-Number-And

A := module()  
    local B:=module()
        export foo:=proc(n)
            1/n;
        end proc;
    end module;

    export main:=proc()
        try
           B:-foo(0);
        catch:
          if lasterrorlocus<>'lasterrorlocus' then
            print(lasterrorlocus);
            showsource();
            #fflush('default');
            #fflush('terminal');           
            #fflush(STREAM);
            #FileTools:-Flush('default');
          end if; 
          print(sprintf("error happened in %a: %s",
                lastexception[1],
                StringTools:-FormatMessage(lastexception[2..-1])));
        end try;

        print("will now pause a little");
        Threads:-Sleep(5);
        print("OK, lets sleep more");
        Threads:-Sleep(5);
        print("Done");

    end proc;
end module:

Hi,

I am looking to design a learning sequence on the applications of integral calculus (arc length, area under the curve, solid of revolution). The animation of the solid is not optimal because I want to display the revolution over [1,2] while maintaining a global view of the curve over [-3,3]. Thank you for your insights.

 

S7_Arc_Intégrale_Animation.mw

Here is an example of timelimit hanging when adding assuming positive to the call to odetest.

Anyone could find why this happens?

timelimit still does not work well in Maple to this day.

Anyone with beta Maple 2025 could be able to check if this still hangs there or is it fixed?  

timelimit() is the most critical function for me in Maple. Since if it does not work, the whole program hangs and nothing can be done when this happens other than killing the program and not process the input that causes Maple to hang.

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

Physics:-Version()

`The "Physics Updates" version in the MapleCloud is 1844 and is the same as the version installed in this computer, created 2025, January 25, 22:5 hours Pacific Time.`

libname;

"C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib", "C:\Program Files\Maple 2024\lib"

restart;

ode:=sqrt(x)*(2*x*diff(u(x), x) + 3*u(x))/2 = sqrt(x)*(12^(2/3)*(-9*u(x)*a + sqrt(3)*sqrt(27*u(x)^2*a^2 - 4))^(2/3) + 12)*12^(2/3)/(72*(-9*u(x)*a + sqrt(3)*sqrt(27*u(x)^2*a^2 - 4))^(1/3));

(1/2)*x^(1/2)*(2*x*(diff(u(x), x))+3*u(x)) = (1/72)*x^(1/2)*(12^(2/3)*(-9*u(x)*a+3^(1/2)*(27*u(x)^2*a^2-4)^(1/2))^(2/3)+12)*12^(2/3)/(-9*u(x)*a+3^(1/2)*(27*u(x)^2*a^2-4)^(1/2))^(1/3)

sol:=u(x) = sqrt(-2*12^(1/3)*(2*a - 1 + sqrt(4*a^2 - 4*a - 3)))*12^(1/3)*(-2*a + 3 + sqrt(4*a^2 - 4*a - 3))/36;

u(x) = (1/36)*(-2*12^(1/3)*(2*a-1+(4*a^2-4*a-3)^(1/2)))^(1/2)*12^(1/3)*(-2*a+3+(4*a^2-4*a-3)^(1/2))

timelimit(30, ( odetest(sol,ode) assuming positive ) ); #hangs. Waited for hrs.

timelimit(30, odetest(sol,ode) ); #does not hang, returns right away.

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

 


 

Download hang_on_odetest_feb_21_2025.mw

 

 

 

 

 

First 6 7 8 9 10 11 12 Last Page 8 of 2403