MaplePrimes Questions

I have a large Maple 2020 worksheet which contains images and text.  I have been asked to publish a paper on the worksheet, in which I need to include LaTeX format. I have attempted to make the Maple => LaTeX conversion, but have the resulting file is very cluttered and takes much time to clean.  Can anyone offer advice on the best way to get clean LaTeX document from a worksheet?

Melvin Brown

sympl55@gmail.com

 

Hi,

It seems that it's not possible to change the tickmarks on axis 2 of a sparsematrixplot.
Mire of this, trying to change them seems to suppress them...
Perhaps this was a problem in Maple 2015 which has since been corrected?
By any chance, would you have a trick to correct this?

TIA
 

restart:

interface(version)

`Standard Worksheet Interface, Maple 2015.2, Mac OS X, December 21 2015 Build ID 1097895`

(1)

M := LinearAlgebra:-RandomMatrix(20,density=0.25,generator=0 .. 1);

M := Vector(4, {(1) = ` 20 x 20 `*Matrix, (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

(2)

plots:-sparsematrixplot(
   M, matrixview
);

 

plots:-sparsematrixplot(
   M, matrixview
  ,axis[1]=[tickmarks=[seq(i=i-1, i in [seq](1..20, 5))]]
  ,axis[2]=[tickmarks=[seq(j=j-1, j in [seq](1..20, 5))]]
);

 

plots:-sparsematrixplot(
   M, matrixview
  ,axis[2]=[tickmarks=[seq(i=i-1, i in [seq](1..20, 5))]]
);

 

 


 

Download sparsematrixplot.mw

How I can plot3d function s. in the domain x ,y from -1300 to 200.

Thanks

if.mw
 

"restart;   #`    x__A`=-1300..200,      `y__A`=-1300..200    u1:=(((`x__A`-200)^(2)+(`y__A`^())^(2))*0.001)/(960000);   if  u1<=0.001  then w(u1):=-0.5772-ln(u1);  else if u1>0.001  then w(u1):=-0.5772-ln(u1)+u1-((u1)^(2))/(2*2!)+((u1)^(3))/(3*3!)-((u1)^(4))/(4*4!)+((u1)^(5))/(5*5!)-((u1)^(6))/(6*6!)+((u1)^(7))/(7*7!)-((u1)^(8))/(8*8!)+((u1)^(9))/(9*9!)-((u1)^(10))/(10*10!)+((u1)^(11))/(11*11!)-((u1)^(12))/(12*12!);     end if"

Error, invalid 'if' statement

"restart;      u1:=(((`x__A`-200)^2+(`y__A`)^2)*0.001)/960000;   if u1<=0.001  then w:=(u1)->-0.5772-ln(u1);  elseif u1>0.001  then w(u1):=-0.5772-ln(u1)+u1-((u1)^2)/(2*2!)+((u1)^3)/(3*3!)-((u1)^4)/(4*4!)+((u1)^5)/(5*5!)-((u1)^6)/(6*6!)+((u1)^7)/(7*7!)-((u1)^8)/(8*8!)+((u1)^9)/(9*9!)-((u1)^10)/(10*10!)+((u1)^11)/(11*11!)-((u1)^12)/(12*12!);     end if"

 

s := 6.87*10^(-3)*w(u1); plot3d(s, x__A = -1300 .. 200, y__A = -1300 .. 200)


 

Download if.mw

 

Hello,

Im exporting procedures defined in Maple to an external software and was planning to use the CodeGeneration -tools for that. How ever, i encountered quite surprising limitations.

 

First is default value for procedure parameter. The documentation explains that procedure parameter can be set to have a default value with syntax parameterName::type := defaultValue. And indeed, it works:

 

DefaultValueTest := proc(parameterWithDefaultValue::integer:=1)::integer;
	return parameterWithDefaultValue *2;
end proc;
DefaultValueTest();
                               2
DefaultValueTest(2);
                               4

However, apparently the CodeGenerator -package cannot handle it.

CSharp(DefaultValueTest);
Error, (in CodeGeneration:-IssueError) cannot translate initial value

This is not related to the chosen language, it wont work with Java or JavaScript translation either. Without the default value the generated code looks like this, as expected:

CSharp(DefaultValueTest);
public class CodeGenerationClass {
  public static System.Int32 DefaultValueTest (System.Int32 parameterWithDefaultValue)
  {
    return 2 * parameterWithDefaultValue;
  }
}

Whats up with this? Many if not all the CodeGeneration languages support default parameter value for function. In C# it would obviously be 

public static System.Int32 DefaultValueTest (System.Int32 parameterWithDefaultValue=1)

 

 

Another one is the type support. I was quite surprised that boolean type works fine in Maple but the codegeneration translation cannot handle it. For example:

Booltest := proc(boolVal::boolean)::integer;
	if ( boolVal = true ) then
		return 1;
	end if;
	
	return 0;
end proc;

Works fine in the maple.

Booltest(true);
                               1
Booltest(false);
                               0

But when ran trough the code generator:

CSharp(Booltest);
Warning, cannot translate type boolean, using default type
Error, (in CodeGeneration:-IssueError) cannot resolve types in {boolean, numeric}

Apparently, since the documentation says that if CodeGeneration doesn't recognize the type, it uses default type, which in this case is numeric, it cannot do the evaluation in the if clause ( numeric and boolean true ).

So if we change the if condition to a shorthand version:

if ( boolVal ) then

The csharp transpiled code looks like 

CSharp(Booltest);
Warning, cannot translate type boolean, using default type
public class CodeGenerationClass {
  public static System.Int32 Booltest (System.Double boolVal)
  {
    if (boolVal)
      return 1;
    return 0;
  }
}

 

Every languange in the codegeneration package has boolean type. So shouldn't there be a variable type bool in the translator/transpiler as well?

 

Is there a way around these problems? Are there plans on expanding the codegeneration/transpiler ruleset to cover these rather basic cases? 

 

 

 

 

 

This puzzling to me. First will show the code, then explain the problem

restart;
ode:=diff(diff(y(x),x),x)+8*diff(y(x),x)+25*y(x) = 1;
sol:=dsolve(ode);
sol:= y(x)= _C2*exp(-4*x)*sin(3*x)+ _C1*exp(-4*x)*cos(3*x) + 1/25;
sol:= y(x)= _C2*exp(-4*x)*sin(3*x)+ _C1*exp(-4*x)*cos(3*x) + 1/25;
sol:= y(x)= _C2*exp(-4*x)*sin(3*x)+ _C1*exp(-4*x)*cos(3*x) + 1/25;

restart;

sol:= y(x)= _C2*exp(-4*x)*sin(3*x)+ _C1*exp(-4*x)*cos(3*x) + 1/25;

I was trying to changing the constant of integrations, to make them show at front, where it is better. But Maple refused to do so. Here is the output:


 

interface(version)

`Standard Worksheet Interface, Maple 2020.2, Windows 10, November 11 2020 Build ID 1502365`

restart;
ode:=diff(diff(y(x),x),x)+8*diff(y(x),x)+25*y(x) = 1;
sol:=dsolve(ode);
sol:= y(x)= _C2*exp(-4*x)*sin(3*x)+ _C1*exp(-4*x)*cos(3*x) + 1/25;
sol:= y(x)= _C2*exp(-4*x)*sin(3*x)+ _C1*exp(-4*x)*cos(3*x) + 1/25;
sol:= y(x)= _C2*exp(-4*x)*sin(3*x)+ _C1*exp(-4*x)*cos(3*x) + 1/25;

diff(diff(y(x), x), x)+8*(diff(y(x), x))+25*y(x) = 1

y(x) = exp(-4*x)*sin(3*x)*_C2+exp(-4*x)*cos(3*x)*_C1+1/25

y(x) = exp(-4*x)*sin(3*x)*_C2+exp(-4*x)*cos(3*x)*_C1+1/25

y(x) = exp(-4*x)*sin(3*x)*_C2+exp(-4*x)*cos(3*x)*_C1+1/25

y(x) = exp(-4*x)*sin(3*x)*_C2+exp(-4*x)*cos(3*x)*_C1+1/25

restart;

sol:= y(x)= _C2*exp(-4*x)*sin(3*x)+ _C1*exp(-4*x)*cos(3*x) + 1/25;

y(x) = _C2*exp(-4*x)*sin(3*x)+_C1*exp(-4*x)*cos(3*x)+1/25

 


Why restart is needed to make Maple keep the output same as input? is it possible to rewrite it without having to do restart?

Download why_restart_needed.mw

 

Has anybody tried Maple 2020.2 on a new Macbook with Apple silicon? I believe native support is in development, i was curious if anyone had experience running Maple via Rosetta 2?

The function is y^2 = x^3 - 3x - 1

How to calculate the defined integral when x < 0 in maple? 

Always get a very long output rather than a numerical value. 

Thank you!

I have to create a simulation of the orbit of Hyperion around Saturn, which should be reliable for up to thousands of orbits. In practice I don't seem to be able to make the model stay consistent above a few hundred orbits using dsolve for the ODEs, but is there any way to do this so that the orbit stays on the same path?

I have uploaded my code here for your perusal.


 

``

with(plots)

G := 0.667408e-10

MH := 0.55855e19

MSat := 0.56832e27

M := MSat+MH

a := 0.1501e10

ecc := .232

beta := .89

Digits := 10

TH := sqrt(4*3.141592653589793^2*a^3/(G*M))

omegaH := (2*3.141592653589793)/TH

Eqns := diff(xH(t), t) = vxH(t), diff(yH(t), t) = vyH(t), diff(vxH(t), t) = -G*M*xH(t)/(xH(t)^2+yH(t)^2)^(3/2), diff(vyH(t), t) = -G*M*yH(t)/(xH(t)^2+yH(t)^2)^(3/2), diff(theta(t), t) = omega(t), diff(omega(t), t) = -G*MSat*beta^2*(xH(t)*sin(theta(t))-yH(t)*cos(theta(t)))*(xH(t)*cos(theta(t))+yH(t)*sin(theta(t)))/(xH(t)^2+yH(t)^2)^2.5

ICs := xH(0) = a*(1-ecc), yH(0) = 0., vxH(0) = 0., vyH(0) = sqrt(G*M*(1+ecc)/(a*(1-ecc))), theta(0) = 0., omega(0) = omegaH

soln := dsolve({Eqns, ICs}, numeric, method = rkf45, abserr = 0.1e-9, relerr = 0.1e-9, maxfun = 0)

T := 100*TH

odeplot(soln, [xH(t)/a, yH(t)/a], 0 .. T, scaling = constrained, labels = ["x/a", "y/a"], numpoints = 2000)``

odeplot(soln, [theta(t), omega(t)], 0 .. T, labels = ["theta", "omega"], numpoints = 2000)

``


 

Download Project.mw

Maple how to prove Sin2x=2sinxcosx for every real number 

 

Thank you! 


 

  restart:

  interface(rtablesize=10):


  local gamma:local pi:



if false then
 theta := 0.987: betae := 0.231: betay := 0.112: rho := 0.17: muh := 0.05 : sigma2 := 0.0411: sigma1 := 0.212: alpha1 := 0.111: alpha2 := 0.131 : eta := 0.134: thetaa := 0.7271: betaf := 0.00954: betah := 0.008220: gamma := 0.0012: mua := 0.0023: sigma3 := 0.203: d := 0.451: z := 0.072:
end if:

#
# D() is Maple's differential operator replated D(T)
# with DD(T) in the following to avoid confusion
#

  ODE1 := diff(B(T), T) = theta-(betae*C(T)+betay*rho*G(T))*B(T)-muh*B(T)+sigma2*E(T):
  ODE2 := diff(C(T), T) = (betae*C(T)+betay*rho*G(T))*B(T)-(muh+sigma1+alpha1)*C(T):
  ODE3 := diff(E(T), T) = sigma1*C(T)-(muh+sigma2)*E(T):
  ODE4 := diff(G(T), T) = alpha1*C(T)+alpha2*K(T)-eta*G(T):
  ODE5 :=  diff(H(T), T) = thetaa-(betaf*H(T)+betah*gamma*G(T))*H(T)-mua*H(T)+sigma3*K(T):
  ODE6 :=  diff(J(T), T) = (betaf*H(T)+betah*gamma*G(T))*H(T)-(mua+d+z+alpha2)*J(T):
  ODE7 :=  diff(K(T), T) = z*J(T)-(mua+sigma3)*K(T):

 
if false then
  B0 := 100: C0 := 60: E0 := 50: G0 := 55: H0 := 80: J0 := 80: K0 := 80:  

end if:

# system + ic


sys := { ODE1, ODE2, ODE3, ODE4, ODE5, ODE6, ODE7,
                   B(0) = B0, C(0) = C0, E(0) = E0, G(0) = G0, H(0) = H0, J(0) = J0, K(0) = K0

                 }:

params := convert(indets(sys, name) minus {T}, list);

[B0, C0, E0, G0, H0, J0, K0, alpha1, alpha2, betae, betaf, betah, betay, d, eta, gamma, mua, muh, rho, sigma1, sigma2, sigma3, theta, thetaa, z]

(1)

#
# Solve system
#
  ans := dsolve( { ODE1, ODE2, ODE3, ODE4, ODE5, ODE6, ODE7,
                   B(0) = B0, C(0) = C0, E(0) = E0, G(0) = G0, H(0) = H0, J(0) = J0, K(0) = K0
               
                 },
                 parameters = params,
                 numeric
               );

Error, (in dsolve/numeric) 'parameters' must be specified as a list of unique unassigned names

 

NULL


 

Download sim.mw

Hello everyone,

I have a problem when searching in a document. Namelly is there a way to search in the whole worksheet including all code editing regions?

In order to show a point, there is a worksheet. I determine a variable

x11:= 12;

This variable is used in the document and code edit regions. Then I want to change a variable name from x11 to x11data. In order to do that, I use Ctrl+F to find all the times when the variable is used. I have a problem while  searching 'x11'. Namelly, the cases outside a code edit region are displayed, and the ones that are situated in the code edit regions are not seen.

Best regards

The dsolve function is not working to solve a set of differential equations I have written. No error message is showing, but the code does not work.
 

``

with*plots

G := 0.667408e-10

0.667408e-10

(1)

M := 0.56832e27+0.55855e19

0.5683200056e27

(2)

a := 0.1501e10

0.1501e10

(3)

ecc := .232

.232

(4)

orbit := proc (T) local Eqns, ICs, soln; Eqns := diff(xH(t), t) = vxH(t), diff(yH(t), t) = vyH(t), diff(vxH(t), t) = G*M*xH(t)/(xH(t)^2+yH(t)^2)^(3/2), diff(vyH(t), t) = G*M*yH(t)/(xH(t)^2+yH(t)^2)^(3/2); ICs := xH(0) = a*(1-ecc), yH(0) = 0., vxH(0) = 0., vyH(0) = sqrt(G*M*(1+ecc)/(a*(1-ecc))); soln := dsolve({Eqns, ICs}, numeric, method = classical[rk4]); odeplot(soln, [xH(t)/a, yH(t)/a], 0 .. T, scaling = constrained, labels = ["x/a", "y/a"], numpoints = 2000) end proc

proc (T) local Eqns, ICs, soln; Eqns := diff(xH(t), t) = vxH(t), diff(yH(t), t) = vyH(t), diff(vxH(t), t) = G*M*xH(t)/(xH(t)^2+yH(t)^2)^(3/2), diff(vyH(t), t) = G*M*yH(t)/(xH(t)^2+yH(t)^2)^(3/2); ICs := xH(0) = a*(1-ecc), yH(0) = 0., vxH(0) = 0., vyH(0) = sqrt(G*M*(1+ecc)/(a*(1-ecc))); soln := dsolve({Eqns, ICs}, numeric, method = classical[rk4]); odeplot(soln, [xH(t)/a, yH(t)/a], 0 .. T, scaling = constrained, labels = ["x/a", "y/a"], numpoints = 2000) end proc

(5)

orbit(20)

odeplot(soln, [0.6662225183e-9*xH(t), 0.6662225183e-9*yH(t)], 0 .. 20, scaling = constrained, labels = ["x/a", "y/a"], numpoints = 2000)

(6)

``


 

Download Project.mw

Hello 

I need a procedure that given two lists of sets A and returns a list of lists such that L[i] is the list of j such that A[i] subset B[j]. Here is an example:

ans6 := [{alpha[1, 8], alpha[2, 2], alpha[2, 5], alpha[2, 8], alpha[3, 6], alpha[3, 9]}, {alpha[1, 8], alpha[2, 2], alpha[2, 5], alpha[2, 8], alpha[3, 3], alpha[3, 6]}, {alpha[1, 8], alpha[2, 2], alpha[2, 5], alpha[2, 7], alpha[3, 6], alpha[3, 8]}, {alpha[1, 8], alpha[2, 2], alpha[2, 5], alpha[2, 7], alpha[3, 3], alpha[3, 8]}, {alpha[1, 8], alpha[2, 2], alpha[2, 5], alpha[2, 7], alpha[3, 3], alpha[3, 6]}, {alpha[1, 8], alpha[2, 2], alpha[2, 4], alpha[2, 5], alpha[3, 3], alpha[3, 6]}, {alpha[1, 8], alpha[2, 1], alpha[2, 2], alpha[2, 5], alpha[3, 3], alpha[3, 6]}, {alpha[1, 8], alpha[2, 0], alpha[2, 2], alpha[2, 5], alpha[3, 3], alpha[3, 6]}, {alpha[1, 5], alpha[2, 8], alpha[3, 6], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 5], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 5], alpha[3, 6], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 5], alpha[3, 6], alpha[3, 7], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 5], alpha[3, 6], alpha[3, 7], alpha[3, 8]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 6], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 6], alpha[3, 7], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 6], alpha[3, 7], alpha[3, 8]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 5], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 5], alpha[3, 7], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 5], alpha[3, 7], alpha[3, 8]}]:

ans7 := [{alpha[1, 8], alpha[2, 2], alpha[2, 5], alpha[2, 7], alpha[3, 3], alpha[3, 6], alpha[3, 8]}, {alpha[1, 5], alpha[2, 8], alpha[3, 5], alpha[3, 6], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 6], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 5], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 5], alpha[3, 6], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 5], alpha[3, 6], alpha[3, 7], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 5], alpha[3, 6], alpha[3, 7], alpha[3, 8]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 6], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 5], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 5], alpha[3, 6], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 5], alpha[3, 6], alpha[3, 7], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 5], alpha[3, 6], alpha[3, 7], alpha[3, 8]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 6], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 6], alpha[3, 7], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 6], alpha[3, 7], alpha[3, 8]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 5], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 5], alpha[3, 7], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 5], alpha[3, 7], alpha[3, 8]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 5], alpha[3, 6], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 5], alpha[3, 6], alpha[3, 8]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 5], alpha[3, 6], alpha[3, 7]}, {alpha[1, 5], alpha[2, 8], alpha[3, 2], alpha[3, 6], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 2], alpha[3, 5], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 2], alpha[3, 5], alpha[3, 6], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 2], alpha[3, 5], alpha[3, 6], alpha[3, 7], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 2], alpha[3, 5], alpha[3, 6], alpha[3, 7], alpha[3, 8]}, {alpha[1, 5], alpha[2, 8], alpha[3, 2], alpha[3, 4], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 2], alpha[3, 4], alpha[3, 6], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 2], alpha[3, 4], alpha[3, 6], alpha[3, 7], alpha[3, 9]}]:

and my procedure

SubsetPairs:= (A::list(set), B::list(set))->
    map(z-> [ListTools:-SearchAll](true, map(w-> z subset w, B)), A)
:
SubsetPairs(ans6, ans7);

The result of applying SubsetPairs is:

[[], [], [1], [1], [1], [], [], [], [2, 3, 8, 23], [2, 4, 9, 24], [2, 5, 10, 25], [2, 6, 11, 26], [2, 7, 12, 27], [3, 4, 13, 28], [3, 5, 14, 29], [3, 6, 15, 30], [3, 7, 16], [4, 5, 17], [4, 6, 18], [4, 7, 19]]

When it is used for long lists, it takes a long time to return the results.  I wonder if a more time- and memory-efficient code can be implemented (perhaps Threads or Grid can be used).

In addition to that, how can a diagram (figure, plot, ...) be drawn to show which subset of the first list is linked to which subsets of the second list (including no link as well).  The length of the first list is always smaller than the length of the second list.  

Many thanks

 

I noticed that something changed with the output of translating abs() to latex. I am not sure when this happened.

Current version use \mid ...\mid  instead of the original \left| .... \right|

The problem with \mid is that the spacing no longer symmetric. It generate too much space on one side of | compared to the other side, and makes the output not pretty any more.

Is it possible to revert this back to the original way it was done? Please see example

