## Core of function...

Hi,

do anybody know, how I can see how a function is programmed? I want to know more about dsolve function and what is hidden behind.

Thank you all

## Normalize wavefunctions...

Hi,

Does anyone no how to normalize wavefunctions such that the plot on the right looks like the one on the left.

Here's my code:-

schro := {diff(psi(x), x, x)-(alpha*x^4+x^2-energy)*psi(x) = 0};

ic := {psi(3) = 0, (D(psi))(3) = 1};

Ic := [{psi(3) = 0, (D(psi))(3) = -1}, %$2]; E := [1.06538, 3.306, 5.74796]; schro1 := [seq(subs(energy = e, alpha = .1, schro), e = E)]; soln1 := [seq(dsolve(schro1[i] union Ic[i], {psi(x)}, type = numeric), i = 1 .. nops(E))]; with(plots); display(seq(odeplot(soln1[i], [x, psi(x)], -3 .. 3, color = [red, blue, green][i]), i = 1 .. nops(E))) Thanks in advance ## dsolve initial conditions... Asked by: Consider a simple differential equation: f1 := t -> sin(t); f2 := t -> cos(t); dsys := {diff(x(t), t) = x(t)*f1(t)+f2(t), x(0) = 3}; solution_procedure := dsolve(dsys, type = numeric, output = listprocedure); If initial condition is given like this: x(0)=3, then it compiles. But if I define x(0)=f1(3) then it gives an error: Error, (in dsolve/numeric/process_input) invalid specification of initial conditions, got HFloat(3.0) = sin(3) How can I handle this? ## Error, (in dsolve/numeric/bvp/convertsys) too few ... Asked by: Help me, please! If i have boundary conditions with D(psi), i have no problem. But if i have condition with psi(infinity) (which i need), Maple says "too few boundary conditions". Maybe i make stupid mistakes, but i don't see. restart; assume(r, nonnegative); ic_Re := &psi;Re(0) = 0, (D(&psi;Re))(0) = 0; ic_Im := &psi;Im(0) = 0, (D(&psi;Im))(0) = 0; V0 := 2.5; ERe := 1.5; EIm := 1.2; &hbar; := 6.582; mu := 938.27*(1/2); Q0 := 1.5; Rq := 4.5; Rv := 2.5; Q := proc (r) options operator, arrow; -Q0*exp(-r/Rq) end proc; V := proc (r) options operator, arrow; -V0*exp(-r/Rv) end proc; Eqn_&psi;Re := -&hbar;^2*(diff(&psi;Re(r), r, r)+2*(diff(&psi;Re(r), r))/r)/(2*mu)-ERe*&psi;Re(r)+V(r)+EIm*&psi;Re(r) = Q(r); Eqn_&psi;Im := -&hbar;^2*(diff(&psi;Im(r), r, r)+2*(diff(&psi;Im(r), r))/r)/(2*mu)-EIm*&psi;Re(r)-ERe*&psi;Im(r) = 0; F := dsolve({ic_Im, ic_Re, Eqn_&psi;Im, Eqn_&psi;Re}, numeric); plots[odeplot](F, [r, &psi;Re(r)], r = 0 .. 20, numpoints = 500); plots[odeplot](F, [r, &psi;Re(r)], r = 0 .. 20, numpoints = 500); restart; assume(r, nonnegative); ic_Re := &psi;Re(0) = 0, &psi;Re(infinity) = 0; ic_Im := &psi;Im(0) = 0, &psi;Im(infinity) = 0; V0 := 2.5; ERe := 1.5; EIm := 1.2; &hbar; := 6.582; mu := 938.27*(1/2); Q0 := 1.5; Rq := 4.5; Rv := 2.5; Q := proc (r) options operator, arrow; -Q0*exp(-r/Rq) end proc; V := proc (r) options operator, arrow; -V0*exp(-r/Rv) end proc; Eqn_&psi;Re := -&hbar;^2*(diff(&psi;Re(r), r, r)+2*(diff(&psi;Re(r), r))/r)/(2*mu)-ERe*&psi;Re(r)+V(r)+EIm*&psi;Re(r) = Q(r); Eqn_&psi;Im := -&hbar;^2*(diff(&psi;Im(r), r, r)+2*(diff(&psi;Im(r), r))/r)/(2*mu)-EIm*&psi;Re(r)-ERe*&psi;Im(r) = 0; F := dsolve({ic_Im, ic_Re, Eqn_&psi;Im, Eqn_&psi;Re}, numeric); Error, (in dsolve/numeric/bvp/convertsys) too few boundary conditions: expected 5, got 4 ## Plotting wavefunctions... Asked by: Hi, I have been trying to solve the Schrodinger equation for harmonic oscillators using dsolve and plot the the wavefunctions for the different energy levels. However I am struggling to plot all the different wavefuntions on the same plot. I also want to normalize the wavefunctions to help compare their shapes and values. Here's my code:- schro := {diff(psi(x), x, x)-(alpha*x^4+x^2-energy)*psi(x) = 0}; // d / d \\ / 4 2 \ \ { |--- |--- psi(x)|| - \alpha x + x - energy/ psi(x) = 0 } \\ dx \ dx // / ic := {psi(3) = 0, (D(psi))(3) = 1}; {psi(3) = 0, D(psi)(3) = 1} schro1 := subs(energy = 3.30687, alpha = .1, schro); soln1 := dsolve(schro1 union ic, {psi(x)}, type = numeric); // d / d \\ / 4 2 \ \ { |--- |--- psi(x)|| - \0.1 x + x - 3.30687/ psi(x) = 0 } \\ dx \ dx // / proc(x_rkf45) ... end; with(plots); [animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fieldplot, fieldplot3d, gradplot, gradplot3d, implicitplot, implicitplot3d, inequal, interactive, interactiveparams, intersectplot, listcontplot, listcontplot3d, listdensityplot, listplot, listplot3d, loglogplot, logplot, matrixplot, multiple, odeplot, pareto, plotcompare, pointplot, pointplot3d, polarplot, polygonplot, polygonplot3d, polyhedra_supported, polyhedraplot, rootlocus, semilogplot, setcolors, setoptions, setoptions3d, shadebetween, spacecurve, sparsematrixplot, surfdata, textplot, textplot3d, tubeplot] odeplot(soln1, [x, psi(x)], -3 .. 3); Thank in advance ## error for dsolve differential equation....... Asked by: hi..i have a problem for solving this nonlinear differential equationerror.mw  (1)  (2) ############################################################CHANGE OF VARIABLE::: x=y*L Download error.mw please help me thanks... ## what is syntax for solving 4th order ODE, BVP prob... Asked by: I am learning how to use Maple with boundary value ODE. Given this ODE y''''(x)+ lam* y(x) =0 with some B.C., say y(0)=0,y'(0)=0,y''(L)=0,y'''(L)=0, where L is length. I can't figure the correct syntax to use. It seems Maple do not like the syntax I am using, but it works on a second order ODE? Here is my attempt: restart; assume(lam>0); assume(L>0); bc:=y(0)=0,D[1](y)(0)=0,D[2](y)(L)=0,D[3](y)(L)=0; dsolve({diff(y(x),x$4)+lam*y(x)=0,bc},y(x));

