Maple 2020 Questions and Posts

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

The worksheet below is a failed attempt to produce the display of a pencil of conics tangent to four lines. The worksheet contains an image of the display.

Comments within the worksheet describe the details of the attempt and the solve command which fails.

dhaar provided an answer to a similar question which I posed on November 12 (its web address is in the worksheet) and I hope s(he) will reply to this one as well.

ConicsTangent.mw

 

Hello there, 

Would you allow me to ask this question?

What would be a way to make the 'expression' as 'expression_desired' below?

In other words, what would be a way to cancel I (or j) and exp(-pi/2) each other?


 

restart;

expression := exp(-I/2*(-2*rho__m + pi))*I;

I*exp(-((1/2)*I)*(-2*rho__m+pi))

(1)

expression_desired := exp(I*(rho__m));

 

exp(I*rho__m)

(2)

 


Thank you, 

Download Q20201118.mw

I  installed Maple 2020 a week ago.   When I try to update the Maple Physics Package, the installation stalls.

Output to the command  Physics:-Version(latest):

`The "Physics Updates" version "872" is installed but is not active. The active version of Physics is within the library C:\\Program Files\\Maple 2020\\lib\\maple.mla, created 2020, March 4, 19:36 hours`

I note that there was similar complaint in June.  I am surprised that this has not yet been fixed. The reply in June seemed to be do a manual update, but I am unclear how to do that.   I can download the latest package, but I do not know how to  (or where) to install this package.  Do I just delete the version in C:\\Program Files\\Maple 2020\\lib\\maple.mla and paste the new version?

I would greatly appreciate any help since the main reason I purchased the new Maple 2020 was to use the most recent versions of the Physics package.

There is an error in the series expansion for the JacobiTheta3 and JacobiTheta4 function

> q := exp(I*((2*I)*Pi*1.20388508772313))

>series(JacobiTheta3(z, q)-JacobiTheta3(0, q), z, 2);

gives -1+O(z^2)

>series(JacobiTheta3(z, q)-JacobiTheta3(0, q), z, 2);

gives -1+O(z^2)

The issue is that 

>series(JacobiTheta3(z, q),z,2);

gives

series(Sum(2*Q^(_k1^2),_k1 = 1 .. infinity)+O(z^2),z,2)

where the term n=0 is missing.  

The same for JacobiTheta4

series(JacobiTheta4(z, Q), z, 2);

series(Sum(2*(-1)^_k1*Q^(_k1^2),_k1 = 1 .. infinity)+O(z^2),z,2)

The same issue arises when taking the limit 

limit(JacobiTheta3(z, sqrt(q))-JacobiTheta3(0, sqrt(q)), z=0); 

gives -1

same for  limit(JacobiTheta4(z, sqrt(q))-JacobiTheta4(0, sqrt(q)), z=0); gives -1

This error occurs in maple 2018 and maple 2020. 

On the other side when taking numering values approching 0 there is no problems. 

 

So it seems that series and limit uses some codes wrong formulae.

How can one patch this? 

thanks in advance

Both exp(x)^2 and exp(2*x) are correct and the same. 

simplify(exp(x)^2 - exp(2*x))

                     0

But I can't figure how to make Maple always use exp(2*x) instead. This is for exponent  in integers. This covers 90% of all cases in the Latex I generate.

This is only for Latex purposes and for typesetting only as it looks much better and more standard to use exp(2*x) than exp(x)^2.

Here is an example

restart;
expr:=-(2*x+1)*exp(-x)/(exp(-2*x))+(2*x+1)/exp(-2*x);
expand(expr)

The latex for the above looks like 

The Latex take much larger vertical space on the line. Compare the above to the same expression, but written with exponent inside

expr:=-2*exp(x)*x - exp(x) + 2*exp(2*x)*x + exp(2*x)

Which generates Latex

Which is much more pleasent to read and has less height as well.

Is there a way to automatically make Maple do that? Could I add my own `Latex\function` ? As described in 

https://www.maplesoft.com/support/help/Maple/view.aspx?path=latex%2ffunctions

How? Also, I am using Physics:-Latex and not :-latex, so I do not know if the above page would even apply here.

it will be hard to write code to manually fix this, by may be string searching and fix it as the program is running.

Any suggestions? Note that Mathematica automatically does this when the exponent is integer

Update

