MaplePrimes Questions

I got some planar graphs and I 'd like show their planar drawing. But the graph layout displayed by maple may not so balanced.

In the example below, we can see that the area of ​​the triangle 678 is too small, vertices 9, 10, 11 are crowded inside. I need to reduce the vertex size to better show it. Three vertices, say 9,10,11, in following planar drawing are not the right size.

with(GraphTheory):
d:=ConvertGraph("J|tZHkD@gF_"):
DrawPlanar (d, stylesheet=[ ],font=["Courier",10])

 

 

 

 

 

 

Vertexpadding doesn’t seem to help with vertex size reduction.

Ps:The algorithm used is Tutte's spring (or rubber) method. 

 

Maybe there is a better solution.

If we don’t adjust the vertex size, I don’t know if there is any other solution to improve the overall layout. It is best not to appear crowded.

 

I am solving this question :the line joining the ends of 2 rectangular diameters of an ellipse, remains tangent to a fixed circumference. My code is :

restart; with(geometry); with(plots); unprotect(O);
_EnvHorizontalName := x; _EnvVerticalName := y;
ell := x^2/a^2+y^2/b^2 = 1;
a := 5; b := 3; alpha := (1/6)*Pi; p := sqrt(a^2*b^2/(a^2+b^2));
PQ := x*cos(alpha)+y*sin(alpha)-p; drPQ := solve(PQ, y);
OPQ := x^2/a^2+y^2/b^2-((x*cos(alpha)+y*sin(alpha))/p)^2;
sol := solve({OPQ, ell}, {x, y}, explicit); P := [subs(sol[1], x), subs(sol[1], y)]; Q := [subs(sol[3], x), subs(sol[3], y)];
O := [0, 0];
Ell := implicitplot(ell, x = -a .. a, y = -b .. b, color = red);
DrOPQ := implicitplot(OPQ, x = -a .. a, y = -b .. b, color = magenta, numpoints = 5000);
DrPQ := plot(drPQ, x = -6 .. 6, color = green);
line(OP, 2*x-y); line(OQ, -(1/2)*x-y);

Points := pointplot([O[],P[],Q[]], symbol = solidcircle, color = red, symbolsize = 10):

T := textplot([[O[], "O"],[P[],"P"],[Q[],"Q"]], font = [times, 15], align = {below, right}):
cir := x^2+y^2 = p^2;
Cir := implicitplot(cir, x = -a .. a, y = -b .. b, color = black);
display([Ell, Cir, DrPQ, DrOPQ, Points, T], view = [-6 .. 6, -4 .. 6], axes = normal, scaling = constrained);
Fig := proc (k) local alpha, PQ, drPQ, DrPQ, OPQ, DrOPQ, sol, P, Q, Points, T; global a, b, p, ell, Ell, Cir; alpha := k; PQ := x*cos(alpha)+y*sin(alpha)+p; drPQ := solve(PQ, y); OPQ := x^2/a^2+y^2/b^2-(x*cos(alpha)+y*sin(alpha))^2/p^2; sol := solve({ell, OPQ}, {x, y}, explicit); P := [subs(sol[1], x), subs(sol[1], y)]; Q := [subs(sol[3], x), subs(sol[3], y)]; Points := pointplot([P[], Q[]], symbol = solidcircle, color = red, symbolsize = 10);
T := textplot([[P[], "P"], [Q[], "Q"]], font = [times, 15], align = {below, right}); DrPQ := plot(drPQ, x = -6 .. 6, color = green);µ DrOPQ := implicitplot(OPQ, x = -a .. a, y = -b .. b, color = magenta, numpoints = 5000);
display([Ell, Cir, DrPQ, DrOPQ, Points, T], view = [-a .. a, -b .. b], axes = normal, scaling = constrained) end proc;

Fig((1/4)*Pi);
Error, (in Fig) invalid subscript selector
nframes := 100; plots:-display([seq(Fig(2*Pi*i/nframes), i = 0 .. nframes)], insequence, scaling = constrained);
Error, (in Fig) invalid subscript selector
Explore(Fig(n), n = 0 .. 2*Pi);
Thank you for your help.

Can anyone please help with this?  I don't know what is the problem in this code.

 

restart; _EnvExplicit := true; with(DEtools); with(PDEtools); with(plots)

true

(1)

NULL

Check*the*constraint

eq1 := diff(X(z), z, z)+((diff(H(z), z))/H(z)-2/(1+z))*(diff(X(z), z))+exp(-sqrt(2/3)*X(z))*ZETA*(diff(Y(z), z))^2/(2*sqrt(6))-Y(z)*exp(-sqrt(2/3)*X(z))*(1-exp(-sqrt(2/3)*X(z)))/(2*H(z)^2*sqrt(6)*(1+z)^2) = 0

eq2 := diff(Y(z), z, z)+((diff(H(z), z))/H(z)-2/(1+z))*(diff(Y(z), z))-(1/3)*sqrt(6)*(diff(X(z), z))*(diff(Y(z), z))+(1-(1/2)*exp(-sqrt(2/3)*X(z)))/(2*ZETA*H(z)^2*(1+z)^2) = 0

eq3 := -2*H(z)*(1+z)*(diff(H(z), z))+3*H(z)^2+(1/2*((diff(X(z), z))^2+(1/2)*ZETA*exp(-sqrt(2/3)*X(z))*(diff(Y(z), z))^2))*H(z)^2*(1+z)^2-(1/4)*exp(-sqrt(2/3)*X(z))*Y(z)*(1-(1/2)*exp(-sqrt(2/3)*X(z))) = 0

-2*H(z)*(1+z)*(diff(H(z), z))+3*H(z)^2+((1/2)*(diff(X(z), z))^2+(1/4)*ZETA*exp(-(1/3)*6^(1/2)*X(z))*(diff(Y(z), z))^2)*H(z)^2*(1+z)^2-(1/4)*exp(-(1/3)*6^(1/2)*X(z))*Y(z)*(1-(1/2)*exp(-(1/3)*6^(1/2)*X(z))) = 0

(2)

NULL

``

NULL

NULL

diffux := solve(eq1, dif(H(z), z))

diffur := solve(eq2, dif(H(z), z))

NULL

NULL

NULL

NULL

NULL

NULL

``

Numeric*code

with(ListTools)

Seed := randomize()

with(stats[random])

sys := {subs(ZETA = 10, eq1), subs(ZETA = 10, eq2), subs(ZETA = 10, eq3)}

NULL

vv := 10^100; savf := []; L := 0; Digits := 30; MM := []; MMM := []; N := 1; kkk := []; MM; []; MMM := []

"for hh  from 1 by 1 to 1 do:L:=0: F:=0: b:=1: t:=2:while (t>b)do:"

n := 1.9; ZETA := 10; i := uniform[.60658, 1](N); ics := Y(i) = 1.8, (D(Y))(i) = 0, X(1) = .4, (D(X))(i) = 0, H(i) = .7; solution := dsolve({ics, op(subs(ZETA = 10, sys))}, {H(z), X(z), Y(z)}, type = numeric, method = bvp, output = listprocedure); m := [subs(solution, X(z))]; kk := [subs(solution, Y(z))]

"if op(kk(0))>.7 then  t:=(b)/(5): else t:=5*b :end if:end do: for T  from i by 10^(-1) to 1 do ls[T] := sqrt(0.29995*(1+ T)^(3)+5*10^(-5)*(1+ T)^(4)+0.7): sr[T] := op(kk(T)): L := L+(sr[T]-ls[T])^2 end  do:F:=sqrt(L): if F<vv  then vv:=F; sol:=solution:MM:=[op(MM),[vv,op(kk(1))]]:hhh:=vv:Pa:=[g,i]:else vv:=vv: MMM:=[op(MMM),vv]:end if:end do:"

Error, (in unknown) solution is only defined in the range .88696222680754726..1.

 

NULL

``

RH := subs(sol, Y(z)); Ry := subs(sol, X(z))

Error, invalid input: subs received sol, which is not valid for its 1st argument

 

