MaplePrimes Questions

Noticed something strange.  When I type

restart;
F:=x-> (x^4+3*x^3-3*x^2-2*x-24)/(x^4-4*x^3-13*x^2+62*x-56);
u:=x->piecewise(x=-4,limit(F(x),x=-4),true,F(x));
u(-4);

Gives Error, (in F) numeric exception: division by zero which means it did not hit the first condition x=-4

But when I write this

restart;
F:=x-> (x^4+3*x^3-3*x^2-2*x-24)/(x^4-4*x^3-13*x^2+62*x-56);
A:=limit(F(x),x=-4);
u:=x->piecewise(x=-4,A,true,F(x));
u(-4)

Now it gives expected result 15/47

To avoid defining many variables, like A above, I'd like to just write the  limit inside.

Is there a way to make Maple accept the limit inside piecewise as written above? i.e. have it evaluate to 15/47?

Help says "The piecewise function evaluates its arguments on an as-needed basis."

Not sure what this means.

I tried adding eval, as in 

u:=x->piecewise(x=-4,eval(limit(F(x),x=-4)),true,F(x));

But this did nothing

Maple 2025.2

 

Should not the following two commands produce same solution?

f:=x->(x^2+3*x-4)*cos(x^2+3*x-5);
PDEtools:-Solve({f(x)=0,0<x,x<2},x);
solve({f(x)=0,0<x,x<2},x);

This is what the result looks like

Why Solve gives one solution and solve gives 2? Is this expected or a bug?

btw, the solution from solve is also not complete. There are 5 roots not 2.

Student:-Calculus1:-Roots(f(x),x=0..2);

 

Just for my understanding:

I have read ?procedure and noticed that the term variable is used as a synonym for the term name.

Otherwise Maple uses the term variable more in a mathematical sense and the term name to refer to an expression.

Is this to make the help page easier to read or to use jargon familiar from other programming languages?

This use of vocabulary must be intentional. However I do not fully understand this subtle difference.

I would like to express the decision variables Pn_W,w_W,Ce_W,i1_W,Pn_D,w_D,Ce_D...other variables...​ in a compact form. Since their analytical expressions are lengthy, I want to identify terms and define appropriate composite parameters to simplify their representation.

Q_shorten_1.mw

For example ,  Suppose the original expression is: q := ((Cn - a)^2 + (P - d - b)*x^2 + Cn - a - b)/y(Cn - a)^2

Lets say Cn - a =X , P - d - b =S

Then the expression can be rewritten as: q = (X^2 + S*x^2 + X - b)/yX^2

Hello everyone
Dear experienced and expert friends
As a beginner, I would like to ask if any of my friends can guide me.
The following commands are related to Mathematica:

plots = Table[n = sValues[[i]];
   ParametricPlot[{1 - 2/n - 1.5/n^2 + (1.33 - 2/n) \[Gamma] - 
      0.0740741 (15 + 4*n) \[Gamma]^2, 
     12/n^2 + (16 \[Gamma])/n + (80 \[Gamma]^2)/9}, {\[Gamma], 0, 
     0.06}, PlotStyle -> colors[[i]], 
    PlotRange -> {{-10, 10}, {-10, 10}}], {i, Length[sValues]}];

Show[plots, Frame -> True, FrameLabel -> {"\!\(\*
StyleBox[SubscriptBox[\"n\", \"s\"],\nFontSize->16,\n\
FontColor->GrayLevel[0]]\)", "\!\(\*
StyleBox[\"r\",\nFontSize->16,\nFontColor->GrayLevel[0]]\)"}, 
 GridLinesStyle -> Black, PlotRange -> {{0.94, 1}, {0, 0.06}}, 
 PlotLegends -> 
  Placed[LineLegend[sValues, LegendLabel -> "s,w"], {0.5, 0.5}], 
 ImageSize -> 400]

I want to rewrite this process in Maple for my own functions.
I would be grateful if it is possible or if these commands are rewritten in a complete and executable form in Maple for me so that I can understand the working pattern. Or at least an equivalent command that can do this in Maple is introduced
Thank you all

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-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 > (((alpha*Cr*((-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)*rho0+(2*(Cr*b-1))*(delta+Cn-Pr-1))*d+(alpha*((-g*i2+a)*Cr+2*Crm+2*c-2*Pr)*b+2*g*i2-2*a)*rho0+2*b*(delta+Cn-Pr-1))^2)

(((alpha*Cr*((-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)*rho0+2*(Cr*b-1)*(delta+Cn-Pr-1))*d+(alpha*((-g*i2+a)*Cr+2*Crm+2*c-2*Pr)*b+2*g*i2-2*a)*rho0+2*b*(delta+Cn-Pr-1))^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-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

(1)

  

``extra := indets(ineq,And(name,Not(constant))) >~ 0;

{0 < Cn, 0 < Cr, 0 < Crm, 0 < Pr, 0 < a, 0 < alpha, 0 < b, 0 < c, 0 < d, 0 < delta, 0 < g, 0 < i2, 0 < rho0, 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

Why when going to user pages and clicking to see the next page, Mapleprimes gives

https://mapleprimes.com/users/?page=2

This happens for each page after the first one which shows OK.

Do others see this also?

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

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