## How best to convert a Maple worksheet into LaTeX f...

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

## How to change tickmarks in sparsematrixplot?...

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)
 (1)
 > M := LinearAlgebra:-RandomMatrix(20,density=0.25,generator=0 .. 1);
 (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))]] );
 >

## How I can plot3d with two different conditions...

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

Thanks

 >
 >

## How to handle unrecognized types and default value...

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?

## Why Maple refuses to change location of constants ...

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)

 > 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;

 >

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

## Apple Silicon and Rosetta 2 support...

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?

## maple calculate the define integral of a ellipsis...

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!

## Trying to make a simulated orbit accurate for thou...

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?

 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >

## Maple how to prove Sin2x=2sinxcosx for every real ...

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

Thank you!

## I need to debug the Error of parameters' must be s...

 > 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);
 (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                );
 >

## Find/Replace operation in a worksheet with code ed...

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

## dsolve not solving differential equations with ini...

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.

 >
 >
 (1)
 >
 (2)
 >
 (3)
 >
 (4)
 >
 (5)
 >
 (6)

## How to search if sets in a list are subsets of ano...

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

## small issue with translating abs() to Latex...

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.

## Not all the zeros of LegendreP are computed...

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.

 > restart:
 > Z := n -> op~(2, { allvalues(solve(LegendreP(n,x))) } );
 (1)
 > Digits:=10: Z(17): numelems(%);
 (2)
 > Z(18): numelems(%);
 (3)
 > Digits:=15: Z(18): numelems(%);
 (4)
 > Digits:=20: Z(18): numelems(%);
 (5)
 > Zf := n -> op~(2, { allvalues(solve(evalf(LegendreP(n,x)))) } ); Z(18): numelems(%);
 (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})
 (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: