Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

I have two random variables:  x and y.  I want to multiply them and get the resulting Probability Density Function, z.  If you look below, Example 1 works as expected.  When I try Example 2, however, I get disappointing results.

Clearly, Example 2 involves nonzero lower boundaries, which is messing me up.  Does anyone have any suggestions for Example 2?

Example 1

with(Statistics)

x := RandomVariable(Uniform(0, 1))

_R

(1)

y := RandomVariable(Uniform(0, 2))

_R0

(2)

z = PDF(x*y, t)

z = piecewise(t < 0, 0, t <= 2, (1/2)*ln(2)-(1/2)*ln(t), 2 < t, 0)

(3)

 

 

Example 2

x := RandomVariable(Uniform(1, 2))

_R1

(4)

y := RandomVariable(Uniform(2, 3))

_R2

(5)

z := PDF(x*y, t)

int(piecewise(_t < 1, 0, _t < 2, 1, 2 <= _t, 0)*piecewise(t/_t < 2, 0, t/_t < 3, 1, 0)/abs(_t), _t = -infinity .. infinity)

(6)
 

NULL

Download MultiplyPDFFunctions.mw

Hi,
I am experimenting with Threads:-Task:-Continue in Maple 2020.2 and sometimes it returns different results depending on N, or, how fine the mesh is. I have modified procedures cont and task in a Maple example shown in a worksheet. I can compare the result from Threads with one I can obtain another way and which surely is correct. The result from Threads depends on N: sometimes it is correct, sometimes it is not. The wrong result is returned only when the Threads:-Task:-Continue loop is executed, of course.

Has anyone spotted that problem? Is there a way to trace what actually is being done in each leaf? Does this problem appear in later versions of Maple?

I would appreciate some feedback.

Thanks in advance,

Rafal Anlamowicz
rablamowicz@gmail.com

Hello there,

There are two ways that I know of to define functions in maple:

f(x) :=      (1)

and 

f := x->     (2)

The issue that I'm noticing is that if I only use one method, everything works as I expect it to, but if I use both methods in the same document on a function with the same name eg. (doing f :=x->2x and then later in the document doing f(x) := 5x), (2) seems to completely overrule anything (1) says, even if (1) is used after. 
Can anyone explain why this is? 

I’m having trouble solving this. Any suggestions would be helpful.

NULL

restart

``

with(Optimization); with(plots); with(Student[VectorCalculus]); with(LinearAlgebra)

``