restart;
Latex(ln(abs(1+x))=x)

                     \ln \! \left({\mid 1+x \mid}\right) = x

latex(ln(abs(1+x))=x)

                   \ln  \left(  \left| 1+x \right|  \right) =x

The second example gives better looking Latex where the space is symmetric. Here is the output

\documentclass{book}
\usepackage{amsmath}
\begin{document}          
\[
\ln \! \left({\mid 1+x \mid}\right) = x
\]

\[
\ln \! \left(  \left| 1+x \right|  \right) =x
\]
\end{document}

The second output is much better since \left|...\right| automatically sets the spacing the same between them and the math on each side.  (same if \lvert and \rvert were used)

I just noticed this first time looking at current output. I do not think this is how it used to be, else I would probably seen it before.

I am using Maple 2020.2 and Physics 890 (latest).

If not possible to change back to \left| ... right| . may be a new configuration parameter could be added to alow a user to choose which one?

Window 10.

 

Hi, 

Working with Legendre Polynomials (LegendreP) I observed that solve doesn't find the correct number of zeros.
More precisely, for N > 17, solve(LegendreP(N, x)) finds less zeros than N.

I wrote a procedure based on a theorem about the intertwined location of the zeros of orthogonal polynomial of successive degrees. So this problem is not blocking, but I would like to understand while solve(LegendreP(N, x)) doesn't always do the job.