Error, invalid input: subs received sol, which is not valid for its 1st argument

 

1-Mrad(1)+Rx(1)+Ry(1)

1-Mrad(1)+Rx(1)+Ry(1)

(3)

with(plots)

defHLCDM := sqrt(.29995*(1+z)^3+5*10^(-5)*(1+z)^4+.7)

plotqLCDM := plot((1+z)*(diff(defHLCDM, v))/defHLCDM-1, z = 0 .. 10, color = green, legend = ["q LCDM"])

plotqfR := [odeplot(sol, [z, Pa[1]*y(z)/(Pa[1]-1)+1], z = 0 .. 10, color = blue, legend = ["q R^n"])]; display(plotqLCDM, plotqfR)

plotHLCDM := plot(sqrt(.29995*(1+z)^3+5*10^(-5)*(1+z)^4+.7), z = 0 .. Pa[2], color = green, legend = ["H LCDM"], axes = boxed)

plotHfR := [odeplot(sol, [z, psi(z)], z = 0 .. Pa[2], color = blue, legend = ["H R^n"], axes = boxed)]; display(plotHLCDM, plotHfR)

 

psi*curve*fit

with(plots)

with(ListTools)

with(CurveFitting)

points1 := PolynomialInterpolation([[0, RH(0)], [1, RH(1)], [10, RH(10)], [100, RH(100)], [400, RH(400)], [800, RH(800)], [1200, RH(1200)], [1600, RH(1600)], [2000, RH(2000)], [2400, RH(2400)], [2800, RH(2800)], [3200, RH(3200)], [3600, RH(3600)], [4000, RH(4000)], [4400, RH(4400)], [4600, RH(4600)], [4800, RH(4800)], [5000, RH(5000)], [5200, RH(5200)], [5400, RH(5400)], [5600, RH(5600)], [5800, RH(5800)], [6000, RH(6000)], [6200, RH(6200)], [Pa[2], RH(Pa[2])]], v)

 

sd := plot(points1, z = 0 .. Pa[2], color = red, legend = ["curve fit"])

Error, (in plot) expecting a real constant as range endpoint but received Pa[2]

 

points11 := [[0, RH(0)], [.1, RH(.1)], [1, RH(1)], [10, RH(10)], [100, RH(100)], [400, RH(400)], [800, RH(800)], [1200, RH(1200)], [1600, RH(1600)], [2000, RH(2000)], [2400, RH(2400)], [2800, RH(2800)], [3200, RH(3200)], [3600, RH(3600)], [4000, RH(4000)], [4400, RH(4400)], [4600, RH(4600)], [4800, RH(4800)], [5000, RH(5000)], [5200, RH(5200)], [5400, RH(5400)], [5600, RH(5600)], [5800, RH(5800)], [6000, RH(6000)], [6200, RH(6200)], [Pa[2], RH(Pa[2])]]

sd := plot(points1, z = 0 .. Pa[2], color = red, legend = ["curve fit"], axes = boxed)

pntplot1 := pointplot(points11, symbol = BOX)

polycurve := PolynomialInterpolation(points11, z)

polyplot := plot(polycurve, z = 0 .. Pa[2], axes = boxed)

display([plotHLCDM, sd])

 

``

NULL

``

 

 

``

Luminosity*distnace

eq1h := diff(Hdi1(z), z)-1/points1 = 0

eq2h := diff(Hdi2(z), z)-1/defHLCDM = 0

sysh := {eq1h, eq2h}

icsh := Hdi1(0) = 0, Hdi2(0) = 0; solutionh := dsolve({icsh, op(sysh)}, {Hdi1(z), Hdi2(z)}, type = numeric, output = listprocedure)

plotLDistanceCFIT := [odeplot(solutionh, [z, (1+z)*Hdi1(z)], 0 .. Pa[2], color = blue, legend = ["Luminosity distance Curve fit"])]; plotLDistanceLCDM := [odeplot(solutionh, [z, (1+z)*Hdi2(z)], 0 .. Pa[2], color = red, legend = ["Luminosity distance LCDM"])]; display(plotLDistanceCFIT, plotLDistanceLCDM)

 