Thanks to the hint by Axel Voget below, I tried to use combine, but only target it to exp(x)^n part of the whole expression, as I do not want to apply combine to each expression. This is what I came up with

restart;
expr := -2*exp(x)*x - exp(x) + 2*exp(x)^2*x + exp(x)^2 + sin(x)^3 + cos(x)^2;
subsindets(expr,'exp(anything)^(anything)',f->combine(f));

Which seems to do what I want. It only applies to exp(x)^n and no other part. Compare this to applying combine to the whole expression

combine(expr)

Which might not be what I wanted.

I still need to test the above more, as may be I did not check for other cases. But if this works, then this will solve my problem. I can add this in one place, where it does this just before emitting the Latex. All my Latex generation is done inside one function which is called from everywhere. So I could easily add this there without changing anything else in the program.

 

A person asked me why the following code does not give the integral of (x^2+y^2)*z over the top of the unit sphere.

VectorCalculus:-SurfaceInt((x^2 + y^2)*z, [x, y, z] = Surface(<1, s, t>, s = 0 .. Pi/2, t = 0 .. 2*Pi, coords = spherical))

The correct answer is Pi/2, but Maple gives 2*(-1 + Pi)*Pi^2.

Will someonoe please explain this behavior?

I am trying to use Maple to provide numerical solutions to the energy levels of muonic lead by using the Shooting method to work out boundaries for the 1s, 2p, and 3d orbitals. However, I am unable to get Maple to graph or fsolve the roots of the function, since it is "unable to evaluate the function to numeric values in this region" despite the zero being within the bounds.

Here is the code:


 

This worksheet covers the energy levels of a muon bound to a lead atom (Pb-206). All plots have been commented out and inserted as pictures. First define the variables for this atom, and the muonic mass ms in units of the free electron mass:

Z := 82; A := 206; ms := 105.66/(.51100)

206.7710372

(1)

where Z is the atomic number and A is the mass number. The Z and A values can be changed for any other atom or isotope. Modelling the atom as hydrogenic, we have the equation

En := Z^2*ms/(2*n^2)

695164.2270/n^2

(2)

where n is the orbital occupied by the muon and En is the energy in Hartree units. The average radius a of the ground state orbit in Bohr is

a := evalf(1/(Z*ms))

0.5897886916e-4

(3)

This is much smaller than the Bohr radius due to the muonic mass being bigger by 2 orders of magnitude and the higher nuclear charge. The atomic radius of the lead atom is determined by

R := evalf(0.125e-14*A^(1/3)/(0.529177e-10))

0.1395076832e-3

(4)

This is over twice the above average orbital radius, meaning that the ground state orbit lies within the nucleus. This means we cannot accurately treat this atom as hydrogenic, since the muon will only be attracted towards the portion of the nuclear charge closer to the centre. Instead, we must use a model of nuclear structure that accounts for the muon being inside the nucleus, treating the nucleus as a spherical charge distribution. Solving the radial Schrodinger equation for the sphere using a uniform spherical charge distribution, then applying Gauss's law for the charge enclosed by the nuclear surface gives a potential distribution which can be modelled using a piecewise function for the different potentials inside and outside the nucleus:

V := proc (r) options operator, arrow; piecewise(r < R, (-1)*.5*(Z/R)*(3-r^2/R^2), -Z/r) end proc

proc (r) options operator, arrow; piecewise(r < R, (-1)*.5*(Z/R)*(3-r^2/R^2), -Z/r) end proc

(5)

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]

(6)

plot([V(r), -Z/r], r = 0 .. 6*R, V = 1.5*V(0.) .. 0, scaling = unconstrained, axes = boxed, color = [red, black], legend = ["sphere", "point"], title = "Spherical and point potentials", labels = ["r [a.u.]", "V [a.u.]"])

``

While the point charge model unrealistically goes to an infinite potential as the muon gets closer to the centre of the nucleus, the spherical model instead shows it tailing off inside the nucleus as more of the nuclear charge is further from the centre than the muon itself. To model the bounds of the energy of the ground state 1s, we use the Shooting method for boundary value problems.

