Items tagged with program


Dear sir


In my ode problem i do not know that how to set range (eta) from -2 to 2 please can  you help me.

How to hum program repeat several times and save what data result from each time it runs?

Hello everyone!

Prime:= proc (a, b)

local i, p, r;

p := ();

r :=() ;

for i from a to b do

   if isprime(i) then p := p union (i) end if;

     if type(sqrt(p[i]-1), integer) then r := r union (p[i]) end if;

end do

end proc;

Prime(1, 10)

My English is not very good. I don't know what erros I get in my program. Thank everyone

I am trying to take a list of prime numbers that I already generated with the following:


for i from 2 to 50 do

if nops(ifactor(i))=1 then L4:=L4,i end if:

end do;


This gives me the primes bewteen 2-50, [2,3,5,7,11,13,17,23,29,31,37,43,47].  I want to write something that takes the products of my list like this




and so on through the whole list.  Any ideas?  I figured out how to take the product of 2*3, 2*5, 2*7 and so on, but I cant figure how to make it do 2*3, 2*3*7 and so on.

I am doing a presentation on Euclids infinite prime proof and thought it would be cool to write a maple program that will show his proof for a certain amount of prime numbers.


Thanks,  Matt




Hi all,

I google and found a program using C# connect with Maple. The Maple file is mla file - a pakage library type of Maple. I want to review data structure and all interfaces funtions to understand the way to implement this features.

Please help me the way to read the original Maple code. I uploaded the .mla file into mediafire if you want to review it. Link 


Quan Nguyen

I solve the problem on computational geometry: "A cube of side one contains two cubes of sides a and b having non-overlapping interiors. How to prove the inequality a+b≤1?" To this end I use the DirectSearch package , namely,

Here are some comments to it. The cube of side a is centered at (x_1,y_1,z_1) and rotated by the angles phi_1, psi_1, theta_1 (see ) and the cube of side b is centered at (x_2,y_2,z_2) and rotated by the angles phi_2, psi_2, theta_2. The procedure

calculates the distance between these cubes, for example,

st := time(); dist(.2, .9, .2, .2, .2, .7, .7, .7, 0, 0, 0, 0, 0, 0); time()-st;

[HFloat(5.453016092898238e-11), [s1 = HFloat(0.2646161775314957),

  s2 = HFloat(0.2828503247068887),

  s3 = HFloat(0.29444713116943216),

  t1 = HFloat(0.2646161774916062),

  t2 = HFloat(0.28285032471998384),

  t3 = HFloat(0.2944471311346344)], 2527]
Unfortunately, my code (which is syntactically correct) is spinning on my wondercomp during 10 hours without any output. I don't understand it at all. Your advices are welcome.


When I run a maple program which take a long time (in command line), I have this kind of message every second:

"memory used=43867.3MB, alloc=147.3MB, time=856.28"

Does there exist any way to avoid this display ?

Thanks in advance.

Hello, everybody!

If it is convenient for you, I wish you can help me review the following program. Thank you very much in advance. I want to obtain the coefficient values of c0, n, s0, ks, h1, h2, kp, A, B for the ODE system.

cdm_ode := diff(y1(t), t) = c0*(y6(t)*(1-y3(t))/(s0*(1-y4(t)*(1-y5(t)))))^n/(1-y2(t)), diff(y2(t), t) = ks*y2(t)^(1/3)*(1-y2(t)), diff(y3(t), t) = h1*(1-y3(t)/h2)*c0*(y6(t)*(1-y3(t))/(s0*(1-y4(t)*(1-y5(t)))))^n/(sigma*(1-y2(t))), diff(y4(t), t) = (1/3)*kp*(1-y4(t))^4, diff(y5(t), t) = A*B*y1(t)^(B-1)*c0*(y6(t)*(1-y3(t))/(s0*(1-y4(t)*(1-y5(t)))))^n/(1-y2(t)), diff(y6(t), t) = y6(t)*c0*(y6(t)*(1-y3(t))/(s0*(1-y4(t)*(1-y5(t)))))^n/(1-y2(t));

tol_t := 3600;

sol := dsolve([cdm_ode, y1(0) = 0, y2(0) = 0, y3(0) = 0, y4(0) = 0, y5(0) = 0, y6(0) = 175], numeric, range = 0 .. tol_t, output = listprocedure, parameters = [c0, n, sigma, s0, ks, h1, h2, kp, A, B]);

err := proc (c0, n, s0, ks, h1, h2, kp, A, B) local st1, st2, sv1, sv2, sv; sol(parameters = [c0, n, 175, s0, ks, h1, h2, kp, A, B]); st1 := subs(sol, y1(t)); sv1 := [st1(1), st1(100), st1(210), st1(2500), st1(2800), st1(3000)]; sol(parameters = [5.7/10^6, 10.186, 175, 200, 1/20000000, 10000, .269, 1.5/10^7, 1.5, 2]); st2 := subs(sol, y1(t)); sv2 := [st2(1), st2(100), st2(210), st2(2500), st2(2800), st2(3000)]; sv := add((sv1[i]-sv2[i])^2, i = 1 .. 6); sv end proc;

GlobalSolve(err, c0 = 0 .. 1, n = 1 .. 20, s0 = 150 .. 250, ks = 0 .. 1, h1 = 100 .. 15000, h2 = 0 .. .5, kp = 0 .. 1, A = .5 .. 2, B = 1 .. 5);

Error, (in GlobalOptimization:-GlobalSolve) `InertForms` does not evaluate to a module

