MaplePrimes Questions

   Is there a way to export routines from a package. The reason I ask, I was answering a question here and I needed two routines I have, that I put together a couple of years ago in a package. I used showstat copied, pasted and edited. Worked, but not great and would utterly fail with anything complicated. e.g. In the two routines pasted  below SignedArea on line 3 c[1]  is c   [1] that caused a minor problem.  



"RonanRoutines:-SignedArea := proc(a::{Vector, list}, b::{Vector, list}, c::{Vector, list, null} := null)  local M, A;     1   if c = null then     2       A := 1/2*a[1]*b[2]-1/2*a[2]*b[1]         else     3       A := 1/2*(b[2]-c[2])*a[1]+1/2*(-b[1]+c[1])*a[2]+1/2*c[2]*b[1]-1/2*c               [1]*b[2]         end if;     4   return A  end proc:"


"RonanRoutines:-CrossingNumber := proc(A::list, B::list, C::list, E::list)  local s1, s2, s3, s4;     1   s1 := RonanRoutines:-SignedArea(A,B,C);     2   s2 := RonanRoutines:-SignedArea(A,B,E);     3   s3 := RonanRoutines:-SignedArea(C,E,B);     4   s4 := RonanRoutines:-SignedArea(C,E,A);     5   if s1 = 0 and s2 = 0 and s3 = 0 and s4 = 0 then     6       'undefined'         elif 0 <= signum(s1) and signum(s2) <= 0 then     7       if 0 <= signum(s3) and signum(s4) <= 0 then     8           -1             end if         elif signum(s1) <= 0 and 0 <= signum(s2) then     9       if signum(s3) <= 0 and 0 <= signum(s4) then    10           1             end if         else    11       0         end if  end proc:  "




Does anyone know how can I write this thing in a Maple script?
I have a problem with printing math expressions when there is an increment in the matrix power.

Please see attached.


with(plots); with(LinearAlgebra)




couples := [5, 0], [6, 0], [6, 3], [10, 3], [7, 5], [9, 5], [7, 7], [8, 7], [5.5, 9], [3, 7], [4, 7], [2, 5], [4, 5], [1, 3], [5, 3]

Points := Matrix([[5, 6, 6, 10, 7, 9, 7, 8, 5.5, 3, 4, 2, 4, 1, 5], [0, 0, 3, 3, 5, 5, 7, 7, 9, 7, 7, 5, 5, 3, 3]])




W := Matrix(2, 2, {(1, 1) = (1/60)*k, (1, 2) = 0, (2, 1) = 0, (2, 2) = (1/60)*k})NULLNULL``NULLNULL

Rotation on x axis



X := Matrix(2, 2, {(1, 1) = cos((1/90)*Pi*k), (1, 2) = sin((1/90)*Pi*k), (2, 1) = sin((1/90)*Pi*k), (2, 2) = -cos((1/90)*Pi*k)})````NULLNULL

Rotation of angle k


Y := Matrix(2, 2, {(1, 1) = cos((1/180)*Pi*k), (1, 2) = -sin((1/180)*Pi*k), (2, 1) = sin((1/180)*Pi*k), (2, 2) = cos((1/180)*Pi*k)})NULLNULLNULL


n := Multiply(Y, Multiply(X, Multiply(W, Points)))



NouvCouples := seq([n[1, i], n[2, i]], i = 1 .. 15)

Sapin := animate(polygonplot, [[NouvCouples], color = "ForestGreen"], k = 0 .. 180)






PointsNeige := seq([-30+i, 30-(1/2)*j*sin(i+j)], i = 0 .. 60); neige := animate(pointplot, [[PointsNeige], color = black], j = 0 .. 60, view = [-30 .. 30, 0 .. 30])



display([Sapin, neige], scaling = constrained)







Hi, i need some help for a homework.

Here is the statement