plotsol := proc (E::float, l::nonnegint, r0::numeric, S::numeric, c::symbol) local Eqns, ICs, fnl, gnl, r, soln; Eqns := diff(fnl(r), r) = gnl(r), diff(gnl(r), r) = l*(l+1)*fnl(r)/r^2-2*ms*(E-V(r))*fnl(r); ICs := fnl(r0) = r0, gnl(r0) = l+1; soln := dsolve({Eqns, ICs}, numeric); plots[odeplot](soln, [r, fnl(r)], r0 .. S, color = c) end proc

NULL

We are looking for a solution with l=0, and the offset r0 to prvent division by 0 must be much smaller than the Bohr radius given the scale of the orbit. We need to estimate bounds for the energy and set an upper bound for the effective range of the potential. This upper bound must be low enough for Maple to calculate the function, which unfortunately means only a few Bohr radii out.

plotsol(-38.5, 0, 0.1e-9, 7.0, red)NULL

 

plotsol(-38.6, 0, 0.1e-9, 7.0, blue)

 

These bounds show that the ground state binding energy is between -39 and -38 Hartrees, since fnl tends to negative infinity at one bound and positive infinity at the other. To home in on the correct value, we plot the function between the bounds and find the zero.

NULL

fnl_at_r := rhs(soln[2])

Error, invalid input: rhs received soln, which is not valid for its 1st argument, expr

 

fnl_at_S := proc (E, r0, l, S) global fnl_at_r; fnl_at_r(parameters = [E, r0, l]); return fnl_at_r(S) end proc

plot(proc (x) options operator, arrow; fnl_at_S(x, 0.1e-9, 0, 4.0) end proc, -38.6 .. -38.5)

Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct

 

 

Elevel := fsolve(proc (E) options operator, arrow; fnl_at_S(E, 0.10e-19, 0, 7.0) end proc, -10.00 .. 0.)

fsolve(proc (E) options operator, arrow; fnl_at_S(E, 0.10e-19, 0, 7.0) end proc, -10.00 .. 0.)

(7)

evalf(Elevel)

fsolve(proc (E) options operator, arrow; fnl_at_S(E, 0.10e-19, 0, 7.0) end proc, -10.00 .. 0.)

(8)

The plotted function tends to a straight line with no nodes, so is the solution to 1s. This gives a binding energy of -11.94 Hartrees for the ground 1s state. The 2p state is the lowest with l=1, so the same method using l=1 will find the energy of the 2p state. First find upper and lower bounds:

plotsol(-26.0, 1, 0.1e-9, 8.0, red)

plotsol(-27.0, 1, 0.1e-9, 8.0, blue)

Then solve the differential equation:

plot(proc (x) options operator, arrow; fnl_at_S(x, 0.1e-9, 1, 8.0) end proc, -12.0 .. -10.0)

Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct

 

 

Elevel := fsolve(proc (E) options operator, arrow; fnl_at_S(E, 0.1e-9, 0, 8.0) end proc, -27.0 .. -26.0)

fsolve(proc (E) options operator, arrow; fnl_at_S(E, 0.1e-9, 0, 8.0) end proc, -27.0 .. -26.0)

(9)

evalf(Elevel)

fsolve(proc (E) options operator, arrow; fnl_at_S(E, 0.1e-9, 0, 8.0) end proc, -27.0 .. -26.0)

(10)

NULL


 

Download Exercise_3.mw

I have to compare the probabilty density of a data set of the normalised gaps between eigenfunction energy levels of random matrices to the Wigner surmise Pi/2*n*exp((-Pi)/4*n^2). I have collected the data set, but cannot find a function to give a numerical value for the probability density function to compare. I have tried using KernelDensity but it doesn't seem to work.

Here is the code:


 

restart; with(RandomTools); with(LinearAlgebra); with(Statistics); with(plots)

NULL

First create a procedure for the Gaussian orthogonal ensemble, GOE, with mean 0 and variance 1. This procedure extracts the normalised eigenvalues for a symmetric matrix added to its transpose and divided by 2:

GOE := proc (N::integer) local A, B, C; A := Matrix(N, N, Generate(distribution(Normal(0, 1)), makeproc = true)); B := Transpose(A); C := (1/2)*A+(1/2)*B; return Re(Eigenvalues(C)/sqrt(2*N)) end proc

data := [seq(GOE(3), i = 1 .. 5000)]

Histogram(data, binwidth = 0.5e-1, range = -2 .. 2)

NULL

