MaplePrimes Questions

I was trying to solve a system of polynomial equations, which contains three equations and six variables $a_0,a_1,a_2,b_0,b_1,b_2$. However, as I swap the variable name, Maple solve function gives me a totally different solutions. Only the solutions before swapping the variables are useful for the problem I study. I have already attached the file. Could anyone tell me if the choice of variable name really matters, or if i just misuse this function?

Choice_of_name_infolevel.mw

Hello, everyone,

I am new to Maple and I am trying to get use of it.

I tried to plot the following linear systems in different ways. I realized that the Student Linear Algebra is not as flexible as Linear Algebra. My question is the following. Is there any other way to create a plot without defining the implicit plots?

with(Student[LinearAlgebra])

A := Matrix([[1, 1], [12, 16]]); b := Vector([10, 136]); sol := LinearSolve(A, b)

Matrix(2, 2, {(1, 1) = 1, (1, 2) = 1, (2, 1) = 12, (2, 2) = 16})

 

Vector(2, {(1) = 10, (2) = 136})

 

Vector[column](%id = 36893488153382714652)

(1)

LinearSystemPlot({x+y = 10, 12*x+16*y = 136}, axes = normal)

 

restart

 

 

with(Student[LinearAlgebra])

A := Matrix([[2, -1, 1], [0, 1, 3], [0, 0, 1]]); b := Vector([-5, 7, 2]); sol := LinearSolve(A, b)

Matrix(3, 3, {(1, 1) = 2, (1, 2) = -1, (1, 3) = 1, (2, 1) = 0, (2, 2) = 1, (2, 3) = 3, (3, 1) = 0, (3, 2) = 0, (3, 3) = 1})

 

Vector(3, {(1) = -5, (2) = 7, (3) = 2})

 

LinearSolve(Matrix(%id = 36893488151878044716), Vector[column](%id = 36893488151878030628))

(2)

LinearSystemPlot({w = 2, y+3*w = 7, 2*x-y+w = -5}, axes = normal)

 

restart

with(plots); with(LinearAlgebra); A := Matrix([[1, 1], [12, 16]]); b := Vector([10, 136]); sol := LinearSolve(A, b); eq1 := x+y = 10; eq2 := 12*x+16*y = 136; plot1 := implicitplot(eq1, x = -5 .. 10, y = -50 .. 50, color = "red", thickness = 2, labels = ["x", "y"]); plot2 := implicitplot(eq2, x = -5 .. 10, y = -50 .. 50, color = "blue", thickness = 2); display(plot1, plot2, title = "Plot of Linear System", legend = [x+y = 10, 12*x+16*y = 136])

Matrix(2, 2, {(1, 1) = 1, (1, 2) = 1, (2, 1) = 12, (2, 2) = 16})

 

Vector(2, {(1) = 10, (2) = 136})

 

Vector[column](%id = 36893488153330030820)

 

x+y = 10

 

12*x+16*y = 136

 

 

A := Matrix([[2, -1, 1], [0, 1, 3], [0, 0, 1]]); b := Vector([-5, 7, 2]); solution := LinearSolve(A, b); eq1 := 2*x-y+z = -5; eq2 := y+3*z = 7; eq3 := z = 2; plot1 := implicitplot3d(eq1, x = -10 .. 10, y = -10 .. 10, z = -10 .. 10, color = "red", style = surface); plot2 := implicitplot3d(eq2, x = -10 .. 10, y = -10 .. 10, z = -10 .. 10, color = "blue", style = surface); plot3 := implicitplot3d(eq3, x = -10 .. 10, y = -10 .. 10, z = -10 .. 10, color = "green", style = surface); display(plot1, plot2, plot3, title = "3D Plot of Linear System", axes = boxed)

Matrix(3, 3, {(1, 1) = 2, (1, 2) = -1, (1, 3) = 1, (2, 1) = 0, (2, 2) = 1, (2, 3) = 3, (3, 1) = 0, (3, 2) = 0, (3, 3) = 1})

 

Vector(3, {(1) = -5, (2) = 7, (3) = 2})

 

Vector[column](%id = 36893488152610632156)

 

 

NULL


 

Download linear_systems.mw

 

How can I get the roots of this equation: besselJ,  J0(xn)=0?

Multiplication is possible by a numerical constant

a < b;
-1*%;
                             a < b

                            -b < -a

However, using a name with assumptions

with(RealDomain):# just to make sure that a and b are real, probably not required
ineq := a/c < b/c;
assume(c < 0);
c*ineq;
expand(%);
eval(%);
                                 a   b
                         ineq := - < -
                                 c   c

                           /a   b   \
                          *|- < -, c|
                           \c   c   /

                           /a   b   \
                          *|- < -, c|
                           \c   c   /

                           /a   b   \
                          *|- < -, c|
                           \c   c   /

does not work. Have I missed an essential assumption/trick?

What else can I do?

Or: is there a mathematical reasons not to offer this possibilty.

