Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Dear Users!

I hope everyone here is fine. In the attached file I have a list of points in three dimensions. I want to plot surfaceplot (also in Dimension=2) of only those points which are less than 1.

But I want to plot the density plot for all points with the range on x-axes 5 to 15 and the range on y-axes 50-1000

Help.mw

I got a plot by following the code in Mpale 2022.
restart;
with(plots);
P2 := plot3d(-t^2 + x, t = 0 .. 20, x = 0 .. 400, labels = ['t', 'x', 'rho'], labelfont = [Times, 15], viewpoint = "circleleft", colorscheme = ["ygradient", ["Green", "Purple", "Blue", "Red", "BlueViolet"]]);
plotsetup(ps, plotoutput = "P2");
print(P2);


Then I tried the following code for the overleaf. However, I did not get the desired result.

\documentclass[11pt]{article}
\usepackage{graphicx}
\usepackage{epsfig}

\begin{document}
Plot obtained from Maple 2022. \\

\includegraphics[width=0.9\textwidth]{P2.eps}
\end{document}

plotting_file.pdf

Any help is highly appreciated.
Thanks
Deb

So linalg had iszero function, but the newer LinearAlgebra does not? I find it in ArrayTools. Have they split the old linear algebra package into two?

Let SABCD be a pyramid, with the line SA perpendicular to the plane ABCABCD is a rectangle, AB = aAB = bSA = hH is projection point of A on the line SC and K is projection point of A on the line SD. How can I find radius of the circumcircle of triangle CHK?

restart;
with(Student:-MultivariateCalculus);
A := [0, 0, 0];
B := [a, 0, 0];
C := [a, b, 0];
DD := [0, b, 0];
S := [0, 0, h];
lineSC := Line(S, C);
lineSD := Line(S, DD);
H := Projection(A, lineSC);
K := Projection(A, lineSD);

Hello,

I'm seeking an efficient solution to a particular problem. To illustrate, I'll provide a simplified example, though in practice, I'm handling lists with millions of elements.

Let's take the list, l: [1, 2, 3, 4, 5, 6, 7, 8]. Each element in this list has a corresponding twin. For instance, 1 has twins [4, 5], and 2 has twins [9, 12] (note that 12 is not in the original list, but that's not problematic). The complete list of twins is represented as t: [[4, 5], [9, 12], [6, 8], [1, 5], [1, 4], [3, 8], [13, 14, 17], [3, 6], [2, 12], [11, 12, 15]], and the twins are made available as they are needed.

The objective is to remove all twins starting from the first element of the list. Once a twin is removed, there's no need to check for twins for that particular element. For example, consider the first element, 1; the twins [4, 5] are removed, and there's no need to find the twins for those elements. The desired outcome would be the list [1, 2, 3, 7,10].

My solution utilizes a combination of a while loop and sets. However, it's painfully slow when dealing with lists larger than a few hundred thousand elements. 

Many thanks.  

Dear Power Users, I am trying to master Maple coming from another software. I encounter a problem in finding a simple way to find the best parameters for a fitting function. Would someone be so kind to help me out? Thank you in advance for your willingness to help.

FindOptimizedParametersFit.mw

Hi,

I am looking to refine my animation. I would like to add a condition on the colors to illustrate the periodicity of the sine function: the first circle in red, and the curve in red from 0 to 2π, then the second circle in blue and the curve in blue from 2π to 4π, etc. Any ideas? Thank you very much in advance.

AnimSinusCouleurs.mw

I am a new Maple user. I have a system of differential equations and I want Maple to solve the system such that if one of the solutions (dependent variable) is larger than a certain value, one of the differential equation will be described in a different way. I will describe it with an example:

restart;
with(plots);
# imagine we have two differential equations:
eqn1 := diff(T(x), x) = x + T(x)/10 + q(x)/2;
eqn2 := diff(q(x), x) = T(x)^2/10 + 3*q(x);
#The solution is given by:
sol := dsolve({eqn1, eqn2, T(0) = 0, q(0) = 0}, {T(x), q(x)}, numeric, method = mebdfi);
odeplot(sol, [x, T(x)], x = 1 .. 3);

#what I want to do is to write a conditional differential equation that depends on the solution T(x) of the system. For exmaple, if the value of T(x) is larger than 4, the solver sould use a different equation to solve the system. Say for example instead of eqn1 it will use something else like: eqn1:=diff(T(x),x)=x+T(x)^2/200+q(x)/300.

