Maple 18 Questions and Posts

These are Posts and Questions associated with the product, Maple 18

I have been using 'MemoryInUse()' to try to track down a memory leak that is crashing my Maple-based simulation. The problematic proc seems to be ProbDStarLNu which calculates the probablity of decay as a function of the angles of the decay product. It gets called a lot in acceptance rejection decay generation.

'MemoryInUse()' slows it down a lot. It also seemed to give weird results to me. I calculate the mem used on entry and then after the 4 trig functions have been called. The amount of mem 'in use' goes down after the trig functions are called. I was suspecting they were the source of the leak, but they seem almost an anti-leak.

This weird behavior caused me to write my own mem counting proc ('memUsed') based on summing over the results of 'mem:= kernelopts(memusage)'.

It is much faster. It gives nearly but not quite the same numbers. It still goes "backward" when the trig functions are called. Most of the mem growth comes from the algebra that follows the trig.

Why would that be?

I have included code for 'ProbDStarLNu'. It's pretty simple.

I'm trying to use CodeTools[Profile] to investigate my memory leak and the effect or lack there of of 'forget' to improve it.

I copied my code from an example:

with(CodeTools[Profiling]);
 [Allow, Build, Coverage, GetProfileTable, Ignore, IsProfiled, 

   LoadProfiles, Merge, PrintProfiles, Profile, Remove, 

   SaveProfiles, Select, SortBy, UnProfile]

Profile([PickAngles(1.0, 1.0, 1.0)]);
Error, (in CodeTools:-Profiling:-Profile) unexpected argument(s)

The 'unexpected argument' is the 'result' from 'PickAngles'. I've tried with and w/o the '[]' but it does the same thing failing to recognize that 'PickAngles' is a procedure.

The example I used is here:

https://www.maplesoft.com/support/help/maple/view.aspx?path=CodeTools%2FProfiling%2FProfile procedure.

I did what to make of the subscript Profiles in the example so I used '[Profiles]' and that worked or seemed to.

I have a equation

((D@@2)(theta))(eta) = -(1/2)*(D(theta))(eta)*(-2*(D(phi))(eta)*beta*epsilon*lambda*D[B]+2*(D(phi))(eta)*beta*epsilon*mu*D[B]+f(eta)*sin(alpha)*beta*nu+2*(D(theta))(eta)*gamma*epsilon*D[t]-2*(D(theta))(eta)*beta*epsilon*D[t]+cos(alpha)*beta*eta*nu)/(beta*sigma)

and a parameters expression

Pr:=nu/sigma; N[b] := epsilon*D[B](mu-lambda)/sigma; N[t] := epsilon*D[t](gamma-beta)/(gamma*sigma); Le := nu/D[B]

How can I seperate common terms and substitute this parameters and got this following expression

((D@@2)(theta))(eta) = -(1/2)*Pr*(D(theta))(eta)*eta*cos(alpha)-(1/2)*Pr*(D(theta))(eta)*sin(alpha)*f(eta)-N[b]*(D(theta))(eta)*(D(phi))(eta)-N[t]*(D(theta))(eta)

When I hit the debug button the debugger does not start. Putting Debug() in the code doesn't either. Is there some initiation I'm missing? It seems to me it used to work.

I have data that I've binned in list. I'd like to plot in as a histogram. 

dataplot sort of does it but doesn't give the x-axis that I used but just the bins.

Yes, I know about Histogram from Statistics. To plot 1000000 values I have to enter them all into a list which seems crazy when all I want is a 100 bin histogram. Doing the binning is trivial, but I can't figure out how to plot it with a sensible x-axis (show range used to define the 'histogram')

How do I find the contents of a bin in a Maple histogram?

I'm using NLPSolve to minimize a complicated function. It works great, but the answers are not returned in numerical form which I need as they are then input for the next stage of my program.

How to I extract numbers?

S2 := NLPSolve(test, phi1 = 0 .. 2*Pi, phi2 = 1.0*Pi .. 2*Pi);
     S2 := [-1.00000000011810774, 

       [phi1 = 0.773215730257661, phi2 = 5.98741001513872]]
==>The Result is a list and the solutions appear kind of string-like. 

S2[2,1] returns 'phi=0.773...' not the number I need

How to conver a patial differetial equation to ordinary differential equation with or without dchange?
 

restart

declare(u(x, y, t), v(x, y, t), T(x, y, t), C(x, y, t), eta(x, y, t), psi(x, y, t), f(eta), theta(eta), phi(eta));

declare(u(x, y, t), v(x, y, t), T(x, y, t), C(x, y, t), eta(x, y, t), psi(x, y, t), f(eta), theta(eta), phi(eta))

(1)

eta := proc (x, y, t) options operator, arrow; y/(nu*t+nu*x/U[w])^(1/2) end proc:

eq1 := diff(T(x, y, t), t)+u*(diff(T(x, y, t), x))+v*(diff(T(x, y, t), y))-sigma*(diff(T(x, y, t), y, y))-epsilon*D[B]*(diff(T(x, y, t), y))*(diff(C(x, y, t), y)) = 0

diff(T(x, y, t), t)+U[w]*(D(f))(y/(nu*t+nu*x/U[w])^(1/2))*(diff(T(x, y, t), x))+(-(1/2)*f(y/(nu*t+nu*x/U[w])^(1/2))*nu/(nu*t+nu*x/U[w])^(1/2)+(1/2)*(D(f))(y/(nu*t+nu*x/U[w])^(1/2))*y*nu/(nu*t+nu*x/U[w]))*(diff(T(x, y, t), y))-sigma*(diff(diff(T(x, y, t), y), y))-epsilon*D[B]*(diff(T(x, y, t), y))*(diff(C(x, y, t), y)) = 0

(2)

``


 

Download pde_to_ode.mw

i want to plot this equations for P and t for  t= 0 t0 600 seconds..can u provide me how?

time-dependent_aerodynamic_pressure.mw

restart

k := 0.1e-1;

0.1e-1

 

5

(1)

`P₀₀` := 100;

100

(2)

V := 25;

25

(3)

rho := 1;

1

 

.5

(4)

eq := diff(P(t), t) = -k*P(t)+rho*Cp*(int(V*sin(alpha), t));

diff(P(t), t) = -0.1e-1*P(t)+12.5*sin(5)*t

(5)

solution := dsolve({eq, P(0) = `P₀₀`}, P(t));

P(t) = 1250*sin(5)*t-125000*sin(5)+exp(-(1/100)*t)*(100+125000*sin(5))

(6)

``

Download time-dependent_aerodynamic_pressure.mw

restart;

eq32r:=diff(B(r),`$`(r,3))+diff(B(r),r);

diff(diff(diff(B(r), r), r), r)+diff(B(r), r)

(1)

with(PDEtools, casesplit, declare); with(DEtools, gensys):declare(b(r), prime = r);

[casesplit, declare]

 

b(r)*`will now be displayed as`*b

 

`derivatives with respect to`*r*`of functions of one variable will now be displayed with '`

(2)

eq32r;

diff(diff(diff(B(r), r), r), r)+diff(B(r), r)

(3)

latex(eq32r);

{\frac {{\rm d}^{3}}{{\rm d}{r}^{3}}}B \left( r \right) +{\frac

{\rm d}{{\rm d}r}}B \left( r \right)

 

#instead of {\frac {{\rm d}^{3}}{{\rm d}{r}^{3}}}B I want to have B''' in my latex file.

``

``

Download convert-latex.mw

Hi everybody

I have a differential equation where derivatives (for example d/dr) have been displayed by prime notation.

I want to convert this equation latex format by keeping the prime notation not d/dr.

I would appreciate it if anyone could help me.

I have attached a sample code.

Thank you

Hadi

Hello everyone! I have found this document from Maple 18 (2014) that will be very usefull for my school work, but when i copy it into Maple 2022 i get the error message, "action, does not evaluate to a module" Is there any way for me to fix this? What i have been able to read is that i have to go in and update the code, but i have absolute no idea on how to do it? 