Context: For manual case studies of parameters in inequalties I find it sometimes helpfull to remove rational expressions. Doing this manually with lhs/rhs and denom and flipping < or > is prone to errors

How can numbers be displayed inside the contour plot?

 restart;
with(plots);
contourplot(x*exp(-x^2 - y^2), x = -2 .. 2, y = -2 .. 2, axes = boxed);
like this

Dear All,

I solved the following partial differential equation numerically using pdsolve. As mentioned in the help pages, plotting the solution versus x at a given time is possible. 
Can anyone help me extract the plot of the solution versus time at a given space variable x? Also, how can I extract the data of the mentioned plot, for example, u_numeric (0.75, 0.5)?
pd_numeric:=(D[2,2])(u_numeric)(x,t)+(D[1,1,1,1])(u_numeric)(x,t)-0*h(x,t)=0;
bc_numeric[1]:=u_numeric(0,t)=0;
bc_numeric[2]:=(u_numeric)(1,t)=0; 
bc_numeric[3]:=D[1,1](u_numeric)(0,t)=0;
bc_numeric[4]:=D[1](u_numeric)(1,t)=0; 
ic_numeric[1]:=u_numeric(x,0)=0.1*x*(x-1)^2;
ic_numeric[2]:=D[2](u_numeric)(x,0)=0;

sol:=pdsolve(pd_numeric, {seq(bc_numeric[i], i=1..4), seq(ic_numeric[i],i=1..2)}, u_numeric(x,t), time=t, range=0..1, numeric, spacestep=1/2000, timestep=1/2000);
sol:-plot(t=1);
sol:-animate(t=1, frames=2000, title="time=%f");
Best wishes

I'm working on simulating a triple pendulum. I have the numeric solution of the ODEs and some nice plots that indicate I'm on the right track. I would to animate these solutions. 
It seems like there is a way to plot the positions over time, as well as the lines between the points. If anyone can put me on the right track towards this, I would really appreciate it. 

OEIS A034828 and OEIS A000292 (which give the Wiener index for the cycle graph and the path graph respectively) mention that 

the Wiener index of the cycle of length 19 is 855 and 
the Wiener index of the path with 19 edges is 1330

However, 

GraphTheory:-WienerIndex(GraphTheory:-CycleGraph(19));
 = 
                               38

GraphTheory:-WienerIndex(GraphTheory:-PathGraph(20));
 = 
                               38

So what happened here? 

I fail to understand from the manual how to do total differentiation.

e.g let's say I have a trivial transform defined as

u=t(x,y)-s(x,y);

then I should get

du=diff(t,x)dx+diff(t,y)dy ...etc

Apparently the operator D_Dx should be able to perform the total derivative, but somehow I cant see this is possible.

What do I miss ?

I was attempting to remove part of string using StringTools:-Remove()

But it causes server.exe crash each time.

Any idea why this happens?

