MaplePrimes Questions

how dsolve differential equations?

Hi all,

I have a system of 18 polynomial equations (and 18 variables).

The polynomials are of second degree (meaning, every polynomial has at most multiplications of two different variables or a single variable squared).

My goal is to be able to solve the polynomials by getting ALL the possible solutions.

For now, when I use the solve command, Maple is trying to solve and never returns the solutions to the equations (I stopped after 3 hours).

But when I use fsolve, Maple returns a single solution (immediately) which is sometimes the solution I expected to get but not always.

If I don't get the solution I expected to get, I call fsolve again but this time with the 'avoid' option in order not to get the same solution again. that way if I use 'fsolve' about 3 times I get the solution I expected to get in most cases. but still not always.

My question, since the equations are polynomials, is there a way to tell Maple to solve the equations in a more efficient way so that I will get ALL the possible solutions? (when I use the 'solve' command I don't tell Maple in any way that the equations are polynomials). or any other way to get all the solutions (I'm new with Maple so maybe there are other commands that I don't know about and can give me all the solutions).

btw, I need only the real solutions. I don't need the complex solutions if exist.


I wrote bellow an example of the code in Maple with the equations that I'm trying to solve (note that I use fsolve twice but only in the second time I get the solutions I expected to get).

The 'h' function in the code looks extermely long but I don't try to solve 'h' in the fsolve command. only the g1* and diff_r1* and diff_t1* functions (which are much shorter than 'h').

I will appreciate any help.


Here is the code:

sols:=fsolve({g1_1_1,g1_1_2,g1_1_3,g1_2_2,g1_2_3,g1_3_3,diff_t11,diff_t12,diff_t13,diff_r1__1_1,diff_r1__1_2,diff_r1__1_3,diff_r1__2_1,diff_r1__2_2,diff_r1__2_3,diff_r1__3_1,diff_r1__3_2,diff_r1__3_3},{ t11, t12, t13, r1__1_1, r1__1_2, r1__1_3, r1__2_1, r1__2_2, r1__2_3, r1__3_1, r1__3_2, r1__3_3, b1__1_1, b1__1_2, b1__1_3, b1__2_2, b1__2_3, b1__3_3} );
sols:=fsolve({g1_1_1,g1_1_2,g1_1_3,g1_2_2,g1_2_3,g1_3_3,diff_t11,diff_t12,diff_t13,diff_r1__1_1,diff_r1__1_2,diff_r1__1_3,diff_r1__2_1,diff_r1__2_2,diff_r1__2_3,diff_r1__3_1,diff_r1__3_2,diff_r1__3_3},{ t11=0.184015, t12=0.087459, t13=0.308915, r1__1_1=0.230878, r1__1_2=0.909187, r1__1_3=0.936884, r1__2_1=0.031879, r1__2_2=0.593647, r1__2_3=0.043818, r1__3_1=0.424903, r1__3_2=0.521581, r1__3_3=0.840339, b1__1_1=0.625030, b1__1_2=0.255205, b1__1_3=0.904691, b1__2_2=0.767301, b1__2_3=0.562666, b1__3_3=0.897154}, avoid={{b1__1_1 = -32.51343311, b1__1_2 = 43.92451284, b1__1_3 = 22.91611840, b1__2_2 = -6.848329887, b1__2_3 = 16.30411571, b1__3_3 = -13.09739229, r1__1_1 = .5873876993, r1__1_2 = -.8092603402, r1__1_3 = -.8566942425e-2, r1__2_1 = .2869971672e-1, r1__2_2 = .1024997381e-1, r1__2_3 = .9995355243, r1__3_1 = -.8087966474, r1__3_2 = -.5873607408, r1__3_3 = .2924625105e-1, t11 = 36.59195193, t12 = -22.18329766, t13 = 22.31332161}} );

I am beginning to study Special Relativity and Classical Field Theory - The Theoretical Minimum by Leonard Susskind and Art Friedman.

The book's notation for a 4-Vector is X superscript mu. Its components are X superscripts 0, 1, 2 and 3 which, in sequence, refer to t(ime), x, y and z.

Proper time, tau, is defined using these vector components in that sequence.

The book's notation for 4-Velocity is U superscript mu with components U superscripts 0 thru 3. U superscript zero is defined to be the derivative of X superscript zero with respect to tau i.e. dt/dtau and the remaining U components follow this pattern.

As a beginner in this area, which Maple packages/commands would most easily and clearly implement this notation in a Maple worksheet? 

Consider the following anticommutators:


Being basic Clifford algebra, I wonder why Physics does not know that the second one should simplify to zero.

PS: Just to be sure, I have updated to Maple 2017.3 today.


eq1 := a[n+2]+4*a[n+1]+10*a[n]-5*n-1;

applyrule(a[n::anything] = n*p+q+b[n], eq1);

eq2 := a(n+2)+4*a(n+1)+10*a(n)-5*n-1;

applyrule(a(n::anything) = b(n)+n*p+q, eq2);

eq3 := a(n+2)+4*a(n+1)+10*a(n) = 5*n+1;

applyrule(a(n::anything) = b(n)+n*p+q, eq3)


So my question is: Why does the first one not work? the second one works as expected, but the third one again does not?!

CodeGeneration returns round brackets when converting a matrix to numpy. According to Python syntax it should return square brackets. I am using Maple 18, so maybe this issue has been solved in more recent releases.


local Q:
Q:= Matrix(2,2):
Q(1,1) := 1E5:
Q(2,2) := 1E4:
Q(1,2) := 1E3:
Q(2,1) := 1E3:
return Q:
end proc:


import numpy

def QLoc ():
    Q = numpy.mat([[0,0],[0,0]])
    Q(1, 1) = 0.1e6
    Q(2, 2) = 0.1e5
    Q(1, 2) = 0.1e4
    Q(2, 1) = 0.1e4


Hey all Maple experts, Kris here!

I could really use some help/clarfication on what is going on with alias, diff, and pointers for vectors.

A short description of what I want to do:
I have 4 equations with 4 variables. The first two equations and variables (1 and 2) are called private, and the last two (3 and 4) are called common. I want to establish an implicit dependence of common on private, namely that the private variables 1 and 2 depend on 3 and 4. Then I want to derivate the private equations with respect to the common variables.

Thus, I create pointers that point to the correct private or common equation or variables with the loop.
for i from 1 to 2 do

So that for example, a set of four equations named "phi" phi[1..4] where phi[iP[1]] is the first private equation, and phi[iC[1]] is the first common equation. Hopefully so far I have been clear. I create an alias, and continue to derivate these equations. However, I notice that Maple does not recognize the functions in the diff command if the "pointer" notation is used. I will paste the entire code for you all to look at and maybe you can see where things get "weird". Namely if I write phi[1], is not the same as phi[iP[1]], even though iP[1]:=1 (Both are integers). 

p.s. I have used implicitdiff. It is way too slow and memory inefficient for many equations (hundreds to thousands). So that is why I am trying to find a work-around.


for i from 1 to 2 do


# Define all (PRIVATE + COMMON) phi expressions.
# 1 and 2 are the PRIVATE equations.
# 3 and 4 are the COMMON equations.
phix[1]:= x[3]**2+x[4]**2:
phix[2]:= x[1]   +x[4]:
phix[3]:= x[1]   +x[3]+x[1]:
phix[4]:= x[1]   +x[3]+x[1]:

for i from 1 to 2   do









The result is 
                     -x[3]^2  - x[4]^2  + x[1]
                      x[1] - x[3]^2  - x[4]^2 
                              1, 3
                  -x[3]^2 - x[4]^2  + x[1], x[3]
                      dPdC[1, 3] - 2 x[3]
                            -2 x[3]
                            -2 x[3]
                            -2 x[3]
Where dPdC includes the implicit derivatives, which is the answer I want, but then I am forced to write by hand what the elements are. If I put the expression in a loop with the pointers, then I get the other "TEST" answers, and as you can see, the implicit dependence from alias has been ignored.

 how can i define constants alpha and beta are positive in maple? ;these constants are coefficints of PDE (higgs field equation)

I just had maple downloaded and the command prompt and classic worksheet seem to work but when I try to use the desktop app maplew.exe the initial loading image comes up but then nothing happens. I don't know how to fix this :/ thanks.

Hello, I am looking to understand in more depth how the function isprime(n) works. After reading Section 6.2.4 'Other Primality Tests' of Padro's Introduction to Cryptography with maple, I understand that it performs some prior trial divisions before a Miller-Rabin test (of which it calls GMP) and then a Lucas test.

 I have also seen the post on these forums: 

to see the result of showstat(isprime), which verifies my summary as above. I am curious as to what exact function is being called upon from gmp by gmp_isprime(n). Since there is no obvious analog function found in GMP, and the popular mpz_probab_prime_p() takes a second argument, which is not given here. I found the documentation gives a download of the GMP code used here:

I pose two questions, the first:

  1. Since I do not own Maple 2017, is the result of showstat(isprime) the same as that given above in Maple18? COuld someone be so kind as to post a raw output of this below?
  2. What function for primality test is being called upon in GMP, I am very familiar with GMP and the only test that can be called without a value of 'reps' (or rounds of MR) is found in demos/isprime.c in the GMP download maple gives, which uses mpz_probab_prime_p(n,25), i.e 25 rounds of Miller Rabin, but seems unlikely to just be used, as it is a demo.



hello everyone!!

I need to plot the function x^3-x^2-x-1, and in the plot I need to calculate de point X that make the function equals to cero (the cutting point with the x axis).

Thanks you!!

Hello dear!

Hope everyone is fine. I want to solve the system of algebraic equations. The answer of c[i]'s should be in term of q. Please see the attachment and fix the problem for any value of M. I am waiting your positive response. Thanks in advance.

I am trying to model a parallel manipulator but I am receiving an error message

State variable'diff(diff(`Main.R41.theta`(t),t),t)' does not appear in dynamic or constraint equations.

I tried changing the Revolute joint 41 but the same error is repeated. 

You can find my model here: ParalelManipulator_v2.msim

Can you help me solve this issue? Thank you in advance!

Dear All,

I wanted to check the calcultations carried out in a Journal Article I was reading as I was not very convinced.

The objective is to find q1i, q2i, q3i in terms of px, py, and pz and constant parameters φ, a, b, h, and r.

I have realised that the results given by the article do not match with the solution to the dsolve command.

Could you please spot where the mistake is?

My Solution:

help me on


M := 1; S := .78; K := .5; Sh := .2; alpha := .7; R := .3; N := .6; k := .5

pde1 := diff(u(y, t), t)+S.(diff(u(y, t), y))-2*k^2*u(y, t) = diff(u(y, t), y, y)+theta(y, t)+N.C(y, t)+M.u(y, t)+u(y, t)/K

                pde2 := theta(y, t)+t*(diff(theta(y, t), t))+S*(diff(theta(y, t), y)) = (diff(theta(y, t), y, y))/Pr-alpha.theta(y, t)

pde3 := C(y, t)+t*(diff(C(y, t), t))+S*(diff(C(y, t), y)) = (diff(C(y, t), y, y))/Sh-R.C(y, t)

PDE := unapply({pde || (1 .. 3)}, Pr)

proc (Pr) options operator, arrow; {C(y, t)+t*(diff(C(y, t), t))+.78*(diff(C(y, t), y)) = 5.000000000*(diff(diff(C(y, t), y), y))-.3*C(y, t), diff(u(y, t), t)+.78*(diff(u(y, t), y))-.50*u(y, t) = diff(diff(u(y, t), y), y)+theta(y, t)+.6*C(y, t)+3.000000000*u(y, t), theta(y, t)+t*(diff(theta(y, t), t))+.78*(diff(theta(y, t), y)) = (diff(diff(theta(y, t), y), y))/Pr-.7*theta(y, t)} end proc


IBC := {C(0, t) = 1, C(1, t) = 0, C(y, 0) = 0, theta(0, t) = 1, theta(1, t) = 0, theta(y, 0) = 0, u(0, t) = 0, u(1, t) = 0, u(y, 0) = 0}


PrList := [.71, 7, 10, 100]; Colours := table(`~`[`=`](PrList, ["blue", "red", "green", "cyan"])); for Pr in PrList do pds := pdsolve(PDE(Pr), IBC, numeric); Plots[Pr] := pds:-plot[display](u(y, t), t = .5, linestyle = "solid", colour = Colours[Pr], legend = sprintf("Pr=%2.2f", Pr), title = "Velocity Profile", labels = ["y", "theta"]) end do; plots:-display([seq(Plots[Pr], `in`(Pr, PrList))])






3 4 5 6 7 8 9 Last Page 5 of 1526