The histogram shows a normal distribution centred around 0, as expected. Increasing the value of N makes the distribution trend more and more towards the ideal Gaussian distribution as N tends to infinity, since a bigger sample size tends to the statistical mean. This procedure can be repeated for uniformly distributed random numbers in the range -1 to +1:

GOE2 := proc (N::integer) local A, B, C; A := Matrix(N, N, Generate(distribution(Uniform(-1, 1)), makeproc = true)); B := Transpose(A); C := (1/2)*A+(1/2)*B; return Re(Eigenvalues(C)/sqrt(2*N)) end proc

data := [seq(GOE2(3), i = 1 .. 5000)]

Histogram(data, binwidth = 0.5e-1, range = -2 .. 2)

This creates a curved distribution steeper and narrower than the above normal distribution, centred around 0 and tailing off below -0.5 and above +0.5. As N tends to infinity, this curve becomes smoother and more rounded, as with the Gaussian distribution.

 

The same principle also applies to complex Hermitian matrices in the Gaussian unitary emsemble (GUE), though complex numbers cannot be normally graphed on histograms. By taking the real and imaginary parts of the eigenvalues separately, it is possible to plot the distribution on a histogram, since both parts have the same distribution.

GUE := proc (N::integer) local A, B, C, D, E; A := Matrix(N, N, Generate(distribution(Normal(0, 1)), makeproc = true)); B := Matrix(N, N, Generate(distribution(Normal(0, 1)), makeproc = true)); C := A+I*B; D := Transpose(C); E := (1/2)*C+(1/2)*D; return Re(Eigenvalues(E)/sqrt(4*N)); return Im(Eigenvalues(E)/sqrt(4*N)) end proc

data := [seq(GUE(3), i = 1 .. 5000)]

Histogram(data, binwidth = 0.5e-1, range = -2 .. 2)

The result is a similar normal distribution to the GOE, but narrower due to the increased normalisation constant.

 

Finally, a procedure can return the spacings between the nth energy levels of the eigenvalues, taking the nth level spacing as "lambda[n+1]-lambda[n]."This procedure can work for the GOE or GUE distributions, and must check for these as valid arguments.

spacing := proc (n::integer, N::integer, ensemble) local A, B; if ensemble = GOE then A := GOE(N); return A[n+1]-A[n] elif ensemble = GUE then B := GUE(N); return B[n+1]-B[n] else print("Invalid argument. Only GOE and GUE are accepted.") end if end proc

The Wigner surmise of probability density for the GOE and GUE predicts that the probablity density function follows specific formulae for each spacing. This can be compared by taking many results for a given spacing and dividing by the mean, the using the kernel density function with a Gaussian kernel to estimate the probability density of the data set.

data := [seq(spacing(2, 4, GOE), i = 1 .. 500)]

normaliseddata := data/Mean(data)

F := KernelDensity(normaliseddata, bandwidth = 1/4, kernel = 'gaussian', left = -1000, right = 1000, method = exact)

evalf(F(2.0))

0.400007351200000e-304+0.*I

(1)

WignerGOE := proc (n::integer) return (1/2)*Pi*n*exp(-(1/4)*Pi*n^2) end proc

WignerGOE(2)

Pi*exp(-Pi)

(2)

NULL


 

Download matrices.mw
 

restart; with(RandomTools); with(LinearAlgebra); with(Statistics); with(plots)

NULL

First create a procedure for the Gaussian orthogonal ensemble, GOE, with mean 0 and variance 1. This procedure extracts the normalised eigenvalues for a symmetric matrix added to its transpose and divided by 2:

GOE := proc (N::integer) local A, B, C; A := Matrix(N, N, Generate(distribution(Normal(0, 1)), makeproc = true)); B := Transpose(A); C := (1/2)*A+(1/2)*B; return Re(Eigenvalues(C)/sqrt(2*N)) end proc

data := [seq(GOE(3), i = 1 .. 5000)]

Histogram(data, binwidth = 0.5e-1, range = -2 .. 2)

NULL

The histogram shows a normal distribution centred around 0, as expected. Increasing the value of N makes the distribution trend more and more towards the ideal Gaussian distribution as N tends to infinity, since a bigger sample size tends to the statistical mean. This procedure can be repeated for uniformly distributed random numbers in the range -1 to +1:

GOE2 := proc (N::integer) local A, B, C; A := Matrix(N, N, Generate(distribution(Uniform(-1, 1)), makeproc = true)); B := Transpose(A); C := (1/2)*A+(1/2)*B; return Re(Eigenvalues(C)/sqrt(2*N)) end proc

data := [seq(GOE2(3), i = 1 .. 5000)]

Histogram(data, binwidth = 0.5e-1, range = -2 .. 2)

This creates a curved distribution steeper and narrower than the above normal distribution, centred around 0 and tailing off below -0.5 and above +0.5. As N tends to infinity, this curve becomes smoother and more rounded, as with the Gaussian distribution.

 

The same principle also applies to complex Hermitian matrices in the Gaussian unitary emsemble (GUE), though complex numbers cannot be normally graphed on histograms. By taking the real and imaginary parts of the eigenvalues separately, it is possible to plot the distribution on a histogram, since both parts have the same distribution.

GUE := proc (N::integer) local A, B, C, D, E; A := Matrix(N, N, Generate(distribution(Normal(0, 1)), makeproc = true)); B := Matrix(N, N, Generate(distribution(Normal(0, 1)), makeproc = true)); C := A+I*B; D := Transpose(C); E := (1/2)*C+(1/2)*D; return Re(Eigenvalues(E)/sqrt(4*N)); return Im(Eigenvalues(E)/sqrt(4*N)) end proc

data := [seq(GUE(3), i = 1 .. 5000)]

Histogram(data, binwidth = 0.5e-1, range = -2 .. 2)

The result is a similar normal distribution to the GOE, but narrower due to the increased normalisation constant.

 

Finally, a procedure can return the spacings between the nth energy levels of the eigenvalues, taking the nth level spacing as "lambda[n+1]-lambda[n]."This procedure can work for the GOE or GUE distributions, and must check for these as valid arguments.

spacing := proc (n::integer, N::integer, ensemble) local A, B; if ensemble = GOE then A := GOE(N); return A[n+1]-A[n] elif ensemble = GUE then B := GUE(N); return B[n+1]-B[n] else print("Invalid argument. Only GOE and GUE are accepted.") end if end proc

The Wigner surmise of probability density for the GOE and GUE predicts that the probablity density function follows specific formulae for each spacing. This can be compared by taking many results for a given spacing and dividing by the mean, the using the kernel density function with a Gaussian kernel to estimate the probability density of the data set.

data := [seq(spacing(2, 4, GOE), i = 1 .. 500)]

normaliseddata := data/Mean(data)

F := KernelDensity(normaliseddata, bandwidth = 1/4, kernel = 'gaussian', left = -1000, right = 1000, method = exact)

evalf(F(2.0))

0.400007351200000e-304+0.*I

(1)

WignerGOE := proc (n::integer) return (1/2)*Pi*n*exp(-(1/4)*Pi*n^2) end proc

WignerGOE(2)

Pi*exp(-Pi)

(2)

NULL


 

Download matrices.mw

 

We have just released updates to Maple and MapleSim.

Maple 2020.2 includes corrections and improvements to printing and export to PDF, support for macOS 11.0, more MATLAB connectivity, resolves issues with the installation of the Maplesoft Physics Updates, and more.  We recommend that all Maple 2020 users install these updates.

This update is available through Tools>Check for Updates in Maple, and is also available from our website on the Maple 2020.2 download page, where you can also find more details.

If you are also a MapleSim user, this Maple update will be installed automatically when you update your MapleSim installation to the newly released MapleSim 2020.2. The MapleSim update also includes many updates to MapleSim, the MapleSim CAD Toolbox, specialized MapleSim libraries, MapleSim connectivity tools, and MapleSim Insight.  You will find details about new features and improvements, as well as instructions on obtaining the update, on the MapleSim 2020.2 page.

EDIT TIME: 14:30 CET

where P(1) and P(2) are NxN matrix functions.

 

My trial code for STEP 0

 alpha times integral w.r.t. x

 Int_x__alpha:=proc(term,alpha): 
 return
select(has,term,x).P(alpha)^T.remove(has,term,x)
end proc: 

 alpha times integral w.r.t. t

Int_t__alpha:=proc(term,alpha):   #alpha times integral w.r.t. t
 return
remove(has,term,t).P(alpha).select(has,term,t)
end proc:

when I run the last procedure for the testing

 Int_t__alpha(Psi(x)^T.C. Psi(t),2);

I get

But it must be 