ineq := simplify((Cr*rho0*t*(Cr*alpha*b-alpha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, 0 < sigma, 0 < t}

(2)

 

(solve({ineq}, t) assuming extra[]);

 

``

Download Q_solve.mw

I require the condition for equations  C1<C2<C4​, with all parameters strictly positive and subject to the constraint t > t1​.
I want to solve for the variables t and s. Specifically, what are the analytical conditions on t that ensure C2>C1​, and what are the analytical conditions on s that ensure C4 > C2 >C1​ ?

I attempted to solve this , but I keep encountering errors.
Q_solving_t_and_s.mw

Hi,
I’m taking the liberty of getting back to you once again regarding the animation of a procedure (here, for fractals). I’m able to use the Explore command correctly, but I’m having difficulty with animate.
Thank you very much for your help — it is truly invaluable.

Q_Fractales.mw

In the plot shown below, one of the axes is not visible, and one of the lines inside the graph is also missing. Is there an error in the plotting syntax that is causing this issue? Could anyone please identify the mistake and suggest how to correct it

All_plots_Question.mw

I do not use table data struct in Maple and could not find anything in help on how to do this.

given a table T such as the following, typing indices(T) shows there are more than entry in each index

indices(T)

[[-0.687272727272727, -0.687272727272727, 1.],   [2.25818181818182, 2.25818181818182, 1.]], 

  [[-2.47, -1.47, 2.], [0.53, 1.53, 2.]], 

  [[0.245, -2.755, -2.], [2.745, -0.255, -2.]], 

  [[-2.6, -0.6, 3.], [0.379, 2.379, 3.]], 

  [[2.659, -1.341, -3.], [4.652, 0.652000000000001, -3.]], 

  [[-3.178, 0.822000000000001, 5.], [-1.185, 2.815, 5.]], 

  [[0.0672727272727271, -0.932727272727273, 0.], [3.06181818181818, 2.06181818181818, 0.]], 

  [[2.8895, -2.1105, -4.], [4.3895, -0.6105, -4.]], 

  [[1.01, -0.99, -1.], [4.02571428571429, 2.02571428571429, -1.]], 

  [[-3.63, -0.63, 4.], [-1.13875, 1.86125, 4.]]

In the above each entry in table has 2 indices. I want to keep only the first index in each entry so that it has only one, to become this

[[-0.687272727272727, -0.687272727272727, 1.]], 

[[-2.47, -1.47, 2.]], 

[[0.245, -2.755, -2.]],

 [[-2.6, -0.6, 3.]], 

[[2.659, -1.341, -3.]],

 [[-3.178, 0.822000000000001, 5.]],

 [[0.0672727272727271, -0.932727272727273, 0.]], 

[[2.8895, -2.1105, -4.]], 

[[1.01, -0.99, -1.]], 

[[-3.63, -0.63, 4.]]

And keep everything else as in in the Table. Just need to adjust the indices to be one entry instead of 2 or more.

Here is an example of such table


T:=table([([-.687272727272727, -.687272727272727, 1.], [2.25818181818182, 2.258181\
81818182, 1.])=COLOR(RGB,.63529412,.60392157,.60000000),([-2.47, -1.47, 2.], [.\
53, 1.53, 2.])=COLOR(RGB,.60784314,.47450980,.46274510),([.245, -2.755, -2.], [
2.745, -.255, -2.])=COLOR(RGB,.44705882,.52549020,.67058824),([-2.6, -.6, 3.],
[.379, 2.379, 3.])=COLOR(RGB,.57647059,.34509804,.32549020),([2.659, -1.341, -3\
.], [4.652, .652000000000001, -3.])=COLOR(RGB,.34901961,.46666667,.70980392),([
-3.178, .822000000000001, 5.], [-1.185, 2.815, 5.])=COLOR(RGB,.47058824,0.,.\
54901961e-1),([.672727272727271e-1, -.932727272727273, 0.], [3.06181818181818,
2.06181818181818, 0.])=COLOR(RGB,.62352941,.63529412,.65490196),([2.8895, -2.11\
05, -4.], [4.3895, -.6105, -4.])=COLOR(RGB,.22745098,.40392157,.78039216),([1.0\
1, -.99, -1.], [4.02571428571429, 2.02571428571429, -1.])=COLOR(RGB,.53725490,.\
57647059,.65490196),([-3.63, -.63, 4.], [-1.13875, 1.86125, 4.])=COLOR(RGB,.537\
25490,.20392157,.18823529)])

Is it possible to do this in code?

Maple 2025.2

I want to convert the Chebyshev T(n,x) and U(n-1,x) polnomials into their inverse trigonometric definitions. Is there a simple conversion process available in Maple?  There is a command "invtrig" which I have tried with the "convert" command , but this does not seem to work.

Hi,
I’d appreciate your insights on how to animate this sequence (family) of functions in order to obtain a rendering like the one shown below.


Any suggestions or best practices would be very welcome. Thank you!

AnimQ.mw

Suppose I am plotting a 2D plot and want to highlight the point where two lines intersect. I would like to display this intersection point inside the plot in black font, mark it with an arrow or some visual highlight, and clearly label it. How can I do this?

Additionally, instead of using different colours (blue, green, red) for the lines, I want to distinguish them using different line styles such as solid, dotted, and long-dashed lines. How can I make these changes?

restart

with(Optimization); with(plots); with(Student[VectorCalculus]); with(LinearAlgebra)

 

_local(Pi)

Pi

(1)
 

M_w := b*(((Cr*alpha*((-g*i2+a)*Cr+2*Crm+2*c-2*Pr)*b+((g*i2-a)*Cr-2*Crm-2*c+2*Pr)*alpha-(-g*i2+a)*Cr)*d+alpha*((-g*i2+a)*Cr+2*Crm+2*c-2*Pr)*b+2*g*i2-2*a)*rho0+(2*((Cr*b-1)*d+b))*(delta+Cn-Pr-1))^2*d/(8*(Cr*b*d+b-d)^2*(((Cr*alpha*b-alpha+1)*d+alpha*b)*rho0^2-2*b*d*(delta-1)))

(1/8)*b*(((Cr*alpha*((-g*i2+a)*Cr+2*Crm+2*c-2*Pr)*b+((g*i2-a)*Cr-2*Crm-2*c+2*Pr)*alpha-(-g*i2+a)*Cr)*d+alpha*((-g*i2+a)*Cr+2*Crm+2*c-2*Pr)*b+2*g*i2-2*a)*rho0+(2*(Cr*b-1)*d+2*b)*(delta+Cn-Pr-1))^2*d/((Cr*b*d+b-d)^2*(((Cr*alpha*b-alpha+1)*d+alpha*b)*rho0^2-2*b*d*(delta-1)))

(2)
 

 

M_D := (Cr*rho0*t*(Cr*alpha*b-alpha-1)*d^2+((alpha*((-g*i2+a)*Cr+2*Crm+2*c+3*t-2*Pr)*Cr*b+((g*i2-a)*Cr-2*Crm-2*c-2*t+2*Pr)*alpha+(g*i2-a)*Cr-2*t)*rho0+(2*(Cr*b-1))*(sigma*t+Cn-Pr+delta-1))*d+(alpha*((-g*i2+a)*Cr+2*Crm+2*c+2*t-2*Pr)*b+2*g*i2-2*a)*rho0+2*b*(sigma*t+Cn-Pr+delta-1))^2*d*b/((8*(((Cr*alpha*b-alpha+1)*rho0^2-2*b*(delta-1))*d+rho0^2*b*alpha))*((Cr*b-1)*d+b)^2)

(Cr*rho0*t*(Cr*alpha*b-alpha-1)*d^2+((alpha*((-g*i2+a)*Cr+2*Crm+2*c+3*t-2*Pr)*Cr*b+((g*i2-a)*Cr-2*Crm-2*c-2*t+2*Pr)*alpha+(g*i2-a)*Cr-2*t)*rho0+(2*Cr*b-2)*(sigma*t+Cn-Pr+delta-1))*d+(alpha*((-g*i2+a)*Cr+2*Crm+2*c+2*t-2*Pr)*b+2*g*i2-2*a)*rho0+2*b*(sigma*t+Cn-Pr+delta-1))^2*d*b/((8*((Cr*alpha*b-alpha+1)*rho0^2-2*b*(delta-1))*d+8*rho0^2*b*alpha)*((Cr*b-1)*d+b)^2)

(3)

M_S := ((t*Cr*(Cr*alpha*b-alpha-1)*d^2+(Cr*((-g*i2+a)*Cr-2*Pr+2*Crm+2*c-2*s+3*t)*alpha*b+((g*i2-a)*Cr+2*Pr-2*Crm-2*c+2*s-2*t)*alpha+(g*i2-a)*Cr-2*t)*d+((-g*i2+a)*Cr-2*Pr+2*Crm+2*c-2*s+2*t)*alpha*b+2*g*i2-2*a)*rho0-(2*(-sigma*t-Cn+Pr-delta+1))*((Cr*b-1)*d+b))^2*b*d/((8*(((Cr*alpha*b-alpha+1)*d+alpha*b)*rho0^2-2*b*d*(delta-1)))*(Cr*b*d+b-d)^2)

((t*Cr*(Cr*alpha*b-alpha-1)*d^2+(Cr*((-g*i2+a)*Cr+2*Crm+2*c-2*Pr-2*s+3*t)*alpha*b+((g*i2-a)*Cr-2*Crm-2*c+2*Pr+2*s-2*t)*alpha+(g*i2-a)*Cr-2*t)*d+((-g*i2+a)*Cr+2*Crm+2*c-2*Pr-2*s+2*t)*alpha*b+2*g*i2-2*a)*rho0-(-2*sigma*t-2*Cn+2*Pr-2*delta+2)*((Cr*b-1)*d+b))^2*b*d/((8*((Cr*alpha*b-alpha+1)*d+alpha*b)*rho0^2-16*b*d*(delta-1))*(Cr*b*d+b-d)^2)

(4)
 

``

DATA1 := [delta = .9, a = 0.1e-1, g = .25, c = 0.5e-1, rho0 = .4, Cn = .4, Crm = .1, i2 = 0.6e-1, t = 0.1e-1, alpha = .95, s = 0.1e-1, Pr = .35, upsilon = .95, b = .5, d = .3, Cr = 0.1e-1]

[delta = .9, a = 0.1e-1, g = .25, c = 0.5e-1, rho0 = .4, Cn = .4, Crm = .1, i2 = 0.6e-1, t = 0.1e-1, alpha = .95, s = 0.1e-1, Pr = .35, upsilon = .95, b = .5, d = .3, Cr = 0.1e-1]

(5)

P11 := subs(DATA1, M_w); P21 := subs(DATA1, M_D); P31 := subs(DATA1, M_S)

0.9301486586e-2

 

4.251178959*(-0.4764573140e-1+0.4030e-2*sigma)^2

 

4.251178959*(-0.4917713136e-1+0.4030e-2*sigma)^2

(6)

``

A1 := plot([P11, P21, P31], sigma = 0 .. .7, color = ["Red", "Blue", "Green"], labels = [sigma, `&pi;__m`], labeldirections = ["horizontal", "vertical"], legend = [`#msubsup(mi("&pi;"),mi("n"),mn("W"));`, `#msubsup(mi("&pi;"),mi("n"),mn("D"));`, `#msubsup(mi("&pi;"),mi("n"),mn("DS"));`], axis[2] = [color = "#600000"])

 
 

display(A1, pointplot([[X, Y]], symbol = circle, symbolsize = 25, color = blue))

Error, (in plots:-pointplot) points cannot be converted to floating-point values

 
 

NULL

Download Manf_profit__t_graph_changes_needed.mw

Hi !

When I use the "expand" command on a summation, I've noticed that sometimes the command works and

sometimes it doesn't. I looked through the previous commands to see which one might be causing this problem.

I found that if I use the "changevar" command  from the "student" package,  (deprecated package,I know )

the "expand" command works correctly.     Strange behavior, isn't it ?       I have Maple 2018 on Windows 10.

Regards  !

There is a small  example in the file.

expand-problem.mw

I am facing three issues while plotting my plot.I need help modifying the syntax:

  1. I am unable to correctly display superscripts and subscripts for Pi[m]^WD < Pi[m]^D inside the graph region

  2. I cannot format the subscript for i__2 on the x-axis.

  3. A horizontal dotted line appears parallel to the x-axis at y=0.5; how can I remove this line?

    Question_1_regional.mw

Hello all,

This will be my LAST (I swear) question about translating a little function from Mathematica to Maple.

rand := RandomReal[{-5, 5}, 20]

ListPlot[rand]

 

ListListLinePlot[rand]

In[16]:= line = Fit[rand, {1, x}, x]

Out[16]= 0.247498 - 0.0131912 x

In[17]:= parabol = Fit[rand, {1, x, x^2}, x]

Out[17]= -1.82858 + 0.31249 x - 0.0082569 x^2

In[18]:= cos = Fit[rand, {1, x, Cos[x]}, x]

Out[18]= 0.483172 - 0.0302095 x - 0.271457 Cos[x]

Plot[{ListLinePlot[rand], line, parabol, cos}, {x, 0, 20}]

#graph omitted by request of users here.

So, then, my LAST question will be :

How to translate this to Maple ?

Thank you very much.

JM

Hello again,

I think I have not been clear enough in my question.

I reformulate :

Is it possible in Maple to create matrices whose elements are also matrices

and this to any level ?

For the Dimensions of a matrix it's ok for me.

thank you 

JM

1 2 3 4 5 6 7 Last Page 2 of 2240