roman_pearce

Mr. Roman Pearce

1678 Reputation

19 Badges

20 years, 216 days
CECM/SFU
Research Associate
Abbotsford, British Columbia, Canada

I am a research associate at Simon Fraser University and a member of the Computer Algebra Group at the CECM.

MaplePrimes Activity


These are replies submitted by roman_pearce

Actually, scratch that. By the time it's implemented and released 64-bit machines will be common. It would have been a good idea 10 years ago I guess.
Sorry, it is specific to Maple notation and it doesn't work in 2D math.
The tab key also works in the standard gui, although I don't think it shows you a list of suggestions.
I'm not sure what you mean. Do you think Maple should simplify (e^t)^2 to e^(2*t) automatically ?
Well Maple is built on Java 1.4, but it comes with it's own runtime environment. Does anyone know why it's using the system VM ?
The use of a software package like Maple is always a difficult balancing act, and if the students are resisting then it's worthwhile to try and address their objections. I can only speculate, but I would suggest that the students are trying to learn the math and to them learning Maple as well is getting in their way. I would suggest the following, based on my experience with an introductory nonlinear dynamics class. Teach the theory first using pencil and paper, because that is what the students are used to. There's nothing to be gained by putting Maple between them and the core material. Assign them some standard exercises to do by hand, because they will be expected to do those types of problems in the future. Where Maple has traditionally been used is in demonstrating things which require computation or the repeated application of a process to see. Approximate integration, the secant method, etc. all make for a good classroom demonstration with Maple. Some of the tutors under the "Tools" menu are quite good, and you can have the students use them on their own or in a lab setting. Computing students will probably not enjoy this, because it feels like "hand-holding". For some reason the idea appeals to educators though, probably because they don't have to prepare a lesson. Beyond that, you can have students solve problems using Maple. In the nonlinear dynamics I mentioned, Maple is the tool which draws the plots or solves the equations, and the students have to interpret this information. This approach probably won't work very well for introductory calculus or linear algebra however. Possibly one of the most overlooked uses of Maple in education is having the students write simple programs. Implementing an algorithm requires a deeper understanding than simply working through example problems one by one, and your computing students should appreciate the value of the excercise. It helps that Maple has a very elegant language which is very easy to learn. Even students with no programming background whatsoever have been able to pick it up within a week or so. I would suggest looking at the introductory programming guide for some guidance about how to teach Maple programming. Just remember to keep things very simple, and to only teach them what they are going to use. As for what to do, you mentioned logic, boolean algebra, combinatorics, linear algebra, and calculus. I would avoid having them program any algorithms for logic - it might serve as a good introduction to Maple though. You could have them write a loop to test a boolean expression on all possible inputs (ie: generate a truth table). It's a good place to introduce modular arithmetic in Maple as well. For combinatorics you could introduce recusion, and have them write a recursive program to solve a counting problem. Recursive programs are great for this because complicated conditions (such as forbidden configurations) can be tested quite easily, and you can halt processing when such a configuration occurs. Have the students put a print or lprint line in their program, so they can follow what the program is doing. For linear algebra I would shy away from using Maple at first. Algorithms like Gaussian elimination are probably too complicated for first year students to implement, and better suited to a numerical analysis class anyway. Gram-Schmidt orthogonalization is a good algorithm, but you may not get to it in your class. I would stick to pencil and paper for teaching and excercises. When it comes time to apply a tedious computation to do something else (ie: they know how to compute determinants, but now they must compute a characteristic polynomial to get eigenvalues) then Maple suddenly becomes useful again. For calculus, really, the same thing holds. There is a lot of money to be made by dreaming up new ways to teach students calculus, but for the most part pencil and paper is hard to beat. One place where Maple would be quite welcome is in teaching max/min problems. Normally for these problems one encounters the same old examples of polynomials whose derivatives factor trivially. With Maple the students could use fsolve to solve numerically for the roots. You could even give them a real world example, say from chemistry or biology, of some function coming out of a model which they would have to maximize or minimize, maybe with interpretations or consequences for the model. Plotting is also useful, once the students have learned to sketch graphs by hand. I think I've said enough for now so I'll stop here, but in all of my examples the emphasis is on using the computer as a tool - to go beyond what is possible using only pencil and paper. I don't know that computers can be used to teach basic math concepts effectively, but for intermediate problems they are invaluable. They make short work of the basic steps which the student already knows. They allow you to consider more interesting problems which would be too tedious to do by hand. In both of these cases the student has to understand the topic already and the computer is the final test of how far they can apply their knowledge. Not everybody will be able to do it, and that is why I recommend the standard pencil and paper examples. I would make the computer problems 20-40% of the overall assignment, no more. That being said, I think the students would get a lot out of it, and they would better appreciate such a powerful tool as opposed to feeling burdened by it.
I really like these cards. Well done!
I'd like to add a few comments that didn't fit in the main post. This code is still being optimized and developed. I'm forced to use dense matrices, which increases the memory usage by over a factor of ten. There are other issues that I won't get into here, but the point is that this code is not a final implementation, and I expect it to improve in the future. I have a few people to thank as well: Frédéric Chyzak for all his help with non-commutative algebras, and Joe Riel for his sorting trick, which eliminated two bottlenecks in the code.
> How many monomials do you have to sort? 1-2 thousand, in a loop :) This is a program I have been optimizing for quite some time. Your tip gave a notable improvement, and now I think I should release the program. I am indebted to you for this great technique, and you are credited in the source code. > Is there a similar method for making any numeric quantity attributable? I have no idea. I think you would have to use evalf. Thanks again, Roman
It took me a while to realize just how useful this trick really is. If you want to sort integers you can write an integer n as SFloat(n,0). I think that has pretty low overhead. Needless to say, I am now using it to sort monomials by degree. It is substantially faster than accessing an element of a list. Thanks for the great technique.
Does anyone have a good reference for CAD ? Preferably a book or webpage with examples.
This is an old suggestion, but I'd like to strongly second it in the hopes that it gets implemented. One way is to allow the user to set the expiry time of the browser cookie (say, to 10 minutes, 1 hour, 1 day, 1 week, or never). I don't know if your software makes this easy. Another option is to set it to never expire, and let people log out when they have to. A compromise would be something like 24 hours.
I don't think it exists outside the company. It certainly wasn't available during the beta anyway.
Sloppy mistake on my part.
s3 := proc(n::integer, A::Array(datatype = float[8]), B::Array(datatype = float[8]))
  local k, j;
   for k from 2 to floor(sqrt(n)) do
     if A[k] = 0 then
       for j from k^2 to n by k do A[j] := 1 end do
     end if;
   end do;
   j := 1;
   for k from 2 to n do
     if A[k] = 0 then B[j] := k; j := j + 1 end if
   end do