``

``

 

 

 

Download DistanceModulus.mw

 

Here is an example of map and flat_map in other scripting languages such as NodeJS:

 

let a = ['a', 'b', 'c']
a.map((e,i)=>[e,i])                    // returns: [['a', 0], ['b', 1], ['c', 2]]
a.flatMap((e,i) => e > 'b' ? [] : [e]) // returns: ['a', 'b']

 

What I do for map_with_index is:

 

map_with_index := (f, a) -> zip(f, to_list(a), [`$`(1..nops(to_list(a)))]);

 

My question is:

 

1) What is the canonical way to achieve map_with_index?

 

2) Is there a builtin procedure for flat_map? If not how to achieve it?

How do you use Maple to get the number of distinct partitions of an integer n, with parts of a maximum value of m? I would like to see how this is done in Maple.

 

Here are some examples obtained  by using SageMath:

 

Partitions(15, max_part=8, max_slope=-1).cardinality()

13

 

Partitions(15, max_part=8, max_slope=-1).list()

[[8, 7],

 [8, 6, 1],

 [8, 5, 2],

 [8, 4, 3],

 [8, 4, 2, 1],

 [7, 6, 2],

 [7, 5, 3],

 [7, 5, 2, 1],

 [7, 4, 3, 1],

 [6, 5, 4],

 [6, 5, 3, 1],

 [6, 4, 3, 2],

 [5, 4, 3, 2, 1]]

 

Partitions(75, max_part=60, max_slope=-1).cardinality()

48336

 

Partitions(100, max_part=35, max_slope=-1).cardinality()

290964

 

Partitions(125, max_part=75, max_slope=-1).cardinality()

3179161

 

—- the end -—
 

Dear all

Please i need your help to add heteroclinic or homoclinic  orbits to my plot 

 

heteroclinic_homoclinic_orbits.mw

 

Many thanks

Maple generates latex for hbar as  \mathit{hbar}  instead of just \hbar which makes it not render in PDF.  Here is an example

expr:= hbar*x;
latex(expr)

The screen display is correct. But not the latex. When compiling the above in Latex this is the output

\documentclass[12pt]{article}
\usepackage{amssymb}

\begin{document}  

%Maple generated
\[
\mathit{hbar} x
\]

%default
\[
\hbar x
\]

%need amssymb for this
\[
\hslash x
\]
\end{document}

Compiling the above gives

So to use the standard hbar,  \mathit should not be used around it. 

ps. I like \hslash more myself than \hbar , so if there is a choice, will vote for \hslash for latex.

Maple 2021, windows 10. 

 

Physics:-Version()
The "Physics Updates" version in the MapleCloud is 973 and is 

   the same as the version installed in this computer, created 

   2021, May 3, 18:54 hours Pacific Time.


 

Dear Maple community,

I was wondering whether you could help me with the following problem: Consider the non-linear system of 4 equations in 4 unknowns: {y[2,1], y[2,2], y[4,1], y[4,2]}, see MapleQ.mw. Please also note that equations y[2,1] and y[2,2] in sys2 are homogenous of degree 1 (i.e., defined only up to scale). In principle, it should be possible to choose either y[2,1] or y[2,2] as a free and unconstrained variable (a scaling factor) and express all other unknowns in terms of it. Unfortunately, I couldn't yet implement it in the current setting and was wondering whether you give me a hand. Thank you very much in advance!

``

sys1 := {y[4, 1] = 33^(2/3)*50^(1/3)/(33*(1/(y[2, 1]^(3/2)*y[4, 1]^(3/2)))^(1/3))+2^(2/3)*5^(1/3)/(2*(1/(y[2, 2]^(3/2)*y[4, 2]^(3/2)))^(1/3)), y[4, 2] = 11^(2/3)*50^(1/3)/(11*(1/(y[2, 1]^(3/2)*y[4, 1]^(3/2)))^(1/3))+4^(2/3)*5^(1/3)/(4*(1/(y[2, 2]^(3/2)*y[4, 2]^(3/2)))^(1/3))}