Kind Regards Samuel 

Regressionmodeller._Skal_laves_til_maple_22_og_23.mw

restart

with(PolynomialIdeals):

``

``

randomzero := proc (ListVar) local A, G, i, lm, B, f, g; option trace; A := ListVar; G := NULL; for i to nops(A) do f := A[i]^(i+1)+randpoly([op(`minus`({op(A)}, {A[i]}))], terms = 1, coeffs = rand(-4 .. -1), degree = i); G := G, f end do; print(IsZeroDimensional(`<,>`(G))); RETURN([G]) end proc:

randomzero([x, y])

{--> enter randomzero, args = [x, y]

 

[x, y]

 

"G:="

 

x^2-y-4

 

x^2-y-4

 

y^3-3*x

 

x^2-y-4, y^3-3*x

 

true

 

<-- exit randomzero (now at top level) = [x^2-y-4, y^3-3*x]}

 

[x^2-y-4, y^3-3*x]

(1)

``

Download bug.mw

Hi

I think there is a bug in the "randpoly" command. please see the attached file line 7 of my procedure "randomzero". Why x^2-y-4 is created while terms=1 is considered and the outputs must contain binomial?

How to get U1,U2,..I dont know how to use this inverse transform.Please help to find the series.

CM.mw

Equilibrium._solutions.mw

I need to obtain the equilibrium solutions when infection is present as well as analyze the local asymptotic stability when infection is absent and present in the system

Hi, please can someone help on how non-dimensionalize PDEs. 

I have tried the following, but is not working:

restart:
eqn := (diff(theta(x, z, t), x))^2*(K[1]-K[3])*cos(theta(x, z, t))*sin(theta(x, z, t))+(diff(theta(x, z, t), x))*((diff(theta(x, z, t), z))*(-K[1]*cos(2*theta(x, z, t))+K[3]*cos(2*theta(x, z, t)))-(1/2)*gamma[1]*(4*sin(theta(x, z, t))^2*u(x, z, t)+2*u(x, z, t)*cos(2*theta(x, z, t))))+(diff(theta(x, z, t), z))^2*(K[3]-K[1])*cos(theta(x, z, t))*sin(theta(x, z, t))-(1/2)*gamma[1]*(diff(theta(x, z, t), z))*(4*sin(theta(x, z, t))^2*v(x, z, t)+2*v(x, z, t)*cos(2*theta(x, z, t)))+(diff(theta(x, z, t), z, x))*(-2*K[1]+2*K[3])*cos(theta(x, z, t))*sin(theta(x, z, t))-(diff(u(x, z, t), z))*((1/2)*gamma[2]*cos(2*theta(x, z, t))+(1/2)*gamma[1]*(2*sin(theta(x, z, t))^2+cos(2*theta(x, z, t))))-(diff(v(x, z, t), x))*((1/2)*gamma[2]*cos(2*theta(x, z, t))+(1/2)*gamma[1]*(-2*sin(theta(x, z, t))^2-cos(2*theta(x, z, t))))-(1/2)*gamma[1]*(4*sin(theta(x, z, t))^2*(diff(theta(x, z, t), t))+2*(diff(theta(x, z, t), t))*cos(2*theta(x, z, t)))+((diff(u(x, z, t), x))*gamma[2]-(diff(v(x, z, t), z))*gamma[2])*cos(theta(x, z, t))*sin(theta(x, z, t))+f[2](theta(x, z, t))*(diff(theta(x, z, t), x, x))+f[1](theta(x, z, t))*(diff(theta(x, z, t), z, z));

varchange := {t = T*tau, u = xi*h^2*U/alpha[4], v = xi*h^2*V/alpha[4], x = X*h, z = Z*h, K[3] = K[1]*k[3], f[1] = K[1]*F[1], f[2] = K[1]*F[2], gamma[1] = mu*Gamma[1], gamma[2] = mu*Gamma[2]};

PDEtools:-dchange(varchange, eqn, [tau, U, V, X, Z, k[3], F[1], F[2], GAMMA[1], GAMMA[2]]);

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