MaplePrimes Questions


How do I change the definition of g to get the result f(1, 2)(x) = 2*t+3 ?

f := a*x+b;
g := (a,b) -> x -> f;
g(a, b)(x);   # answer a*t+b
g(2, 3)(x);   # answer a*t+b

Thanks in advance


Hey, I need to modify a differential equation passed to a procedure. My problem is that this code works fine:

ode := diff(y(x), x) = y(x):
y := unapply(exp(x), x):
                        exp(x) = exp(x)

But this doesn't:

ode := diff(y(x), x) = y(x);
p1 := proc (eq)
    local y;
    y := unapply(exp(x), x);
end proc:
                        --- y(x) = y(x)

How to solve this problem? 

May I know any command that able to support the large number even up to 2000 bits? 

I made a typo below, I did not mean to put [...] around the solution. But why Maple throws an error on this only?

ode:=diff(y(x),x) = exp(x)*sin(x)+y(x)*cot(x);
odetest( y(x)=my_sol,ode) assuming x::real

          Error, (in type/algext) too many levels of recursion

But on other ODE's, it works

ode:=diff(y(x),x) = y(x);
odetest( y(x)=my_sol,ode) assuming x::real


I'll correct my type and remove the []. But the question is, should Maple have thrown an error? And why only on this one? Would this be considered a bug?

Removing the [] from the first example above, the error is gone and 0 is returned.

Maple 2019.1, Physics V 395 on windows 10

I am getting my feet wet with Maple's system calls, like ssystem. I am considering to use Maple to run something like a Python script for certain numeric calculations, based on Maple-generated results. I am using Mac OS X (macOS for newer versions).

Maple's Help gives the basics and that works. For the specific Python example; I can run a simple script by using

ssystem("python -c A=2;print(A)"); # \n instead of ; works also.

Presumably I can do this with longer scrpts as well.

However, it appears that, when creating the process, Maple does not setup the environment the user (me) gets through initialization files like .profile, .cshrc or the like. As a result even a simple "python -c import sys" fails; presumably because the environment where Python looks for the module isn't setup. I tried

ssystem("source .cshrc");

but that fails as well. Trying to be clever and invoking a login shell (ssystem("tcsh -lc <command>");) also leads nowhere.

The Help page does say that ssystem() does not give access to all shell commands; is there somewhere documentation that says what works and what is not supported?

I am aware that Maple2018 and newer have more support in form of the Python package, but right now I need my code to be backward compatible to Maple2015 so this new package does not solve my issue for the older installation I am also using. Also, Python is not necessarily the only language I want to use.

Any suggestions would be welcome.

Mac Dude


How to apply two for loops to solve ode problem.


restart; with(plots); fcns := {T(eta), f(eta)};
m := .5; bet := 1; na := 1/6; N := 5;
eq1 := (diff(f(eta), `$`(eta, 3)))*pr+m-m*(diff(f(eta), `$`(eta, 1)))+((m+1)*(1/2))*(diff(f(eta), `$`(eta, 2)))*f(eta) = 0;
eq2 := diff(T(eta), `$`(eta, 2))+((m+1)*(1/2))*(diff(T(eta), `$`(eta, 1)))*f(eta) = 0;
bc := f(0) = 0, (D(f))(0) = 0, (D(f))(N) = 1, (D(T))(0) = -bi*(1-T(0)), T(N) = 0;
bi:= [seq(1..4,0.1)];  NN := nops(bi);  
pr:=[seq(1..2,0.1)];  NN1 := nops(pr);
for i  from 1 to NN do    
for j from 1 to NN1 do  

R := dsolve(eval({bc, eq1,eq2}, bi[i],pr[j]), fcns, type = numeric, method = bvp[midrich], maxmesh=2400):  
end do:  
end do:  

Have a good day.


B1 := plots:-animate(plots:-pointplot, [[seq(X(kk, j), j = 1 .. 10)], [seq(Y(kk, j), j = 1 .. 10)]], kk = [seq(1 .. 50)], symbolsize = 25, symbol = solidcircle, colorscheme = ["valuesplit"])

gives error

Error, unsupported type of index, kk

Here X and Y are 50*10 matrices

A minor question .... 

Does anybody know how to format a matrix so all elements are presented in whole numbers? 

It's more a niggle than anything .. I want to retain decimals in my worksheet but wish only to have the matrix display integer values.

Thank you!

 May I know which commands able to generate large prime up to 2000 bits in maple? 

I believe this is a bug:

subsindets(%, anything^rational, proc(x) if type(x, specfunc(anything, Q)^rational) then 'Q(x)' else 'x' fi end)<>
subsindets(%, specfunc(anything, Q)^rational, Q);

Suppose we have a number of points, n, in the x-y plane and the location of each point is known.

I wish to evaluate the straight-line distance from point to point and tabulate these values (i.e. A to B, A to C, A to D, B to C, B to D, etc) and then plot the points in question.

In this attached worksheet, I have given an example of 4 points and I would welcome all suggestions on how to do this. 

Thanks for reading.


I'm new to Maple.

My problem is that if I input the command sqrt(3.0), for example, I get this strange result:

1.81847767202745*10^(-58) + (7.53238114626421*10^(-59))*I

The results is the same, no matter the argument of sqrt.

Also, when using ln, I get this:

-265.745524189222 + 0.785398163397448*I

Again, no matter the argument of ln, the result is the same.

What is happening?

Dear maple user  any one suggest me how to solve  second order coupled differential equation using galerkin finite element method for 8 elements and 10 elements using maple codes


I thought I remembed how to do this once in Maple, or asking something like this here, but may be it was something similar. But I am not able to figure it now or remember.

Given an expression, I want to find all occuranes of a pattern in it.  Not just one.  So this is like using patmatch but over and over again untill all patterns found. I'll give an example to make it easy to explain.


expr := y^2*sin(1/y) + y^(3/2) + y + x*y^7;

I want to find all patterns of form y^n  so the result should be 

{y^(3/2), y^7, y^2, 1/y, y}

This below is how it is done in Mathematica, but having hard time translating this code to Maple.

The last line below does the actual repeated pattern matching. That line was not written by me. It is something from Mathematica forum at stackexchange and I use it all the time and it works well.

expr = y^2*Sin[1/y] + y^(3/2) + y + x*y^7;
pat = y^n_.;
Last@Reap[expr /. a : pat :> Sow[a], _, Sequence @@ #2 &]

I looked at hastype also. But hastype will only tell me if the pattern is there or not. May be I did not use it right.

expr := y^2*sin(1/y) + y^(3/2) + y + x*y^7;

Gives true

I tried patmatch, but again, it only find one:

expr := y^2*sin(1/y) + y^(3/2) + y + x*y^7;
if patmatch(expr,a::anything+y^(n::anything)+b::anything,'la') then

And the above is not even robust for finding one. Since I have to change the pattern again to account for multiplication/addition cases between terms. 

Is it possible to do in Maple the same thing I show in Mathematica? I am sure it is possible, but can't now find the right function in Maple.

Maple 2019.1

Should I adjust numcpus while running thread command

First 406 407 408 409 410 411 412 Last Page 408 of 2176