Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Optimization code for mathematical model with nine compartments,

How can I generate a code to plot the optimals; h, chi and psi?

Hello,

I am experiencing difficulties using my old Maple programs with the newer version. I tried changing the types of inputs and the typesetting level, but it just doesn't work. I would appreciate it if someone could help me overcome my ignorance.

Some simple input is attached with the output.

Hi everyone, I am trying to draw horizontal and vertical line on the graph. Command is working but vertical line is not displayed. Looking for help in this regrads.

vertical_and_horizonatl_line_help.mw

Hi everyone, I am trying to draw bar graph for my expression, but received error. Could anyone please help me in this regard.

Help_Bar_graph.mw

Hi

On the latest Maple 2022 version, using dsolve with 1st order ODE and Dirac function returns an incorrect solution

dsolve({D(y)(t) + y(t)/tau = Dirac(t)/tau, y(0) = 0})

See attached image. The correct impulse response should be :

y(t) = exp(-t/tau)*Heaviside(t)/tau

The returned solution is 0 for t = 0 and scaled by a 1/2 for t > 0. I never had such an issue with older Maple versions. Is this a bug or am I doing something wrong

Here is the expected solution followed by the Maple solution:

Hi,

I use the RamdonGraph function quite a bit and wanted to know if it is possible to generate random graphs with specific properties, beyond the typical order, size, connectednes, etc. Specifically, I am interesting in generating eulerian (containing an eulerian circuit), semi-eulerian (containing an eulerian trail) and hamiltonian (containing a spanning cycle)  graphs. Also, the abiltiy to randomly generate graphs that have none of these properties would be helpful.

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

hello,

I computed some algebraic calculation, but near point -1 there is some issue like disconvergencies. Can anyone help in this regard? In the final graph, as seen the paths of the curves are close together and convergence does not occur AROUND POINT -1.

restart

Digite := 30

30

(1)

beta := 2.5; lambda := 0.1e-1; b := Pi; a := Pi; alpha := 0; y[1] := 1.5; y[2] := 1.5; x[1] := -1; x[2] := 1; Q[1] := 40; Q[2] := 35; T[1] := 20

2.5

 

0.1e-1

 

Pi

 

Pi

 

0

 

1.5

 

1.5

 

-1

 

1

 

40

 

35

(2)

v := (2*n-1)*Pi/(2*b)

Delta := exp(2*v*a)*(alpha*v+beta)*(1+lambda)-(1-lambda)*(alpha*v-beta)

omega := Pi/(2*b)

P[1] := ((1+lambda)*exp(-v*abs(x-xi))+(1-lambda)*exp(v*(x+xi)))*exp(2*v*a)+(1+lambda)*exp(-v*(x+xi))+(1-lambda)*exp(v*abs(x-xi))

P[2] := ((1+lambda)*exp(-v*abs(x-xi))+(1-lambda)*exp(v*(x+xi)))*exp(2*v*a)-(1+lambda)*exp(-v*(x+xi))-(1-lambda)*exp(v*abs(x-xi))

P[3] := P[1]*(-alpha^2*v-alpha*beta+alpha*v)+beta*P[2]