Because the multiplication is not commutative in Matrices. So, the last procedure must be corrected. 

DETAILS for the procedures:

-------------------------------------------------------------------------------------------------------------------------------------

MAIN QUESTION:

Suppose that we have a PDE as follows 

                                             ...(3)

 

subject to appropriate Initial and Boundary conditions.

-------------------------------------------------------------------------------------------------------------------------------------

STEP 1

  • Find the highest derivative w.r.t. x and w.r.t. t. Then, Let the trial function be the summation derivative of these highest derivatives. I mean

Trial Function:                                           ...(4)

where Psi(x), Psi(t) are Nx1 vectors and C is a NxN matrix.

I can't write a maple code for selecting the trial function.  May be you can.
trial_function:=diff(u(x,t),x,t)=Psi(x)^T.C. Psi(t); 

# I deliberately used ^T instead of ^+ for Transpose.
# If I use ^+, the transpose sign doesn't appear in 2d output. May be you have an other idea.

 

-------------------------------------------------------------------------------------------------------------------------------------

STEP 2

  • Integrate the Eq.4  w.r.t. t from 0 to t, we have
STEP2:=int(  lhs(trial_function) ,t=0..t)=Int_t__alpha(rhs(trial_function),1);


The code must be improved. Firstly, substitute t=s in lhs(trial_function) and then integrate s=0..t 

-------------------------------------------------------------------------------------------------------------------------------------

STEP 3

 

int(lhs(STEP2),x=0..x)= Int_x__alpha(rhs(STEP2),1);

The code must be improved.

-------------------------------------------------------------------------------------------------------------------------------------
STEP 4

  • Integrate Eq.4 w.r.t x

-------------------------------------------------------------------------------------------------------------------------------------
STEP 5

  • Substitute Eq. (5), Eq. (6), Eq. (7) to Eq. (3),
  • I mean substituting  u_x(x,t), u_t(x,t), u(x,t) to PDE.

-------------------------------------------------------------------------------------------------------------------------------------

STEP 6

DOWNLOAD ALL MAPLE CODE: all_code.mw

This is the context. I am doing reduction of order on an ODE. This sometimes converts the ode to form  where common factor containing only  x can be moved outside, making the ode looks like  f(x)*(y''(x)+....etc...) = 0 then now I can eliminate f(x)  and only solve (y''(x)+....etc...) = 0 which is simpler.

I found if I can call factor on the ode, it works. It does remove any common terms. The problem I am having is how to cleanly determine the factors obtained. In the above example, it will be f(x) and (y''(x)+....etc...) 

For an example, the ODE   x^2 y'' + x y' = 0 can be written (using factor) as  x ( x y'' + y') =0 and now canceling x<>0, the ode becomes simpler x y''+ y' = 0.

I am now trying to find the two factors, using using op() on the result of factor.

But it does not work for all cases. There should be a way more robust way to obtain the factors.  I give 2 examples to better explain.

Example 1

ode:=x^2*diff(y(x),x$2)-(x-3/16)*y(x)=0:
ode:=expand(algsubs( y(x)=v(x)*x^(1/4)*exp(2*sqrt(x)),ode));
ode:=factor(ode);

After factoring the original ODE, there is common term found, which is the one shown UP. I need to find this to cancel it and keep the rest.

Currently I do this, which does not work for call cases

#check it is factored OK. If the type is `*` then Maple
#found common factor.
if type(lhs(ode),`*`) then 
   #add code to extract the two parts
   LHS:=op([1..-2],lhs(ode));
   RHS:=op(-1,lhs(ode));
fi;

Even though this worked here. I can now check it is the LHS which needs to be canceled. But all what I have are the operands. I do not know how to reconstruct the LHS from the operands. They could be + or *.  If it was `*` between the oprands for LHS, then I can do LHS:=mul(LHS) and this gives 

But I got lucky here. I do not know if it will be `*` all the time for LHS operands.

example 2

ode:=x^2*diff(y(x),x$2)-x*(x+2)*diff(y(x),x)+(x+2)*y(x)=0;
ode:=algsubs( y(x)=v(x)*x,ode):
ode:=factor(ode);

For this, the code I have works, but this is only because the LHS was simple.

if type(lhs(ode),`*`) then #factored OK
   LHS:=op([1..-2],lhs(ode));
   RHS:=op(-1,lhs(ode));