sys2 := {y[2, 1] = 33/(100*sqrt(y[2, 1])*y[4, 1]^(3/2)*(33/(50*y[2, 1]^(3/2)*y[4, 1]^(3/2))+2/(5*y[2, 2]^(3/2)*y[4, 2]^(3/2))))+11/(40*sqrt(y[2, 1])*y[4, 1]^(3/2)*(11/(20*y[2, 1]^(3/2)*y[4, 1]^(3/2))+1/(2*y[2, 2]^(3/2)*y[4, 2]^(3/2))))+3*y[2, 2]/(20*y[2, 1]^(3/2)*y[4, 1]^(3/2)*(11/(50*y[2, 1]^(3/2)*y[4, 1]^(3/2))+4/(5*y[2, 2]^(3/2)*y[4, 2]^(3/2))))+3*y[2, 2]/(10*y[2, 1]^(3/2)*y[4, 1]^(3/2)*(11/(25*y[2, 1]^(3/2)*y[4, 1]^(3/2))+3/(5*y[2, 2]^(3/2)*y[4, 2]^(3/2)))), y[2, 2] = 11*y[2, 1]/(75*y[2, 2]^(3/2)*y[4, 2]^(3/2)*(33/(50*y[2, 1]^(3/2)*y[4, 1]^(3/2))+2/(5*y[2, 2]^(3/2)*y[4, 2]^(3/2))))+11*y[2, 1]/(60*y[2, 2]^(3/2)*y[4, 2]^(3/2)*(11/(20*y[2, 1]^(3/2)*y[4, 1]^(3/2))+1/(2*y[2, 2]^(3/2)*y[4, 2]^(3/2))))+2/(5*sqrt(y[2, 2])*y[4, 2]^(3/2)*(11/(50*y[2, 1]^(3/2)*y[4, 1]^(3/2))+4/(5*y[2, 2]^(3/2)*y[4, 2]^(3/2))))+3/(10*sqrt(y[2, 2])*y[4, 2]^(3/2)*(11/(25*y[2, 1]^(3/2)*y[4, 1]^(3/2))+3/(5*y[2, 2]^(3/2)*y[4, 2]^(3/2))))}

 

Download MapleQ.mw

I was taking notes from a video and fromatting them in a table so I could pring them.

I an using the commands in the context panel to keep things neat.

I can't get this to work for the last row of the table. when I select the equation, the right context panel changes to information about the table and the commands for manipulating the equations are not available. This occurs on the tenth row or later. 

I have since tried interface(rtablesize = [12,12]) but that didnt help.

If I run the document I can get the 10th row to solve by displaying the output first and then using the commands from the context panel

         
             

2*a[0]*a[9]*c[2] + 2*a[1]*a[8]*c[2] + 2*a[2]*a[7]*c[2] + 2*a[3]*a[6]*c[2] + 2*a[4]*a[5]*c[2] + a[9]*c[1];
 
                              8            
                     1430 c[2]             
                     ---------- + a[9] c[1]
                           16              
                       c[1]                

                             "(->)"

solve( 1430*c[2]^8/c[1]^16 + a[9]*c[1]=0, a[9] );
                                     8
                            1430 c[2] 
                          - ----------
                                  17  
                              c[1]    

                             "(->)"

a[9] := -1430*c[2]^8/c[1]^17: 'a[9]';
                              a[9]


           

Edited:- to improve readability and add more information.

restart

 

NULL

NULL``

                                                           

 

a[0] := 0

2*a[0]*a[1]*c[2]+a[1]*c[1]+1 = 0"(->)"-1/c[1]"(->)"a[1]NULL

2*a[0]*a[2]*c[2]+a[1]^2*c[2]+a[2]*c[1] = 0"(->)"-c[2]/c[1]^3"(->)"a[2]NULL

2*a[0]*a[3]*c[2]+2*a[1]*a[2]*c[2]+a[3]*c[1] = 0"(->)"-2*c[2]^2/c[1]^5"(->)"a[3]