You must first animate a series of linear transformations on the polygon formed by the following couples: [5, 0], [6., 0], [6, 3], [10, 3], [7, 5], [9, 5], [7, 7], [8, 7], [5.5, 9], [3, 7], [4, 7], [2, 5], [4, 5], [1, 3], [5, 3] It will be necessary to make, at the same time, a rotation around a line making an angle k with the axis of x, a rotation of an angle k and a scaling of variable ratio (but equal to 3 at the end animation). The k animation parameter should range from 0 to 180. I suggest you use the color green for your polygon. Then you will need to create a second animation by entering these command lines: SnowPoints: = seq ([- 30 + i, 30 - j / 2 * sin (i + j)], i = 0 .. 60): snow: = animate (pointplot, [[PointsNeige], color = black], j = 0 .. 60, view = [-30 .. 30, 0 .. 30]) : Finally, you will have to roll both animations at the same time.

The GIF shows the results that I should get according to my teacher

Thanks for the help !

Dear all

I solve a first order nonlinear ode, using dsolve but there is no solution obtained.
How, can I get the exact solution.

tahnk you for your help

In the obselote book programming examples it is using array's as data type

Is het easier to use A Vector or Matrix as datatype?

Can Maple solve an ode by asymptotic expansions methods? series methods (power series or Frobenius series) work only on ordinary expansion point or removable singularity point. For non removable singularity (essential), Maple's dsolve with series method can't solve these. Also, if the RHS of the ode is not analytic at the expansion point, series method do not work. 

The asympt command only applies to algebraic expressions.

Does Maple have something similar to Mathematica's AsymptoticDSolveValue  ?

Here is an example. This is an ode with RHS not analytic (has no Taylor series) at x=0


No solution.  While in Mathematica

ode = y'[x] + y[x] == 1/x
AsymptoticDSolveValue[ode, y[x], {x, 0, 6}]


Here is another example of ode where the coefficient of y(x) is not analytic at x=0


No solution. In Mathematica

ode = y'[x] + Sqrt[x] y[x] == 0
AsymptoticDSolveValue[ode, y[x], {x, 0, 6}]

Does there exist a package in Maple that can do this? Will this functionality be added in Maple in the future if currently there is no support? ( I searched and could not find anything so far).

One possible workaround I found is to solve the ODE using normal methods (non-series), then apply the asympt command on the solution. But one needs to remove the constant of integration first, Here is the above example done this way


Mutliplying the above back by the constant _C1 gives same answer as Mathematica's.

Is the above how one is supposed to do it in Maple? It worked on the above simple example, but need to see if it will work for other examples. it will be better if this was more directly supported. i.e. if asympt will work directly on ode's (or a new command or a new option to dsolve similar to 'series' but call 'asympt').


For factorization and computing times purposes, I'd like Maple to not perform this automatic conversion.

whattype(a*b) gives whattype(a*b)

while whattype(a*a) gives whattype(a*a)

Alternatively, a way to factorize 6*x^2+a*x-10 into (a+6*x)*x-10 could do the trick.

Here's a list of the functions I've already tried:

  • factor
  • collect (so coeff too)
  • combine/expand

Any ideas?

Thank you!

Hi. I can't seem to get my Explore plot to work. Maple gives me a cryptic error message (IMHO).

I want to simplify the following expression to 2a-2bk+k(n+6). But the following command is invalid.



However, the above expression can be simplified when k is fixed to a number, such as k=2.


I wonder what went wrong.

It seems to be recognized only if n1+ n2 is combined.


Error occurred running sample (at new EngineCallBackDefault()):

# A fatal error has been detected by the Java Runtime Environment:
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffd66e7345a, pid=1740, tid=7716
# JRE version: Java(TM) SE Runtime Environment (11.0.1+13) (build 11.0.1+13-LTS)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (11.0.1+13-LTS, mixed mode, tiered, compressed oops, g1 gc, windows-amd64)
# Problematic frame:
# C  [maplec.dll+0x345a]
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
# If you would like to submit a bug report, please visit:
# The crash happened outside the Java Virtual Machine in native code.


Imagine you have an irregular polygon as follows:

restart; with(plottools):with(plots):


with vertices that can be easily defined, and that you have an arbitrary point P(x,y) with coordinates of (x) and (y). I want Maple to check whether the point P(x,y) is inside or outside the polygon. In Matlab, the command (inpolygon) can be used for such a task. Is there a similar readily available command in Maple. 

Thank you very much for your help and support. 

 I can't seem to figure out how to use arctan on a complex number in Maple.  I expect arctan(a+jb) assuming a and b are real to return atan(b/a).  Instead, returns arctan(a+Ib).  How do I do this?



assum := R1::real, C1::real, omega::real, vab::real

R1::real, C1::real, omega::real, vab::real


Pab := expand(rationalize(vab/(R1-I/(omega*C1))))``



Pabmag := `assuming`([abs(Pab)], [assum])



Pabang := `assuming`([arctan(Pab)], [assum])




test out how to use arctan....

`assuming`([arctan(a+I*b)], [a::real, b::real])






Inverse laplace (invlaplace) isn't working.

g(s) is an exponential function expressed by the linear equation of s.

d(s) is an exponential function expressed by the  quadratic equation of s.

g(s)'s invplace is worked well, but d(s) isn't working. What happen?


g(s) := s -> exp(-3*s):

gg(t) := t -> invlaplace(g(s), s, t):

                          Dirac(t - 3)

d(s) := s -> exp(s^2):

k(t) := t -> invlaplace(d(s), s, t):

                           /      uminus01/   / 2\      \  
     Typesetting:-mcomplete\&Lscr;        \exp\s /, s, t/, 

                         /[          /   / 2\      \]\\
       Typesetting:-_Hold\[invlaplace\exp\s /, s, t/]//


Dear all

I compute the solution of first order nonlinear ode, supplied to initial condition.

The code is written, the exact solution is derived.

 plot the solution in a small interval like (0,1/5) I see that there is no difference between exact and semi-analytical soluton.

But, If I plot the solution in other interval like (0,1) or (0,2), It is noticed that the semi-analytical solution is different to the exact solution. 
Thansk you in advance for your help


I am trying to follow a textbook example concerning the calculations of probability based on continous joint distributions. I cannot calculate the same result using Maple, specifically the double integral.

In a effort to determine what I need help with I have presented the example and what I know, in order to potentially rule out potential misconceptions with regard to the theory itself and maybe not a lack of Maple skills..

The example is a follows;


My thoughts / attempt:

So we are dealing with independent variables which are exponetially distributed. We need to find the prob. that P(X<Y), so we need to find the joint density of the distributions. We know the density of an exponential distributed variable, and since they are independent, the product of their densities is the desired joint density function f(x,y) we need in order to evaluate the probabilty;

f(x, y) = lambda*exp(-lambda*x)*mu*exp(-mu*x)

My book states that the probability of a set B, w.r.t to two continuous distributions is

so with regard to my specific case, B can be substituted with X<Y, and as such should also be applied appropriately to the limits of the integrals.

We know that both distributions have the same exponential distribution (in) [0,+inf], and that X<Y is to be determined, thus we can conlude that

{(x,y) : 0 < x < y < +inf}

Thus the probability is given by (as presented in the book):

Can Maple directly solve this integral from such an expression?

The book chooses to split up the double integral with respect to the limits of the variables(distributions?);

x is of course the lowerbound for the dy integral as y is specfied to be larger than x..

So ultimately my problem is that I cannot replicate the last integral expression ,I end up with;

-lambda*exp(-lambda*x - mu*y) + lambda*exp(-lambda*x - mu*x)

So an additional term.. I am just ignorant, and should I ultimately know that I have to disregard the contribution term containg the y variable seeing that we have to inetgrate w.r.t to the last dx integral?



int(lambda*mu*exp(-lambda*x-mu*y), y = x .. infinity)

limit(-lambda*exp(-lambda*x-mu*y)+lambda*exp(-lambda*x-mu*x), y = infinity)









`assuming`([simplify(combine(int(lambda*mu*exp(-lambda*x-mu*y), y = x .. infinity)), size)], [x > 0, y >= x, y > 0])

limit(lambda*(-exp(-lambda*x-mu*y)+exp(-x*(lambda+mu))), y = infinity)









int(lambda*mu*exp(-lambda*x-mu*y), y = x .. infinity)

limit(-lambda*exp(-lambda*x-mu*y)+lambda*exp(-lambda*x-mu*x), y = infinity)




Any thoughts would be greatly appreciated, thanks in advance.

First 15 16 17 18 19 20 21 Last Page 17 of 2084