Doug Meade



Douglas B. Meade <><
Math, USC, Columbia, SC 29208 E-mail:
Phone: (803) 777-6183 URL:

MaplePrimes Activity

These are replies submitted by Doug Meade

@wzhang Two possibilities for saving a Maple plot to a file is possible with either the Export or plotsetup command:

plotsetup(ps, plotoutput = ``, plotoptions = `portrait, noborder, width=1000, height=500`);
plot(x, x = 0 .. 1);
plotsetup( default ):

sinefile := FileTools:-JoinPath(["sineplot.jpg"], base = homedir);
Export(sinefile, plot(sin));

See the online help for either command for additional details and examples.


I don't see that you have a recursive procedure.

First, except for fea (which you've not shared with us), you have a sequence of commands. Are these the body of a procedure (MyIsPrime?). Even if they are, to be recursive the code would have to call itself at some point in the body. (Looking at the structure of your code, I can see where there might be possible to use recursion but I'll let you tell me exactly what you want and not make too many assumptions until then.)

It would be most helpful if you could share more details about what you have done. What do you get from your commands?

I don't see anything obviously wrong with what you have written. I will point out that the first conditional could be streamlined as follows:

if C[0]=1 or C[0]=n-1 then ...
elif k=1 then ...
elif k>1 then ...
end if

And, if k can never be <1, the last elif k>1 could be replaced with else.

Similar simplifications can be made elsewhere.


Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail:
Phone:  (803) 777-6183         URL:

This sounds like it's an assignment for a class. If so, it's probably not acceptable for you to be asking one of us to do this for you. If you showed us what you had attempted, and where you encountered problems, we might be able to help. But you are asking us to do the work for you.

Before you worry about the Maple programming, do you have an algorithm for what the procedure will do? That's your first step. Once you show us that, we might be able to point you to specific Maple commands to help implement the algorithm.

Lastly, I strongly encourage you to seek help from your professor. He or she will be best able to answer your questions within the context of your current course, and relative to what else you've done (or will do) in the class.


Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail:
Phone:  (803) 777-6183         URL:

@nadjet Why won't you tell us the specific function you are interested. There are lot's of trigonometric functions. Their periodicity often leads to multiple solutions. There are steps you can take to control which solution Maple finds - but this requires knowledge of the specific functions involved. If your function is very complicated, just upload the entire Maple worksheet (click the green upward-pointing arrow and follow the steps). Until you give us more details there is nothing more we can do.

@nadjet Ok. You are trying to find where the gradient of a function is the zero vector. Is G a polynomial in x and y?Is it defined implicitly/recursively? Until you tell us what function, there is no way for us to answer your question.

@tomleslie It sounds to me as though Maple might be looking at the "locale"/region/language setting and making an assumption. Could you have changed something on the computer that you are using? Or even on a different computer? Thre has to be an explanation - even if it's not rational (but certainly it won't be irrational).