Worksheet below

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 1735. The version installed in this computer is 1732 created 2024, April 17, 19:33 hours Pacific Time, found in the directory C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib\`

restart;

3048

ode:=x*y(x)*diff(y(x), x) = (x + 1)*(y(x) + 1):
ode:=diff(y(x), x$2) = (y(x) + 1):
the_output:=Student:-ODEs:-ODESteps(ode,y(x)):
 

s:=latex(the_output,'output'=string):

StringTools:-Remove(s,"\\begin{array}{ccc}");


Download crash_during_string_tools_remove_maple_2024.mw

ps. reported to Maplesoft also.

Maple dsolve fails to find many singular solutions using the option 'singsol'=all.

Any idea why that is? Here is one example

ode:=diff(y(x),x)=(y(x)-3)^2;
dsolve(ode,y(x),'singsol'=all)

It returns 

But we see that y=3 is singular solution which can't be obtained from the above solution for any value of c1

Mathematica finds this singular solution

ode=y'[x]==(y[x]-3)^2
DSolve[ode,y[x],x,IncludeSingularSolutions->True]

Here is second example.

restart;
ode:=diff(y(x),x)=2*x*sqrt(1-y(x)^2);
dsolve(ode,y(x),'singsol'=all)

Gives

But it misses the y=1,y=-1 singular solutions. 

Is there something I am doing wrong? Why does Maple sometimes fail to find singular solutions?

ps. reported to Mapesoft also.

Update

I remembered now a case similar to this. one has to use `Lie` solver and now Maple gives the singular solution

ode:=diff(y(x),x)=(y(x)-3)^2;
dsolve(ode,Lie,'singsol'=all)

There is no mention of this in help and it is still not clear to me if one has to always use Lie solver to obtain singsol or if this is just a coincidence for this one case.  

Same for the other case:

restart;
ode:=diff(y(x),x)=2*x*sqrt(1-y(x)^2);
dsolve(ode,'Lie','singsol'=all)

gives

I think singsol should work all the time and not only when using specific solver. If Lie solver is needed for singsol to work, then help should be clear and say this.

Consider the following exact algebraic number expr
 

restart;

kernelopts('version'):

Physics:-Version():

expr := Physics:-`*`(2-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2), sqrt(1-(1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2))^2))+Physics:-`*`(Physics:-`*`(3+Physics:-`*`(4, 1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2)), 1/12), sqrt(3-Physics:-`*`(4, (1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2))^2)))+Physics:-`*`(Physics:-`*`(2, Physics:-`*`(2-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2), 1/3)), sqrt(Physics:-`*`(Physics:-`*`(2, 2-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2)), 1-Physics:-`*`(2, 1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2)))))+Physics:-`*`(Physics:-`*`(1+Physics:-`*`(2, 1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2)), 1/6), sqrt(Physics:-`*`(2, (1/4)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2)^2-Physics:-`*`(3, (1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2))^2)))):

CodeTools:-Usage(PolynomialTools:-MinimalPolynomial(expr));

memory used=0.97MiB, alloc change=12.00KiB, cpu time=31.00ms, real time=27.00ms, gc time=0ns

 

27*_X^2+70*_X-433

(1)

evalf[30](eval(27*_X^2+70*_X-433, _X = expr));

0.262508598220109180966e-6

(2)

"evalf((mp:=CodeTools:-Usage(evala(':-Minpoly'(expr,_X)))));"

memory used=70.25GiB, alloc change=48.00MiB, cpu time=23.63m, real time=21.81m, gc time=3.18m

 

-422.3889573*_X+2208.949800*_X^4-225.8139518*_X^3-230.2173498*_X^2+59.33811620+_X^10-19.92850932*_X^9+166.6440365*_X^8-755.9985571*_X^7+1997.484781*_X^6-3014.379082*_X^5

(3)

type(mp, polynom(rational, _X))

false

(4)


 

Download wrong_minpoly.mw 
I would like to find its minimal polynomial (without a priori knowledge). 

According to the documentation, 

if is an exact algebraic number, and and are not given, then PolynomialTools:-MinimalPolynomial(expr) will call  to compute an exact minimal polynomial of . If a name is not specified for the variable , then  will be used.

Regretfully, it is easy to see that the minimal polynomial of expr cannot be the returned 27*_X^2 + 70*_X - 433. And when I invoke  directly, the result is still not correct (and this evaluation takes a rather long time). 
Another help page mentions that 

the call mp := evala(Minpoly(expr, _X)) computes the monic minimal polynomial of  in the variable  over the field of rational numbers (or multivariate rational functions); the resulting polynomial will not contain any algebraic numbers or functions.

However, as type(mp, polynom(rational, _X)) gives , we know that cannot be the desired minimal polynomial of expr either. 
So, what is the proper way to compute the minimal polynomial of expr in Maple? 

Code: 

use alpha=1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345,index=2)-1/2)**2) in 
	expr:=(1+alpha)*sqrt(1-alpha**2)+(3+4*alpha)/12*sqrt(3-4*alpha**2)+2*(1+alpha)/3*sqrt(2*(1+alpha)*(1-2*alpha))+(1+2*alpha)/6*sqrt(2*((1-alpha)**2-3*alpha**2)) 
end:
CodeTools:-Usage(PolynomialTools:-MinimalPolynomial(expr));

Of note, the minimal polynomial of an algebraic number zeta is the unique irreducible monic polynomial of smallest degree p(x) with rational coefficients such that p(zeta)=0 and whose leading coefficient is 1

I have a set of 3 differential equations called "odesys" that I need to solve. I input this line to solve them and I get the following error. 

sols := dsolve([odesys, ICs], {Theta[1](t), Theta[2](t), Theta[3](t)})
Error, (in dsolve) not a system with respect to the unknowns {Theta[1](t), Theta[2](t), Theta[3](t)}
 

I've also tried it using the exact syntax that the thetas are in the equation and I get this error. 

sols := dsolve([odesys, ICs], {Theta(t)[1], Theta(t)[2], Theta(t)[3]});
Error, (in dsolve) required an indication of the solving variables for the given system
 

I don't know even know which error message is better. The equations are second order and non-linear if that has any bearing on anything. 

How to convert a ploting values in a graph to excel?

restart;
with(PDETools): with(DETools): with(plots):with(plottools):
eq1 := ((D@@2)(f))(eta)*f(eta)*sin(alpha)+((D@@2)(f))(eta)*eta*cos(alpha)+2*((D@@3)(f))(eta) = 0;
ics := f(0) = 0, (D(f))(0) = 0, (D(f))(10) = 1; bcs := (D(f))(10) = 0, theta(10) = 0, phi(10) = 0;
Parameters1 := alpha = (1/3)*Pi;
sol1 := dsolve(eval({eq1, ics}, {Parameters1}), numeric);
p1 := odeplot(sol1, [[eta, ((D@@2)(f))(eta)]], eta = 0 .. 10, color = [red], axes = boxed);
display({p1});

First 92 93 94 95 96 97 98 Last Page 94 of 2409