G[11] := (sum((alpha*P[1]*(1-lambda)*(alpha*v-beta)*exp(-2*v*a)+(1+lambda)*P[3])*(cos(v*(y-eta))-cos(v*(y+eta)))/(v*(exp(2*v*a)*(alpha*v+beta)*(1+lambda)-(1-lambda)*(alpha*v-beta))), n = 1 .. 80))/(2*b*(1+lambda))+(2*(1+lambda)*alpha*b/Pi*.25)*ln((1+2*exp(-omega*abs(x-xi))*cos(omega*(y-eta))+exp(-2*omega*abs(x-xi)))*(1-2*exp(-omega*abs(x-xi))*cos(omega*(y+eta))+exp(-2*omega*abs(x-xi)))*(1+2*exp(-omega*(2*a+x+xi))*cos(omega*(y-eta))+exp(-2*omega*(2*a+x+xi)))*(1-2*exp(-omega*(2*a+x+xi))*cos(omega*(y+eta))+exp(-2*omega*(2*a+x+xi)))/((1-2*exp(-omega*abs(x-xi))*cos(omega*(y-eta))+exp(-2*omega*abs(x-xi)))*(1+2*exp(-omega*abs(x-xi))*cos(omega*(y+eta))+exp(-2*omega*abs(x-xi)))*(1-2*exp(-omega*(2*a+x+xi))*cos(omega*(y-eta))+exp(-2*omega*(2*a+x+xi)))*(1+2*exp(-omega*(2*a+x+xi))*cos(omega*(y+eta))+exp(-2*omega*(2*a+x+xi)))))/(2*b*(1+lambda))+(2*(1-lambda)*alpha*b/Pi*.25)*ln((1+2*exp(omega*(x+xi))*cos(omega*(y-eta))+exp(2*omega*(x+xi)))*(1-2*exp(omega*(x+xi))*cos(omega*(y+eta))+exp(2*omega*(x+xi)))*(1+2*exp(-omega*(2*a-abs(x-xi)))*cos(omega*(y-eta))+exp(-2*omega*(2*a-abs(x-xi))))*(1-2*exp(-omega*(2*a-abs(x-xi)))*cos(omega*(y+eta))+exp(-2*omega*(2*a-abs(x-xi))))/((1-2*exp(omega*(x+xi))*cos(omega*(y-eta))+exp(2*omega*(x+xi)))*(1+2*exp(omega*(x+xi))*cos(omega*(y+eta))+exp(2*omega*(x+xi)))*(1-2*exp(-omega*(2*a-abs(x-xi)))*cos(omega*(y-eta))+exp(-2*omega*(2*a-abs(x-xi))))*(1+2*exp(-omega*(2*a-abs(x-xi)))*cos(omega*(y+eta))+exp(-2*omega*(2*a-abs(x-xi))))))/(2*b*(1+lambda))

g[12] := lambda*((alpha*v+beta)*exp(v*(2*a+x))+(alpha*v-beta)*exp(-v*x))*exp(-v*xi)/(v*Delta)

G[12] := (sum(g[12]*(cos(v*(y-eta))-cos(v*(y+eta))), n = 1 .. 80))/b

phi[1] := int(int(G[11]*Q[1]*Dirac(xi-x[1])*Dirac(eta-y[1]), xi = -a .. 0), eta = 0 .. b)+int(int(G[12]*Q[2]*Dirac(xi-x[2])*Dirac(eta-y[2]), xi = 0 .. infinity), eta = 0 .. b)

Z[1] := diff(phi[1], x)

psi[1] := int(Z[1], y)

plot3d(psi[1], x = -a .. 0, y = 0 .. b)

 

with(plots)

contourplot(psi[1], x = -a .. 0, y = 0 .. b)

 

 

Download sai_1.mw

I have a guess about the set of the zeros of the following polynomial

y(1-x^{m+1}z)+(1-x^{n+1}z), (here m,n are positive integers and z is a primitive d-root of unity)

which are located on the complex 2-dimensional torus. The set of solutions is finite (I think the system is zero-dimensional). My goal is to verify my guess numerically using Maple for some small values of m and n and a fixed value of z. I think if (x,y) is a solution, then x is either a (n-m) root of unity or a (n-m) root of 1/z^2 (where n>m).

You can find my code for n=3 and m = 1 attached (I was not able to load the mw format so I put the zip version). I consider z to be a third root of unity but actually, I am interested in putting z= exp(2pi/3*i) and even the real third root z=1 is not interesting for me, but since the exponential representation led to an error, I changed it to z and mentioned that z^3=1. Still, it has an error and  I would be grateful if you could let me know how I can correct this code.  

Question.maple.zip

what the meaning this warning : Warning, cannot evaluate the solution further right of 1.3344882, probably a singularity

how to analize this warning
Thank you

How do I format the display of numbers in Microsoft Excel 365 using the Maple 2023 Add-In?

The default formatting is inconsistent: displays as but displays as . At minimum, I would like all of the numbers to display using a consistent format, preferably standard scientific notation (1.27420168E7 and not or ).

This post is in response to a question regarding the speed of Maple 2023 on different computers. 