Hi all.

In the following program, i have normalized bernstein polynomials using gram- schmidt orthogonalization process and want to hybrid them with block pulse functions so that i have:


why the program is wrong?? where of it doesn't work properly?

please guide me

best wishes


Mahmood   Dadkhah

Ph.D Candidate

Applied Mathematics Department


I have a non linear ode with sinosoial term, (sin(x)).

How can we Analyse the system and plot the bifurcation diagram:


Thank you very much for your help.


Hi all

I have a mathematical problem and I asked it in various sites but the answers till yet are not correct.

Assume that we have:

b[n,m]:=unapply(piecewise(t>=(n-1)*tj/N and t<n*tj/N, T[m](N*t-(n-1)*tj), 0), t):

where n,N,tj are known constants. furthermore assume that we want to comute the following integral:

for following approximations:

I have written the following code but it seems to be incorrect:


the original program is :


I will be so grateful if any one can help me to solve it by maple

Mahmood   Dadkhah

Ph.D Candidate

Applied Mathematics Department

hi all.

I have wrore the following program for optimization with bernstein and block pulse hybrid functions.

the program have some errors which i can't understand.



macro(LA= LinearAlgebra):

HybrFunc:=proc(N, M,  tj)               # N=Number of subintervals,  M=Number of functions in subintervals
local B, n, m;

global b;

for n from 1 to N do
for m from 0 to M-1 do

B := (i,m,t) -> C(m,i)*(1-t)^(m-i)*t^i:

b[n,m]:=unapply(piecewise(t>=(n-1)*tj/N and t<n*tj/N, B(m,2,N*t-(n-1)*tj), 0), t):

Array(1..N, 0..M-1, (n,m)->b[n,m](t)):

end proc:

HybrFunc(3, 3, 1);

                                       # End Of Definition
g2(t):=t;            #*exp(t-1):                      # Any other function can be replaced here

g1(t):=add(add(c[n,m]*b[n,m](t), m=0..2), n=1..3);
Optimization[Minimize](sqrt(int((g2(t)-g1(t))^2, t=0.. 1)));
plot([g2(t),g1(t)], t=0..1, 0..5, color=[blue,red],thickness=[1,3],discont, scaling=constrained);

Array(1 .. 3, 0 .. 2, {(1, 0) = piecewise(0 <= t and t < 1/3, (1-3*t)^2, 0), (1, 1) = piecewise(0 <= t and t < 1/3, (6*(1-3*t))*t, 0), (1, 2) = piecewise(0 <= t and t < 1/3, 9*t^2, 0), (2, 0) = piecewise(1/3 <= t and t < 2/3, (2-3*t)^2, 0), (2, 1) = piecewise(1/3 <= t and t < 2/3, (2*(2-3*t))*(3*t-1), 0), (2, 2) = piecewise(1/3 <= t and t < 2/3, (3*t-1)^2, 0), (3, 0) = piecewise(2/3 <= t and t < 1, (3-3*t)^2, 0), (3, 1) = piecewise(2/3 <= t and t < 1, (2*(3-3*t))*(3*t-2), 0), (3, 2) = piecewise(2/3 <= t and t < 1, (3*t-2)^2, 0)}, datatype = anything, storage = rectangular, order = Fortran_order)

g2(t) := t

"g1(t):=c[1,0] ({[[(1-3 t)^2,0<=t and t<1/3],[0,otherwise]])+c[1,1] ({[[6 (1-3 t) t,0<=t and t<1/3],[0,otherwise]])+c[1,2] ({[[9 t^2,0<=t and t<1/3],[0,otherwise]])+c[2,0] ({[[(2-3 t)^2,1/3<=t and t<2/3],[0,otherwise]])+c[2,1] ({[[2 (2-3 t) (3 t-1),1/3<=t and t<2/3],[0,otherwise]])+c[2,2] ({[[(3 t-1)^2,1/3<=t and t<2/3],[0,otherwise]])+c[3,0] ({[[(3-3 t)^2,2/3<=t and t<1],[0,otherwise]])+c[3,1] ({[[2 (3-3 t) (3 t-2),2/3<=t and t<1],[0,otherwise]])+c[3,2] ({[[(3 t-2)^2,2/3<=t and t<1],[0,otherwise]])"

Error, (in Optimization:-NLPSolve) complex value encountered

Error, invalid left hand side in assignment


Download Bernestien1.mws

 I'll be so grateful if any one can help me.

Mahmood   Dadkhah

Ph.D Candidate

Applied Mathematics Department

Take a look at this link.

For solving problem sets, I have a pdf template I created for myself that has a header with a blank for the class name, TA, professor, date, etc. In addition to this header, I had a margin on the left to scribble questions I had and to holepunch. 


I used to print out the template and write on the template and turn in that as my pset.


I am nowthinking of doing everything on the computer. Writing out all of the problem set on the computer. Combining stuff from maple, combining handwritten stuff from the computer using a digitizer. However I want to write it all on top of the my template that I created, which is a pdf file. I can turn the pdf into an image file if need be. 


What would be the easiest way to do what I want? To open a program that automatically sets that pdf as the template and easily lets me handwrite stuff I want and paste in maple code? 


Right now if I tried my idea, I would basically be constantly copying and pasting stuff from maple and my digitizer drawn pictures/equations into one file and it would be very clumsy.


Basically there are problems that I do partially on maple and I just want to unify all my work into one easy, printable file. 

1 2 3 4 5 Page 1 of 5