#Internally after each iteration, the solver should check the value of the solution T(x), and depending on it it will choose a different differential equation to use in the next step x.

I tried defining the differential equation as piecewise but I was not successful.

Maple gives solutions that do not satisfy the equation. Wondering what do I need to change.  

restart;
n:=3;m:=2;
eqx:=x^(n/m)=a;
maple_sol:=[PDEtools:-Solve(eqx,x)]; #also tried solve()
F:=map(X->eval(eqx,X),maple_sol);
map(X->evalb(X),F);

 

I always verified in Mathematica

Any thought what is going on and what do I need to change in my Maple code to make it give the solution x=a^(2/3) only?  

It is also possible that Mathematica is the one who is skipping the two complex solutions, but then I need to verify these in Maple, and so far I can't. Only the first solution is verified by Maple.

Even simplification with assuming a>0 do not verify these two extra solution given with complex values. I also tried RealDomain package but this also had no effect. I tired assuming real also and tried simplify with symbolic option.

Anything else I should try?

Maple 2024 on windows 10

update

As I said, I tried RealDomain but with PDEtools:-Solve. With solve it works. Is this a bug? worksheet below

35788

restart;

35788

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1701. The version installed in this computer is 1693 created 2024, March 7, 17:27 hours Pacific Time, found in the directory C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib\`

restart;

35788

n:=3;m:=2;
eqx:=x^(n/m)=a;
use RealDomain in (PDEtools:-Solve(eqx,x)) end use;
F:=map(X->eval(eqx,X),[%]);
map(X->evalb(X),F);

3

2

x^(3/2) = a

x = a^(2/3), x = (1/4)*a^(2/3)*(1+I*3^(1/2))^2, x = (1/4)*a^(2/3)*(I*3^(1/2)-1)^2

[a = a, (1/16)*4^(1/2)*(a^(2/3)*(1+I*3^(1/2))^2)^(3/2) = a, (1/16)*4^(1/2)*(a^(2/3)*(I*3^(1/2)-1)^2)^(3/2) = a]

[true, false, false]

restart;

35788

n:=3;m:=2;
eqx:=x^(n/m)=a;
use RealDomain in (solve(eqx,x)) end use;
F:=map(X->eval(eqx,x=X),[%]);
map(X->evalb(X),F);

3

2

x^(3/2) = a

a^(2/3)

[a = a]

[true]

 

 

Download real_domain_solve_vs_PDEtools_Solve.mw

I have used "colour" as my spelling on optional inputs to procedures in my package.  How can I also handle the alternative spelling "color"?  
 

restart

 

coltest:=proc(c)
  if c="b" then return 1
   elif c="r" then return 2
   elif c="g" then return 3
  end if;
end proc:

 

foo:=proc(a,{colour:="b"})
local COL;
   COL:=coltest(colour);
if COL=1 then return a
  elif COL=2 then return a^2
  elif COL=3 then return a^3
  else error `wrong colour`;
end if ;
end proc:

 

foo(3,colour="r")

9

(1)

foo(2,colour="p")

Error, (in foo) wrong colour

 
 

 

Download 2024-03-21_Q_colour_or_color.mw

Details here: non-dimensionalization.mw. Thanks!

In short, I want to plot all the ten roots of a 10th-degree polynomial in _Z with 4 or 5 primitive parameters. To do so, I need to find that combination of parameters that allows me to transform/scale/non-dimensionalize the original polynomial in a polynomial in _Z with just (1) one parameter or at maximum (2) two parameters. In the case of (1), I can plot its roots in a standard 2D plot against the single parameter. In the case of (2), I can plot the roots in a standard 3D plot against the two parameters.

May be someone can come up with a way to simplify this ode solution? I used the option useInt but the solution can be written in much simpler way than Maple gives.  Below is worksheet showing Maple's 2024 solution and my hand solution.

(having trouble uploading worksheet, will try again).


 

144036

ode:=diff(y(x),x)^3=y(x)+x

(diff(y(x), x))^3 = y(x)+x

maple_sol:=dsolve(ode,useInt):
maple_sol:=Vector([maple_sol]);

Vector(3, {(1) = x-Intat(3*_a^2/(_a+1), _a = (y(x)+x)^(1/3))-_C1 = 0, (2) = x-Intat(3*_a^2/(_a+1), _a = -(1/2)*(y(x)+x)^(1/3)-((1/2)*I)*sqrt(3)*(y(x)+x)^(1/3))-_C1 = 0, (3) = x-Intat(3*_a^2/(_a+1), _a = -(1/2)*(y(x)+x)^(1/3)+((1/2)*I)*sqrt(3)*(y(x)+x)^(1/3))-_C1 = 0})

mysol1:= Intat(1/(_a^(1/3) + 1), _a = (y(x) + x))=x+_C1:
mysol2:= Intat(1/( -(-1)^(1/3)*_a^(1/3) + 1), _a = (y(x) + x))=x+_C1:
mysol3:= Intat(1/( (-1)^(2/3)*_a^(1/3) + 1), _a = (y(x) + x))=x+_C1:
mysol:=Vector([mysol1,mysol2,mysol3]);

 

Vector(3, {(1) = Intat(1/(1+_a^(1/3)), _a = y(x)+x) = x+_C1, (2) = Intat(1/(-(-1)^(1/3)*_a^(1/3)+1), _a = y(x)+x) = x+_C1, (3) = Intat(1/((-1)^(2/3)*_a^(1/3)+1), _a = y(x)+x) = x+_C1})

map(X->odetest(X,ode),mysol)

 

Vector(3, {(1) = 0, (2) = 0, (3) = 0})

 


 

Download simpler_solution.mw

I keep losing the edits I do. I post screen shot. Click submit, then find all my changes are lost. Will try one more time and give up:

This is Maple solution

This is implified version

 

Both versions are verified correct by odetest. The question is there is a way to obtain the simpler form from Maple.

 

Hi,

I need your insights on two technical questions regarding my BoxPlot:

1) How to adjust the color of the text (Title and caption)

2) How to remove only the y-axis

Thank you

S5StatBoxPlotBtest.mw

I want to export plots as PNG but found in the past that when using commands to automate the process (and explicitly controlling for image quality) some symbolic notation on the axes or in the plots themselves are translated to 1D.

Anyway, regardless of the reason just provided, I have a preference for exporting plots as PNG manually rather than automatically in some of my scripts. How to do this while ensuring the best quality? By default, manual exports into PNG have quite bad quality. 

I was wondering why Maple do not give this simpler solution to this ode. It solves it as exact. But if solved as separable, the solution is much simpler.

I solved this by hand and Maple verifies my solution. You can see the separable solution is much simpler. Any tricks to make Maple gives the simpler solution?

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

ode:=diff(y(x),x)^4+f(x)*(y(x)-a)^3*(y(x)-b)^3*(y(x)-c)^2 = 0;

(diff(y(x), x))^4+f(x)*(y(x)-a)^3*(y(x)-b)^3*(y(x)-c)^2 = 0

infolevel[dsolve]:=5;
sol:=dsolve(ode);
odetest(sol,ode);

5

Methods for first order ODEs:

-> Solving 1st order ODE of high degree, 1st attempt

trying 1st order WeierstrassP solution for high degree ODE

trying 1st order WeierstrassPPrime solution for high degree ODE

trying 1st order JacobiSN solution for high degree ODE

trying 1st order ODE linearizable_by_differentiation

trying differential order: 1; missing variables

trying simple symmetries for implicit equations

--- Trying classification methods ---

trying homogeneous types:

trying exact

<- exact successful

Intat(1/((_a-c)^(1/2)*(_a-b)^(3/4)*(_a-a)^(3/4)), _a = y(x))+Intat(-(-f(_a)*(-y(x)+c)^2*(-y(x)+b)^3*(-y(x)+a)^3)^(1/4)/((y(x)-c)^(1/2)*(y(x)-b)^(3/4)*(y(x)-a)^(3/4)), _a = x)+c__1 = 0

0

mysol:=Intat(1/( (_a-c)^(2/3)*(_a-b)*(_a-a))^(3/4),_a = y(x))=Intat( (-f(_a))^(1/4),_a=x)+_C1;
odetest(mysol,ode)

Intat(1/((_a-c)^(2/3)*(_a-b)*(_a-a))^(3/4), _a = y(x)) = Intat((-f(_a))^(1/4), _a = x)+c__1

0


 

Download why_not_this_simpler_solution.mw

Hand solution

Maple 2024

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