I'm asking users to suggest a few benchmark problems for Maple to calculate for testing.  Basic system information (Processor speed, RAM, video card etc..) perform the calculation, get the timing and then we can collect all the information into a chart where we can update it in the original post of this thread. 

All input is welcome, it doesn't have to be confined to Maple 2023.  We can expand to as many older versions as we wish. 

Hi,
I wanted to do a 3d plot such that a function is plotted over a polar plane. I am not sure what is the best way to plot this and would appreciate some guidance/tips.

I want to plot the following function 1/(r^2*sin(theta)^2) .

I tried plot3d but the base plane is not a circle but a square...

Hello!

I have a i9 9th Generation processor with 32 GB ram

If I upgrade to a i9 13 Generation processor with 64 GB ram

Assume I change the main card to Z790

I wonder if I will notice a big improvement in performance when running Maple 2023?

Kjell

I have been writing a language translator. I have everything working reasonably well except that when translating abs(expr) with optimize=tryhard, the IntermediateCode converts the abs() into if...then...else statements. This would be fine except the type of the expr is generally a complex number. I need to optimize the code because there is a lot of redundant calculations otherwise.

I can't figure out how to get IntermediateCode from breaking the abs function into if...then...else statements. [My solution so far is to substitute abs with a dummy name and then use the translator to translate the dummy name into an abs statement - That's really not how things should work!]

Any suggestions?

I've included some example test cases of what is going wrong.

with(CodeGeneration)

testproc1 := proc (x) abs(x) end proc

IntermediateCode(testproc1, optimize = tryhard)

Scope( nametab,
  AssignedName(Name("testproc1"), Scope( nametab,
    Procedure(
      ParameterSequence(Declaration(Name("x"), Type(integer))),
      LocalSequence(Declaration(Name("s1"), Type(integer))),
      OptionSequence(),
      ExpressionSequence(),
      StatementSequence(
        If(
          ConditionalPair(LessEqual(Integer(0), Name("x")), StatementSequence(
            Assignment(Name("s1"), Name("x"))
          )),
          ConditionalPair(Less(Name("x"), Integer(0)), StatementSequence(
            Assignment(Name("s1"), Negation(Name("x")))
          )),
          StatementSequence(
            Assignment(Name("s1"), Integer(0))
          )
        ),
        Return(Name("s1"))
      ),
      DescriptionSequence(),
      GlobalSequence(),
      LexicalSequence(),
      Type(integer)
    )
  ))
)

 

testproc2 := proc (x::numeric) abs(x) end proc

IntermediateCode(testproc2, optimize = tryhard)

Scope( nametab,
  AssignedName(Name("testproc2"), Scope( nametab,
    Procedure(
      ParameterSequence(Declaration(Name("x"), Type(numeric))),
      LocalSequence(Declaration(Name("s1"), Type(numeric))),
      OptionSequence(),
      ExpressionSequence(),
      StatementSequence(
        If(
          ConditionalPair(LessEqual(Float(0, 0), Name("x")), StatementSequence(
            Assignment(Name("s1"), Name("x"))
          )),
          ConditionalPair(Less(Name("x"), Float(0, 0)), StatementSequence(
            Assignment(Name("s1"), Negation(Name("x")))
          )),
          StatementSequence(
            Assignment(Name("s1"), Float(0, 0))
          )
        ),
        Return(Name("s1"))
      ),
      DescriptionSequence(),
      GlobalSequence(),
      LexicalSequence(),
      Type(numeric)
    )
  ))
)

 

NULL

testproc3 := proc (x::complex) abs(x) end proc

IntermediateCode(testproc3, optimize = tryhard)

Scope( nametab,
  AssignedName(Name("testproc3"), Scope( nametab,
    Procedure(
      ParameterSequence(Declaration(Name("x"), Type(complex))),
      LocalSequence(),
      OptionSequence(),
      ExpressionSequence(),
      StatementSequence(
        Return(FunctionCall(Name("abs"), ExpressionSequence(Name("x")), unknown))
      ),
      DescriptionSequence(),
      GlobalSequence(),
      LexicalSequence(),
      Type(numeric)
    )
  ))
)

 

NULL

Download intermediate_code_abs.mw

2 3 4 5 6 7 8 Last Page 4 of 2052