2*a[0]*a[4]*c[2]+2*a[1]*a[3]*c[2]+a[2]^2*c[2]+a[4]*c[1] = 0"(->)"-5*c[2]^3/c[1]^7"(->)"a[4]

2*a[0]*a[5]*c[2]+2*a[1]*a[4]*c[2]+2*a[2]*a[3]*c[2]+a[5]*c[1] = 0"(->)"-14*c[2]^4/c[1]^9"(->)"a[5]NULL

2*a[0]*a[6]*c[2]+2*a[1]*a[5]*c[2]+2*a[2]*a[4]*c[2]+a[3]^2*c[2]+a[6]*c[1]"(->)"-42*c[2]^5/c[1]^11"(->)"a[6]

2*a[0]*a[7]*c[2]+2*a[1]*a[6]*c[2]+2*a[2]*a[5]*c[2]+2*a[3]*a[4]*c[2]+a[7]*c[1]"(->)"-132*c[2]^6/c[1]^13"(->)"a[7]

2*a[0]*a[8]*c[2]+2*a[1]*a[7]*c[2]+2*a[2]*a[6]*c[2]+2*a[3]*a[5]*c[2]+a[4]^2*c[2]+a[8]*c[1]"(->)"-429*c[2]^7/c[1]^15"(->)"a[8]

2*a[0]*a[9]*c[2]+2*a[1]*a[8]*c[2]+2*a[2]*a[7]*c[2]+2*a[3]*a[6]*c[2]+2*a[4]*a[5]*c[2]+a[9]*c[1]

 

 

NULL


 

Download Table_solve_issue.mw

Hi,

I am trying to randomly generate, say, 20 ordered pairs of 'noisy' data that have a correlation coefficient in the range 0.8 - 0.9. I've looked at certain command in the Statistics package, but I'm not finding anything that appears useful. Can this be done in Maple?

How can I use symbols from the Emoji and Symbols collection on a Mac in a document or worksheet in Maple? I want to create documents but I find symbols not included in Maple that I require. I have found that some symbols will stay in the document if I insert them when in TEXT mode, but that does not work when entering a fraction for example and needing a symbol. When reloading a previously saved document, I find that the symbol has not saved.

 

A related question: how can I expand on the default symbols in the toolboxes?

 

Thanks.

 

Dear maple users,

In this code, how to find out the f'(x,t) and f''(x,t) values.
How to export the computed values in the excel file.JVB.mw

restart:

with(PDEtools):

with(plots):

fcns := {f(x,t)};

{f(x, t)}

(1)

ra:=2:b1:=1.41:na:=0.7:we:=0.5:eta[1]:=4*0.1:d:=0.5/1:xi:=0.1:m:=na:ea:=0.5:pr:=21: gr:=0.1:

R:=0.9323556933;

.9323556933

(2)

PDE1 :=ra*(diff(f(x,t),t))=+b1*(1+ea*cos(t))+(1/(R^2))*((diff(f(x,t),x,x))+(1/x)*diff(f(x,t),x));

2*(diff(f(x, t), t)) = 1.41+.705*cos(t)+1.150367877*(diff(diff(f(x, t), x), x))+1.150367877*(diff(f(x, t), x))/x

(3)

IBC := {D[1](f)(0,t)=0,f(1,t)=0,f(x,0)=0};

{f(1, t) = 0, f(x, 0) = 0, (D[1](f))(0, t) = 0}

(4)

sol :=  pdsolve({PDE1}, IBC, numeric,spacestep = 0.025, timestep=0.0001) ;

module () local INFO; export plot, plot3d, animate, value, settings; option `Copyright (c) 2001 by Waterloo Maple Inc. All rights reserved.`; end module

(5)

sol:-plot[display](f(x, t), t = 1.2, linestyle = "solid", title = "Velocity Profile", labels = ["r", "f"]);

 

``


 

Download JVB.mw

 

Hello,

For debbugging big programs, i have been told that one good solution is to use the mint application.

I'm trying to do so that is to say to use the mint application with windows. But, i encounter some difficulties.

