Dr. Mostafa Jani

35 Reputation

4 Badges

8 years, 237 days
Shahid Beheshti University
Postdoctoral researcher

Social Networks and Content at

Ph.D., Applied Mathematics, Research interests: Numerical analysis, Numerical methods for partial differential equations, Fractional PDEs, Spectral methods, Machine learning, Computational mechanics

MaplePrimes Activity

These are questions asked by mostafajani

I have the following expression


The parameters i and N are nonnegative integers and i is less than or equal to N. The purpose is to make it as short as possible. Based on my experience, it could be expressed as a small binomial expression or as a sum of two or three binomials. However, by Maple commands the conversion does not give me binomials or any smaller expression.

Is there any way for the conversion to binomials or any other conversion to shorten the expression?

I appreciate any help.

Dear friends

I have a long-running code that sometimes takes an hour to complete. I wonder is there a way to find out what line of code is currently running in a long-running maple code or to show an update of the variables. I have some print commands but are shown just after completion not before. 

Thank you in advance for your time.

I have a function that is defined by a proc command including some conditional statements (if ... then ...). The conditions are so long so that I can not use a piecewise function instead of using proc. The commands in my code are long and I simplify my question as follows:
f := proc(x) local r; r := sin(x)+x*cos(x); if abs(r) < 1/2 then sin(x) else cos(x) end if; end proc;

plot('f'(x), x = -1 .. 1) works fine but the command int(('f')(x), x = -1 .. 1) gives an error:
Error, (in f) cannot determine if this expression is true or false: abs(sin(x)+x*cos(x)) < 1/2

Is there any way (except rewriting the function as a piecewise function) to get rid of the error? 

Any help is appreciated.

How can I ask Maple to wake me up after running the code?

It takes a long time to finish the job. So it would be helpful to play a beep or something to inform me the answer is ready.

Thank you in advance for your help.

Dear friends

It seems that Maple takes a long time to evaluate the square roots of numbers.

See the simple code below.

st := time();

for i to 1000 do for j to 1000 do

a[i, j] := evalf(abs(i-j+1)^0.3-abs(i-j)^0.3):

end: end:


I run it, then after a few seconds I run it again and again  to see the consuming time: once the running time is 77 seconds, then is 57 seconds, again is 73 seconds ...

Two questions:

1- Why the time is so differnt?

2- Why a simple code is being done at about a minute? Based on the number of operations, I think it should be done at less than a second. It just involves finding two million real third roots each of them less than 100 operations (if Newton method for finding roots is applied it probably needs less than 20 operations). I was thinking that a computer may do one billion operations per second. 

Since I need to report my numerical results in a scientific paper, it is important for me to know what's going on.

It is worthy of noting that I use Maple 18 on a Lenovo Laptop with Corei3 1.90 GHz with 64 bit operating system and 4 Gb RAM.

In advance, I appreciate for helping me to reveal the secrets.

Thank you all


1 2 Page 1 of 2