end proc:

n := 10^6;
A := rtable(1..n,datatype=float[8]): 
B := rtable(1..numtheory[pi](n),datatype=float[8]):

time(evalhf(s3(n,A,B)));
How does this compare to Compiler:-Compile ?
I really like your routine, and I'd like to suggest two improvements 1) The multiplication A[j*k] can be replaced by an add. Because each iteration requires only a memory access, the index arithmetic is significant. Here is a rewritten first loop:
for k from 2 to floor(sqrt(n)) do
  if A[k] = 0 then
    for j from 2*k to n by k do A[j] := 1 end do
  end if
end do;
2) Except for isqrt, you can run this procedure in evalhf. This is not nearly as fast as a compiled procedure, but it is pretty good and you can run it in older versions of Maple. Here is my code:
s2 := proc(n::integer[4], A::Array(datatype = integer[4]), B::Array(datatype = integer[4]))::integer[4];
  local k, j;
   for k from 2 to floor(sqrt(n)) do
     if A[k] = 0 then
       for j from 2*k to n by k do A[j] := 1 end do
     end if
   end do;
   j := 1;
   for k from 2 to n do
     if A[k] = 0 then B[j] := k; j := j + 1 end if
   end do
end proc:

n := 10^6;
A := rtable(1..n,datatype=integer[4]): 
B := rtable(1..numtheory[pi](n),datatype=integer[4]):
time(evalhf(s2(n,A,B)));
I don't have gcc installed at the moment, how does this compare ?
First 36 37 38 39 Page 38 of 39