Thanks in advance.
 

restart:

Z := n -> op~(2, { allvalues(solve(LegendreP(n,x))) } );

proc (n) options operator, arrow; `~`[op](2, {allvalues(solve(LegendreP(n, x)))}) end proc

(1)

Digits:=10:
Z(17):
numelems(%);

17

(2)

Z(18):
numelems(%);

16

(3)

Digits:=15:
Z(18):
numelems(%);

16

(4)

Digits:=20:
Z(18):
numelems(%);

15

(5)

Zf := n -> op~(2, { allvalues(solve(evalf(LegendreP(n,x)))) } );
Z(18):
numelems(%);

proc (n) options operator, arrow; `~`[op](2, {allvalues(solve(evalf(LegendreP(n, x))))}) end proc

 

15

(6)

# Let z[N][i] the ith zero of any orthogonal polynomial P(N,x) of degree N.
#
# It is known that each open interval(z[N][i], z[N][i+1]) contains
# exactly a unique zero of the of P(N+1,x).

Z17 := [ -1, Z(17)[], 1]:
Z18 := NULL:
for n from 1 to 18 do
  Z18 := Z18, fsolve(LegendreP(18,x),  x=Z17[n]..Z17[n+1]);
end do:
numelems({Z18})

18

(7)

# A procedure to compute zeros of LegendreP up to degree N


zeros := proc(N)
  local zeros_table, Z, n, p, z:
  zeros_table := table([0=[]]):
  Z := [-1, 1]:
  for n from 1 to N do
    z := NULL:
    for p from 1 to n do
      z := z, fsolve(LegendreP(n,x),  x=Z[p]..Z[p+1]);
    end do;
    zeros_table[n] := [z]:
    Z := [-1, z, 1]
  end do;
  return zeros_table
end proc:


 

Download LegendreP_zeros.mw

First 245 246 247 248 249 250 251 Last Page 247 of 2210