The program on which i would like to apply the mint is composed of several parts like in the package Shapes and the different parts of the module are called thanks to the $include syntax.

To test mint, i have launched a command window with the command cmd in windows.

After, i apply cd PathRepertoryContainingMint

On i am located in this repertory, i test the following syntax :
mint -I PathRepertoryContainingTheDifferentFiles PathRepertoryContainingTheMainProgram\program.mpl

In my case these two paths are the same.

I test also the following syntax:

mint -o PathRepertoryContainingTheOuput\mintoutput.mpl PathRepertoryContainingTheMainProgram\program.mpl

It may run but i don't know where i can recover the output of mint

I have been told also to set the Windows PATH variable to include the Maple bin directory (thank you @Joe Riel for this tip). I think that it should be a good idea but I never do this type of manipulation.

On the net, I find that the process to do so is the following : setx path "%path%;c:\directoryPath"

Questions: 

1) If you have some experience in using mint with windows, may you give some tips (precise the right syntax) to use it ? 

2) In case the option -o is not used, where the output of mint is coming ?

I thank you in advance for your help.

I only use latex() to convert Maple solution to Latex. I do not export whole document to Latex.

When I ask Maple to convert this solution of a PDE to latex, it generated strange Latex which is different, from the Latex it generates for same solution, when doing File->Export As->Latex.

The Latex it generated in the export case, is the one I want. The latex it generates from the latex() command, I am not able to use and is completely different. It has things like \mathit{Typesetting} and other different latex.  

Why is that? And how to make it generates the same Latex for this expression as in the export case?

First I show screen shot, then the worksheet to reproduce it

 

But Now when I save this worksheet (with only the expression I want) 

Using File->Export As->Latex, and then look at the latex for the "sol" in the latex file generated, this is what it shows (I am only showing the latex part of the above, not the whole file)

\begin{maplelatex}
\mapleinline{inert}{2d}{}
{\[\mathit{sol} \coloneqq u \left(r ,t \right)=\mathcal{L}^{-1}
\left(\frac{\mathrm{BesselJ}\left(0,10 \sqrt{-s}\, r \right) s}
{\mathrm{BesselJ}\left(0,20 \sqrt{-s}\right) \left(s^{2}+1\right)},s ,t \right)
-\mathcal{L}^{-1}\left(\frac{\mathrm{BesselJ}\left(0,10 \sqrt{-s}\, r \right)}
{\mathrm{BesselJ}\left(0,20 \sqrt{-s}\right) s},s ,t \right)
-\cos \left(t \right)+1\]}
\end{maplelatex}

The above latex I can compile standalone, and it does not have the problematic constructs found when using latex(sol)

One can see it is very different from the top one given earlier.

Why are the two latex different? Is there an extra setting one needs to adjust?  How make latex(sol) generate the same latex for the expression as found in the file generated by export as latex?

may_2.mw

update 1

Did some debugging. The problem happens when using `:-executeprintroutines`.  Tracing the latex() command in the debugger. At lines 42, it has the call

texlist := [latex:-Print(e,_rest,':-executeprintroutines',':- handleimaginaryunit',':-performonlyoncetasks',opt)];

Where above is the expression to convert to Latex. When I removed ':-executeprintroutines' the problems in latex went away. Here is an example

restart;
sol:=u(r,t) = invlaplace(BesselJ(0,10*(-s)^(1/2)*r)/BesselJ(0,20*(-s)^(1/2))*s/(s^2+1),s, t) - invlaplace(BesselJ(0,10*(-s)^(1/2)*r)/BesselJ(0,20*(-s)^(1/2))/s,s, t)- cos(t) + 1;
latex:-Print(sol)

Gives

"u ! left(r , t\right)", ` = `, `\\mathit{invlaplace} 
\\! \\left(\\frac{\\mathit{BesselJ}\\! \\left(0, 10 \\sqrt{-s}\\, r \\right) s}
{\\mathit{BesselJ}\\! \\left(0, 20 \\sqrt{-s}\\right) \\left(s^{2}+1\\right)}, s , t\\right)
-\\mathit{invlaplace} \\! \\left(\\frac{\\mathit{BesselJ}\\! 
\\left(0, 10 \\sqrt{-s}\\, r \\right)}{\\mathit{BesselJ}\\! \\left(0, 20 \\sqrt{-s}\\right) s}, s , t\\right)
-\\cos \\! \\left(t \\right)+1`