Error is

Error, (in evalapply) too few variables for the derivative with respect to the 2nd variable
Error, (in dsolve) found the following equations not depending on the unknowns of the input system: {bc}

But on a simpler second order ODE, the syntax works

restart;
assume(lam>0); assume(L>0);
bc:=y(0)=0,D[1](y)(0)=0;
dsolve([diff(y(x),x$2)+lam*y(x)=0,bc],y(x)); No error. Is the syntax I am using in first example wrong? what would be the correct syntax? I googled for long time, and can't find one example that shows how to use BVP with higher order ODE. I am Maple newbie. ## how to fasten dsolve and is it possible to timeout... Asked by: how to fasten dsolve and is it possible to timeout faster if it know no solution earlier? i split into near 500 blocks of nested for loop, total around 42 billions trials i run in cmaple, i see it run the first 4 blocks of code and output to files, which are daff001, daff002, daff003 and daff004 it seems that it can run parallel intelligently though i write in serial lines. but it run a very long time, still running near first 4000 records window 10 use 3.4GB memory, only 4GB memory rest but 4000 records use more than 4GB memory i just hope to run 1000 records every day, hope 1000 records can be finished within a few hours and plan to run around 500days restart: read "D:\\daff2039mm.m": with(combinat): appendto("D:\\daff001.txt"); for ii from 1 to 1 do for jj from 1 to 1 do for kk from 1 to 1 do if ii < jj and jj < kk then if mm[ii] <> mm[jj] and mm[jj] <> mm[kk] then sol := dsolve([mm[ii] , mm[jj] , mm[kk] ],[a(t), b(t), c(t)]); if nops([sol]) = 1 then print([mm[ii], mm[jj], mm[kk]]); print(sol); print(" * **"); end if: end if: end if: od: gc(); od: od: restart: read "D:\\daff2039mm.m": with(combinat): appendto("D:\\daff002.txt"); for ii from 1 to 1 do for jj from 1 to 1 do for kk from 1 to 1001 do if ii < jj and jj < kk then if mm[ii] <> mm[jj] and mm[jj] <> mm[kk] then sol := dsolve([mm[ii] , mm[jj] , mm[kk] ],[a(t), b(t), c(t)]); if nops([sol]) = 1 then print([mm[ii], mm[jj], mm[kk]]); print(sol); print(" * **"); end if: end if: end if: od: gc(); od: od: restart: read "D:\\daff2039mm.m": with(combinat): appendto("D:\\daff003.txt"); for ii from 1 to 1 do for jj from 1 to 1 do for kk from 1001 to 2001 do if ii < jj and jj < kk then if mm[ii] <> mm[jj] and mm[jj] <> mm[kk] then sol := dsolve([mm[ii] , mm[jj] , mm[kk] ],[a(t), b(t), c(t)]); if nops([sol]) = 1 then print([mm[ii], mm[jj], mm[kk]]); print(sol); print(" * **"); end if: end if: end if: od: gc(); od: od: restart: read "D:\\daff2039mm.m": with(combinat): appendto("D:\\daff004.txt"); for ii from 1 to 1 do for jj from 1 to 26 do for kk from 2001 to 2001 do if ii < jj and jj < kk then if mm[ii] <> mm[jj] and mm[jj] <> mm[kk] then sol := dsolve([mm[ii] , mm[jj] , mm[kk] ],[a(t), b(t), c(t)]); if nops([sol]) = 1 then print([mm[ii], mm[jj], mm[kk]]); print(sol); print(" * **"); end if: end if: end if: od: gc(); od: od: restart: read "D:\\daff2039mm.m": with(combinat): appendto("D:\\daff005.txt"); for ii from 1 to 1 do for jj from 26 to 51 do for kk from 2001 to 2001 do if ii < jj and jj < kk then if mm[ii] <> mm[jj] and mm[jj] <> mm[kk] then sol := dsolve([mm[ii] , mm[jj] , mm[kk] ],[a(t), b(t), c(t)]); if nops([sol]) = 1 then print([mm[ii], mm[jj], mm[kk]]); print(sol); print(" * **"); end if: end if: end if: od: gc(); od: od: ## Error, (in dsolve/numeric/bvp) singularity encount... Asked by: Hi may every one help to me for dsolve this differentia1l equation? error: Error, (in dsolve/numeric/bvp) singularity encountered Turbulent2-kw.mw Download Turbulent2-kw.mw ## I try to solve a DE and maple crushes as well as m... Asked by: Hello I am trying to solve interactively the following DE with initial condiotion b(0)=1 and maple freezes as well as my pc.Can you help me? ## How to obtain all solutions from dsolve?... Asked by: How does one obtain all solutions from dsolve? I see an option called Allsolutions, but this seems to only apply to solve and other functions. It does not work with dsolve. For example, maple gives one solution for the following first order non-linear ODE. But the ODE has another solution y(x)=0 as well. How does one tell Maple to return all solutions? I am interested in this when using the 'implicit' option mainly. Here is an example restart; num:=-(exp(x)*sin(y(x))-2*y(x)*sin(x)): den:=(exp(x)*cos(y(x))+2*cos(x)): eq:=diff(y(x),x)=num/den; r0:=dsolve(eq,y(x)); But when I tried y(x)=0, it turned out to also be a solution odetest(y(x)=0,eq); 0 But dsolve did not return this solution on its own along with the first one. But on another example, Maple did well, and returned all solutions. Here is the other example eq:=(2*x*y(x)^2+2*y(x))+(2*x^2*y(x)+2*x)*diff(y(x),x); dsolve(eq=0,y(x),'implicit'); In the above, Maple returned the two solutions. Is there a correct way to tell Maple dsolve to return all solutions all the time? Why did it return both solution in the above example, but not in the first example? I am maple newbie. Thank you. ## How does odeplot sample the solution of an ODE ?... Asked by: Hi everybody, I solve an ODE system numerically with the command Tend := ….. : sol := dsolve(MySys, numeric, method=rosenbrock, range=0..Tend): # or rkf45 One of my colleagues wants the solution in array form for using it in a spreadsheet (namely Excel). Here is an example of what I do : data := plottools:-getdata( plots:-odeplot(sol, […..], 0..Tend, refine = Q) ) : # Q rational result := data[3]: ExcelTools:-Export (result, …) To understand the following, you need to know that the time step varies by several decades (at least 3 or 4). and that numfun is typically in the order of 10^5 When I ask Maple to construct data , Maple seems to sample the solution sol according to the local time step dsolve has selected (and probably some other parameters ?) Because this time step varies in very large proportions, the result is sometimes a concentration of points in regions where the solution is rapidly changing (which is desirable) … with some lacunarity in slow varying regions. To obviate this, sometimes poor appearance, I used to force Maple to compute the solution by regularly sampling the range ]0, Tend[ and combining this array with the original one (result ). But this not satisfactory for I do not avoid lacunarity region (unless I proceed in some ad hoc way) Here is my question : Could you give me some elements about the way odeplot adapts its sampling strategy according to the local time step, the budget N (the Q value I guess) and maybe numfun ? Thank you in advance ## not answer found for dsolve??... Asked by: hi in attached file below not answer found for dsolve? please help me thanks.. dsove.mw  >  >  >  >  >  >  >  (1)  >  >  (2)  >  >  >  > Download dsove.mw ## Error for (in EpResult) ... Asked by: what does this mean:"Error, (in EpResult) cannot evaluate the solution further right of 0.36919453e-2, probably a singularity" as I cannot find any relevant material of this error. I am simulating a condition and get to the final stage of calculation, and this error occurs.... ## dsolve return nothing... Asked by: hi. i have a system of ODEs. is there any answer ? rho is constant !  > restart:Physics:-Assume(rho=constant)  (1)  > #rho=10:  > sys:={8*g(t)^3*diff(g(t),t$2)+4*(g(t)*diff(g(t),t))^2+1=0,rho=-1/g(t)-2*(diff(g(t),t)+t*diff(g(t),t\$2))-t/(2*g(t)^3),rho=(-t/g(t))*(diff(g(t),t))^2+t/(4*g(t)^3)}
 (2)
 > dsolve(sys)
 >