Items tagged with evaluation evaluation Tagged Items Feed



  I have the following code for using "PolynomialSystem" solve equations of polynomial




f:=PolynomialSystem({x+y-3, x^2+y^2-5}, {x, y}):




The output is


x, y
{x = 2, y = 1}, {x = 1, y = 2}
{x = 2, y = 1}
{x = 1, y = 2}
x = 2
y = 1
x = 2, y = 1
-x = -2.
-y = -1.


From what I have seen, I cannot subtract the values of x and y as 2 and 1. Is there any way that I can get the values of solutions of variables, namely I can assign a variable "a" as 2, and the other variable "b" as 1?


Thank you very much!





Sorry for basic question, Maple newbie here and I could not find answer using google.

I understand in Maple one uses the back quote key (or rather the apostrophe, 0X27) to prevent one time evaluation of expression. Hence when writing

'sin(Pi)'; #this remain sin(Pi)
%; # now we get 0

But when I tried it on fraction, it did not hold it:

'16/4'; #maple replied with 4

This might indicate that the front end parser did this simplification before the main evaluator got hold of it, so it was too late?

Either way, how would one make Maple return 16/4 when the input is '16/4'?


I'm having a problem with the statements inside a for-loop somehow being read in a different way than outside the loop. 

I've defined some functions earlier, and then I need to perform an integration using these functions, while I change one variable a little for each loop of the for-loop. 

The problem is that IN the for-loop, I get the same value from my integration for all loops. But when I execute the exsact same code OUTSIDE of the loop, I get the correct values, which are changing whenever i change the one variable. 

Here is the loop:

for i from 0 to 42 do

rotorshift := evalf[6](2*((1/180)* *Pi*((1/2)*Ø[gap]))/N[m]-1/2*(tau[p]-tau[s]));

PMmmf_func := x-> proc (x) if type(x-rotorshift, nonnegative) then if type(trunc((x-rotorshift)/tau[p]), odd) = true then -H[c]*l[m] else H[c]*l[m] end if else if type(trunc((x-rotorshift)/tau[p]), odd) = true then H[c]*l[m] else -H[c]*l[m] end if end if end proc

B[g] := proc (x) -> 1000*mu[0]*(PMmmf_func(x)+MMF_func(x))/d[eff, stator](x) end proc;

Flux(i+1) := (int(B[g](x), 0 .. tau[s])+int(B[g](x), 3*tau[s] .. 4*tau[s])+int(B[g](x), 6*tau[s] .. 7*tau[s])+int(B[g](x), 9*tau[s] .. 10*tau[s]))*10^(-3)*L[ro];

end do;

And for all the values in the "Flux" vector, I get the same value. But when I remove the loop, and change the value of manually, I get the correct (changing) values of flux!! 

Any ideas why this may be? This is really dricing me nuts. I've spent the beter part of the day on this, and I just can't seem to find a workaround, much less a reason for this behaviour.

many thanks!

I want to print 2+3= in the input and get exactly the same output.

And how can i do it in a program?

Is it possible to evaluate a function at multiple points described by an array or something of that sort and have Maple return the evaluations as an array. I need approximations of a function at various values of its argument so it would be nice to do it with a single command.


Hello everybody. I'm newbie and my english are not very good. Please help me debug an error in my files "Error, (in ans) cannot determine if this expression is true or false"

I have an indexed equation that contains serval definite integrals in it. I want maple to evaluate the equation for different indices. But when I set the parameter "N=100" in the code, it takes maple lots of time for the evaluation. I am looking for some tricks to make the code numerically more efficient. I will be so thankful for any opinion and help.
you can find my code below. The code is so simple and just contains few lines. I will appreciate any help.

Thanks in advance.

I am having problems with the curly brackets in math mode. I am using a Danish keyboard, and since changing to Maple 17, the inline evaluation (usually [CTRL]+=) has been placed as [CTRL]+[ALT]+0 which - by Maple - is interpreted the same way as [ALT-GR]+0. Unfortunately [ALT-GR]+0 is the way to get the end-bracket for curly brackets, i.e. }

Therefore, I am not able to write } in math mode. Maple interprets my keystrokes as a wish to do inline evaluation when trying to write }.

Has anyone experienced this issue - and if so: Is there a way to fix it?

Is there a way to change the shortcut keys in Maple (e.g. make an alternative shortcut for inline evaluations)?


Suppose i am trying to do a sequential if command as follows:

seq(`if`(a[i] < b[i], c[i], d[i]), i = 1 .. 10);

now this doesnot evaluate the i's in c[i] and d[i].

please help me with complete evaluation of this statement.

I have a rank 1 array M of 1000 values.

I want to apply a function f on each value of M and its location giving,

[f(1,M[1]), f(2,M[2]), ... , f(1000,M[1000])]

is it possible to get this using map or map2 or map[n] or maptype (without using seq since its slowing down computation).

inotherwords can i access the member location inside a map evaluation?

Consider the following code:

Setup(anticommutativeprefix = psi):
psiFermi := Vector(2,symbol = psi):
psiBose  := Vector(2,symbol = phi):
A := Matrix([[0,1],[1,0]]):
Transpose(psiFermi) . A;
Transpose(psiBose ) . A;