fi;

My question is: I expect factor, if there is common factor, to generate 2 expressions with `*` between them. I am looking for a good way to find what these two factors are. Once I do, it is easy for me to find which is the ODE and which is not and cancel the one which is not out.

I tried collect, but this does not work in general. Since I do not know beforehand, what is the common term, if any, present.

If this needs more clarification please feel free to ask. I have many more examples. This is all done by coding. Non-interactive. So solution based on looking at the output then do something, will not work for me.

 

 

Mac OS 11 Big Sur ist not listed as a compatible system with Maple 2020. Are there known issues? Could someone who already upgraded give feedback?

Currently to parse initial conditions of ODE entered bu user in the form y(x0)=y0 in order to determine x0 and y0 I use patmatch on lhs and rhs separatly which is not a big deal. I wanted to see if I can use an equation inside patmatch.

I could not figure how to use patmatch on both sides of equation on one call.  Help says expression to patmatch is algebraic expression. Does this means an equation can't be used as whole? Here is an example to make it more clear

restart;
ic:=y(0) = 1;
patmatch(ic,y(x0::anything)=y0::anything,'la')

Which gives false. i.e. no match found.

Is there a trick to make the above work if possible? This is just a basic example. I might want to apply this on more complicated equation where more things are on lhs and rhs of =  but patmatch does not like `=` in the middle there. 

 

 

 

After I just updated to Physics 871, my main worksheet which allready has for long time now:

Physics:-Latex:-UseColor := false;  
Physics:-Latex:-UseImaginaryUnit:=i;

Now I get 

The reason I use Physics:-Latex:-UseImaginaryUnit:=i; is to make the Latex use for complex number in Latex instead of I

What is now the correct way to use these settings with the new Physics update? if I do not use them, then compelx I  will still show as I whcih I do not want. I want lower case i

I could add interface(imaginaryunit=i); in place of Physics:-Latex:-UseImaginaryUnit:=i; and that work for the latex, making the Latex generate i. But this solution now makes the User interface no longer accept I  as complex number any more and must be typed as lower case, which is not what I want.

That is why I was using Physics:-Latex:-UseImaginaryUnit:=i; This keeps the user interface complex number as Uppercase, but let the latex generated be lower case.

I feel I am doing something wrong, but do not see it. Made sure I use Physics:-Latex on everything now.

Please see below 2 worksheets. One using the 871 version and one using 865 version.
 

restart;

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 871 and is the same as the version installed in this computer, created 2020, November 14, 14:16 hours Pacific Time.`

Physics:-Latex:-Settings()

[invisibletimes = ` `, powersoftrigonometricfunctions = mixed, usecolor = true, useimaginaryunit = I, useinputlineprompt = true, userestrictedinputtranslation = false, usespecialfunctionrules = true, usetypesettingcurrentsettings = false]

Physics:-Latex:-UseColor := false;  
Physics:-Latex:-UseImaginaryUnit:=i;
 

Error, attempting to assign to `Physics:-Latex:-UseColor` which is protected

Error, attempting to assign to `Physics:-Latex:-UseImaginaryUnit` which is protected

Physics:-Latex(I)

I

 

 

Download latex_871.mw
 

restart;

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 871. The version installed in this computer is 865 created 2020, November 11, 8:43 hours Pacific Time, found in the directory C:\Users\me\maple\toolbox\2020\Physics Updates\lib\`

Physics:-Latex:-Settings()

usecolor = true, useimaginaryunit = I, useinvisibletimes = ` `, useinputlineprompt = true, userestrictedinputtranslation = false, usespecialfunctionrules = true, usetypesettingcurrentsettings = false

Physics:-Latex:-UseColor := false;  
Physics:-Latex:-UseImaginaryUnit:=i;
Physics:-Latex(I);
 

false

i

i

 

 

Download latex_865.mw

New error seems to have been introduced 

restart;
expr:=arccos(1/x);
Physics:-Latex(expr);

it seems to happen with the inverse trig functions when there is a fraction inside.

Do others have the same issue? I am currently using  869.  Maple 2020.1

Rolling back Physics version one at a time, I found the version this happened at. It was OK in version 865, but gives the error starting at version 866.

Hopefully this should make it easy to find the code change which caused it using source control diff.

 

First 28 29 30 31 32 33 34 Last Page 30 of 55