Now notice what happens when adding ':-executeprintroutines'

restart;
sol:=u(r,t) = invlaplace(BesselJ(0,10*(-s)^(1/2)*r)/BesselJ(0,20*(-s)^(1/2))*s/(s^2+1),s, t) - invlaplace(BesselJ(0,10*(-s)^(1/2)*r)/BesselJ(0,20*(-s)^(1/2))/s,s, t)- cos(t) + 1;
latex:-Print(sol,':-executeprintroutines')

it gives the problematic latex

"u ! left(r , t\right)", ` = `, `\\mathit{Typesetting}\\mcoloneq \\mathit{msup}\\! 
\\left(\\mathit{Typesetting}\\mcoloneq \\mathit{mi}\\! 
\\left(\\text{\`\`$\\mathcal\\{L\\}$"}\\right), \\mathit{Typesetting}\\mcoloneq 
\\mathit{mrow}\\! \\left(\\mathit{Typesetting}\\mcoloneq \\mathit{mo}\\! 
\\left(\\text{\`\`$-$"}\\right), \\mathit{Typesetting}\\mcoloneq \\mathit{mn}\\! 
\\left(\`\`1"\\right)\\right), \\mathit{Typesetting}\\mcoloneq \\mathit{msemantics}=\\text{\`\`atomic"}\\right)\\! \\left(\\frac{J_{0}\\! \\left(10 
\\sqrt{-s}\\, r \\right) s}{J_{0}\\! \\left(20 \\sqrt{-s}\\right) \\left(s^{2}+1\\right)}, s , t\\right)-
\\mathit{Typesetting}\\mcoloneq \\mathit{msup}\\! \\left(\\mathit{Typesetting}\\mcoloneq 
\\mathit{mi}\\! \\left(\\text{\`\`$\\mathcal\\{L\\}$"}\\right), \\mathit{Typesetting}\\mcoloneq 
\\mathit{mrow}\\! \\left(\\mathit{Typesetting}\\mcoloneq \\mathit{mo}\\! \\left(\\text{\`\`$-$"}\\right), 
\\mathit{Typesetting}\\mcoloneq \\mathit{mn}\\! \\left(\`\`1"\\right)\\right), 
\\mathit{Typesetting}\\mcoloneq \\mathit{msemantics}=
\\text{\`\`atomic"}\\right)\\! \\left(\\frac{J_{0}\\! \\left(10 \\sqrt{-s}\\, r \\right)}
{J_{0}\\! \\left(20 \\sqrt{-s}\\right) s}, s , t\\right)-\\cos \\! \\left(t \\right)+1`

I do not know what :-executeprintroutines does and how one can tell latex() not to call it at the user level. I asked about :-executeprintroutines before here

  https://www.mapleprimes.com/questions/231230-Why-Latex-Removes-Constant-From-Expression

And I could not find any documenation on it.  

I tried to define my own executeprintroutines proc() which does nothing. But it did not help

restart;
sol:=u(r,t) = invlaplace(BesselJ(0,10*(-s)^(1/2)*r)/BesselJ(0,20*(-s)^(1/2))*s/(s^2+1),s, t) - invlaplace(BesselJ(0,10*(-s)^(1/2)*r)/BesselJ(0,20*(-s)^(1/2))/s,s, t)- cos(t) + 1;
executeprintroutines:=proc()
   NULL;
end proc;
latex(sol)

The Latex was not fixed. It is same. 

May be the above will help find the issue.

 

Using a Cyrillic font in the Combo Box component gives an runtime error when saving workbook file (*.maple file extension).

cyr_wb_save_error.zip

Select the second item in Combo Box component and press save button.

 
First 290 291 292 293 294 295 296 Last Page 292 of 2308