It produces the following output:

Why is the first line, for anticommuting components, not evaluated to the same form as the second line, for commuting components? The actual choice of the matrix A seems immaterial; the odd behaviour is present even if A is chosen to be the identity matrix!

In comparison, the 'contracted' (scalarly) expressions

Transpose(psiFermi) . A . psiFermi,
Transpose(psiBose ) . A . psiBose;

produce the following completely sensible output:


Why do the first two of the following 4 examples not work in Maple 15?

subs(m=21,`mod`(m, 4));
subs(m=21,m mod(4));
`mod`(21, 4);
21 mod(4);

Is there a (simple) workaround?


I think we all know the routine. We walk to a large classroom, we sit down for a test, we receive a large stack of questions stapled together and then we fill in tiny bubbles on a separate sheet that is automatically graded by a scanning machine. We’ve all been there. I was thinking recently about how far the humble multiple choice question has come over the last few years with the advent of systems like Maple T.A., and so I did a little research.

Multiple choice questions were first widely-distributed during World War I to test the intelligence of recruits in the United States of America. The army desired a more efficient way of testing as using written and oral evaluations was very time consuming. Dr. Robert Yerkes, the psychologist who convinced the army to try a multiple choice test, wanted to convince people that psychiatry could be a scientific study and not just philosophical. A few years later, SATs began including multiple choice questions. Since then, educational institutions have adopted multiple choice questions as a permanent tool for many different types of assessments.

One of the biggest advances in the use of multiple choice questions was the birth of automatic grading through the use of machine-readable papers. These grew in popularity during the mid-70s as teachers and instructors saved time by not having to grade answer sheets manually.

Until recently, there has not been much advancement in this area.  It’s true, Maple T.A. can do so much more than just multiple choice questions, so this style of question is less important in large-scale testing than it used to be. But multiple choice questions still have their place in an automated testing system, where uses include leveraging older content, easily detecting patterns of misunderstanding, requiring students to choose from different images, and minimizing student interaction with the system. Luckily, Maple T.A. takes even the humble multiple choice questions to the next level. Now you might be thinking, how is that even possible given the basic structure of multiple choice questions? What could possibly be done to enhance them?

Well, for starters, in Maple T.A., you can permute the answers. This means you have the option to change the order of the choices for each student. This is also possible with machine-readable papers, but this does require multiple solution sets for a teacher or instructor to keep track of. With Maple T.A., everything is done for you. For example, if you have a multiple choice question in Maple T.A. with 5 answer choices, there are 120 different possible answer orders that students can be presented with. You don’t have to keep track of extra solution sets or note which test version each student is receiving. Maple T.A. takes care of it all.

Maple T.A. allows you to create Algorithmic questions - multiple choice questions in which you can vary different values in your question. And you aren’t limited to selecting values from a specific range, either. For example, you can select a random integer from a pre-defined list, a random number that satisfies a mathematical condition, such as ‘divisible by 3’ or ‘prime’, or even a random polynomial or matrix with specific characteristics. It allows an instructor to create a single question template, but have tens, hundreds, or even thousands of possible question outcomes based on the randomly selected values for the algorithmic variables. The algorithmic variables not only apply to the question being asked by a student, but also the choices they see in a multiple choice question.

You can even create a question where every student gets the same fixed list of choices, but the question varies to ensure that the correct response changes.  That’s going to confuse some students who are doing a little more “collaboration” than is appropriate!

Some of the other advantages of using Maple T.A. for multiple choice are also common to all Maple T.A. question types. For example, you can provide instant, customized feedback to your students. If a student gets a multiple choice question correct, you can provide feedback showing the solution (who is to say the student didn’t guess and get this question correct?) If a student gets a multiple choice question incorrect, you can provide targeted feedback that depends on which response they chose. This allows you to customize exactly what a student sees in regards to feedback without having to write it out by hand each time.

And of course, like in other Maple T.A. questions, multiple choice questions can include mathematical expressions, plots, images, audio clips, videos, and more – in the questions and in the responses.      

Finally, let’s not forget, in an online testing environment, there is no panic when you realized you accidently skipped line 2 while filling out your card, no risk of paper cuts, and no worrying about what kind of pencil to use!


I am trying to produce an animation. Everything seems correct, but the evaluation is taking a very long time. Even after an hour, it still tries to crank out a graph for me. I even tried to truncate the integral!

Here is my code.


z:= x -> 2*(int((sin(2*y)-sin(y))*cos(y*x)*exp(-y^2*t)/y, y = 0 .. 200))/Pi;

animate(plot, [z(x), x = 0 .. 10, y = -.1 .. 2], t = 0 .. 1, frames = 100);


Would could be the problem? 

I have a procedure that takes an object, i.e. a module, as an argument. On grounds of the properties of that object, the procedure should return a certain map. But I hit a snag, the gist of which is along the following lines (just an example):

M := module()
   export dim;
   dim := 2;
end module:

F := proc(m::`module`)
   (x::Vector(m:-dim)) -> something
end proc:

My problem is that F(M) produces

rather than

How can I force m:-dim within F to be evaluated?

1 2 Page 1 of 2