@Kitonum Thank you. Very nice. And, you read close enough to see that the axis was not supposed to be y=0. (Maple's built-in command can handle this as well - see the online help for the complete list of options and a few examples.)

@nMaple Well, this is not so easy using built-in commands. You can visualize the entire solid, with a single slice, with

VolumeOfRevolution( x, x^2+1, x=0..2, output=plot, showregion=true );

It's unfortunate that this cannot be animated. But, it is not too difficult to create your own animation. The basic idea is to plot the region, with a specified rotation (think cylindrical coordinates with axis of symmetry along the x-axis). I don't have time right now to put this together. Once you have this, the animate command makes it easy to create the animation. Give it a try, or maybe someone else can show you how to put this together.

@acer I swear your answer was not visible when I posted my reply. But, your work confirms my conjectures. Thank you.

Also, I see that you're also fighting the varepsilon battle. Have you ever said anything directly to Maplesoft about this?

I agree that this does appear to be a little odd, but your expressions are so complicated that I cannot easily see any explanation for Maple's response. The problem is in simplify, not series.

Since your expressions are so complicated I converted all the radicals to floating-point approximations. While I do get the third eigenvector being <1,1,1>, the other two do not agree with what you report from MMA. Well, the middle component of the second e-vector does see to be agreeing with MMA.

Transpose( series~( simplify( evalf( evecs ) ), varepsilon=0, 2 ) );

I do note that most of the coefficients are complex-valued, and some of the terms appear to be quite large (10^9 and even 10^(19)). I do not see this in the MMA results.

series~( simplify( evalf( evals ) ), varepsilon=0, 2 );

Looking at the e-values, these appear to be real-valued (with small imaginary parts when converted to floating-point). Thus, the imaginary parts of the e-vectors should all be zero. It looks to me as though the small imaginary component in the e-values is polluting the e-vector computation.

It's possible that Maple and MMA are using different e-vectors, but the fact that I'm seeing some agreement makes me doubt that this is the real issue. I think you're going to have to get Maple to do the equivalent of what ToRadical does in MMA. Then you might have more success.


Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail:
Phone:  (803) 777-6183         URL:

@want to be a permanent vegan The comment about "varepsilon" was meant more for the Maplesoft people who would see your post. TeX is a technical typsetting markup language. (It's what's used to produce most math textbooks.) In that system there are two different epsilons, \epsilion and \varepsilon. In 1D input, Maple recognizes the Greek letters and shows them in an appropriate font. When I was playing with your problem I typed epsilon, and Maple responded by telling me that nothing was known about this. Fortunately, I saw that my epsilon appeared differently from yours and I knew about the different epsilons in TeX so I had enough knowledge to ask about varepsilon. It's not appropriate for Maple to assume that all users will be able to make this connection. That is why I made that comment in my response. Your follow-up confirms my suspicions, and is why I believe Maple should take steps to eliminate the possibilities for others to get into a similar predicament.

@acer I had not looked at the actual worksheet, just the displayed code. If s has a known value, then this forces beta=0, and so q(0)=0 and f(0)=0. 

Your point about gamma is good. However, if that was the problem I would've expected Maple's message to have made some reference to an invalid use of a reserved name.

I'm waiting to hear more from the OP before I spend much more time on this.


@jwatkins Yes. I am interested in seeing how you would create a question that is more forgiving on syntax.

I've done quite a bit of this over the years, mostly in regular Maple, not TA. It's often quite painful and tedious. It would be a real benefit (to me) if TA had some tools that helped question authors deal with these sorts of issues.

@jwatkins Well, students don't typically find Maple syntax the most natural way for them to convey an answer. I can imagine any of the following as reasonable attempts to answer this question:

u' = 0, u(0)=0

diff(u,y)=0, u(0)=u(h)=0

diff(u(y))=0, U(0)=0 u(h)=U cos t

diff(u(Y),Y)=0, u(0)=0, u(h)=U*cos(T)

diff(u(Y),Y)=0, u(0)=0, u'(h)=U*cos(T)

diff(u(Y),Y)=0, u(0)=0, diff(u(y),y=h)=U*cos(T)

 diff(u(y),y)=0, {u(0)=0, u(h)=U*cos(t)}

Some of these Maple can't parse. Others parse but don't have a definite meaning.

Some are not valid for input to dsolve.

And I didn't even give any examples with unbalanced delimiters.

If the system respnods just with WRONG, students won't know if their problem is with the syntax or structure of their answer or with the content of their answer.

I would start by checking that the student response consists of a differential equation (for u(y)) and two boundary conditions, If it doesn't, the response should indicate what elements are missing.

This is not easy to do, in general. I'd be very interested in seeing a good implementation in Maple TA.

@iman While I have to agree with Preben, I will try to explain his initial suggestion.

The idea is to find an analytic solution to an initial value problem, with appropriate additional initial conditions with values that are not explicitly specified (they become parameters in the solution). If this is successful, applying the boundary conditions should provide a system of algebraic equations to solve for the unknown parameters introduced in the IVP.

This is the basic idea used in the "shooting method". This process is often complicated if if's not possible to find an analytic solution to the IVP or if it's not possible to solve the equations that enforce the boundary conditions.

Here's a simple example to illustrate this approach.

Consider the BVP y'' + y = 0, y(0)=0, y(1)=1

1. A well-posed IVP is y'' + y = 0, y(0)=0, y'(0)=alpha

2. It's solution is y(x) = alpha*sin(x).

3. To enforce the second boundary condition, y(1)=1: alpha*sin(1)=1 so alpha = 1/sin(1).

4. The unique solution to the original BVP is y(x) = sin(x)/sin(1).

I have to agree with Preben that I have my doubts about whether this approach will be successful on your problem.

As he wrote: Good luck! (and let us know how it goes)


1 2 3 4 5 6 7 Last Page 3 of 76