John May

Dr. John May

3076 Reputation

18 Badges

18 years, 0 days
Maplesoft
Pasadena, California, United States

Social Networks and Content at Maplesoft.com

Maple Application Center
I have been a part of the Mathematical Software Group at Maplesoft since 2007. I have a Ph.D in Mathematics from North Carolina State University as well as Masters and Bachelors degrees from the University of Oregon. I have been working on research in computational mathematics since 1997. I currently work on symbolic solvers and visualization as well as other subsystems of Maple.

MaplePrimes Activity


These are answers submitted by John May

My documentation (Maple 9) says: "if m and n are integers then irem returns r such that m = n*q + r, abs(r) < abs(n) and m*r >= 0"
Basically this says that if you give a negative dividend m to irem, you will get a negative remainder r. This is how the % (mod) operator works in C and Java. On the other hand, mod (when set to the default 'modp' (see ?mod)) will always return a positive value so it give the values a Mathematician would expect. (You can also set it to 'mods' instead and that it returns a value between -p/2 and p/2 -- the "symmetric representation".)
If you are not looking for a (approximate) numerical result, you should put your input as an exact fraction: d:=9/10; Even though d:=0.9 looks exact, it gets treated as an approximate numerical value. Maple will do different things for exact and numeric inputs and that is probably causing your problem here.
You want to use evalc (the complex evaluator):
> evalc(a*exp(I*x)+a*exp(-I*x));                      
                                  2 a cos(x)

> simplify(evalc(-I*(1-exp(-2*I*x))/(1+exp(-2*I*x))));

                                   sin(2 x)
                                 ------------
                                 1 + cos(2 x)

> expand(%);

                                    sin(x)
                                    ------
                                    cos(x)
If you have a list with a lot of zeros and want to get rid of them you can do something like this:
foo:=[0,0,12,0,11,42,13,0,7]:
min(op(foo)), max(op(foo));
#      0, 42
foo:=remove(`=`,foo,0); # removes x in foo with x=0 
#      [12,11,42,13,7]
min(op(foo)), max(op(foo));
#      7, 42
If you are doing this numerically, you might want to get rid of small values instead of just the zeros. In that case you could do something like:
remove(z->abs(z)<10^(-Digits+1), foo); 
From your code, it looks like points4 is a sequence of pairs [x,y]. If you want to filter just based on the x value, you could do:
remove(z->abs(z[1])<10^(-Digits+1), [points4]);
Hope that helps.
First 9 10 11 Page 11 of 11