roman_pearce

Mr. Roman Pearce

1683 Reputation

19 Badges

19 years, 299 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 answers submitted by roman_pearce

Try the dismantle command.
Maple orders various things by machine address, which is basically random. For example, the elements of a set are pointers to the objects residing somewhere in memory, and the set is sorted by machine address. This non-determinism infects various programs through commands like indets, which returns a set of indeterminants. You will get the indeterminants in a different order each time, leading some commands to behave non-deterministically. A lot of people are bothered by this aspect of Maple when they first encounter it, but it's one of those things you have to live with if you don't want to always specify the domain for computations. For example, if I enter a polynomial in {x,y} and ask for the variables, should Maple return {x,y} or {y,x} ? If you try to impose a consistent order then it is quite likely you will run into situations where your order is very bad. It is also likely you will have situations where the global order obscures the need for a program to order its variables. The program will run fine until someone changes the global order and then it will run terrible. However you need some kind of order to make the underlying algorithms efficient. For example, set membership tests use a binary search, and set intersection is linear time. Maple's random order is basically a compromise. It makes the algorithms fast and you don't have to explicitly order everything.
Maple doesn't have an implementation of cylindrical algebraic decomposition, which is how Mathematica solves systems of polynomial inequalities and eliminates quantifiers. I would argue that it needs something for this, although there may be a better algorithm than CAD for Maple. For polynomial equations and inequations Maple will use resultants or Groebner basis methods, although solve is not as efficient as it could be for those problems. That's basically my fault, although in my defense it is very hard to modify solve and not break lots of things in Maple.
In previous versions of Maple the zoom ratio would affect both the display and the printed output, however in current versions of Maple it only affects the display. This is a design flaw, IMO, since there is now no practical way to do what you want. You might try printing in landscape mode. Or under print setup you can change the dimensions of the paper and print to a pdf (Windows requires an additional driver to do this, such as PDFCreator, which is free), then scale the pdf to print. Keep in mind that you will be scaling text or printing in landscape mode, since most printers are not as wide as your screen.
There is actually a command that does this, try plots[matrixplot](A);
Uninstall and reinstall Maple. The files it installed initially will have the future timestamp, and this is probably what is causing the error.
The easiest way to do this is to make u,g,f,h,t functions and then use the differentiation operator. For example:
u := x -> 8/10*x;
u(x); # gives 8/10*x
u(2); # gives 8/5

du := D(u);   # the function u'
du(x);        # u'(x) = 4/5 for all x
D(u)(x)       # another way to get u'(x)

ddu := D(du); # the function u''
D(D(u))(x);   # another way to get u''(x)
You could then enter all the functions and make the system of equations as follows:
u := x->8/10*x;
g := x->k*x^3;
f := x->a*x^2+b*x+c;
h := x->p*x^3+q*x^2+r*x+s;
t := -16/10*x+120;

eqns := {
g(0) = u(0),
D(g)(0) = D(u)(0),
...
};
It was at this point I stopped, because the second equation is 0 = 4/5. Anyways, assuming you can patch this up, use the solve command to solve the equations:
solve(eqns);
It won't give you anything here because there is no solution.
People who know Maple syntax usually switch the default input for worksheet mode to "Maple Input", ie: red letters. This is because with 2D math input you can not always easily tell what sequence of keystrokes produced a line of input. Fearing the worst, I just tried copying 2D Math input and pasting it into a text editor, however I got Maple input. Someone deserves a lot of credit for that.
What is that apostrophe in the first line ? It should be the symbol used for ''sin''(Pi) on the third and fourth line. What is happening is that the first two lines are producing a syntax error, the third line is correct but the error is produced anyway because Maple is still trying to make sense of the previous line, and the fourth line is correct. Change all the apostrophes to ' and it will work.
Maple 11 looks great on Linux, it's hard to go back to Maple 10. screenshot
Factor one polynomial over the algebraic extension defined by the other. Example:
P := 256*x^8+128*x^7-448*x^6-192*x^5+240*x^4+80*x^3-40*x^2-8*x+1;    
Q := x^8-36*x^7+210*x^6-462*x^5+495*x^4-286*x^3+91*x^2-15*x+1;
factor(P, RootOf(Q,x));
If you get linear factors (and the polynomials are the same degree obviously) then the extensions are equivalent. The factors also tell you the different ways to map one extension field into the other.
The zip command processes two arrays, matrices, or lists, and outputs a third object whose entries c[i,j] are a function of the input a[i,j] and b[i,j]. For example:
A := [1, 3, 0, 1, 0];
B := [0, 2, 0, 2, 1, 4];
zip(proc(a,b) `if`(a=0, b, a) end proc, A, B);
# returns [1, 3, 0, 1, 1]
Notice that the list in truncated to the length of the smaller input. An optional 4th argument specifies a default value that is used in place of any missing elements.
A := [1, 3, 0, 1, 0];
B := [0, 2, 0, 2, 1, 4];
zip(proc(a,b) `if`(a=0, b, a) end proc, A, B, 3);
# returns [1, 3, 0, 1, 1, 3], A[6] is taken to be 3
zip(proc(a,b) `if`(a=0, b, a) end proc, A, B, 0);
# returns [1, 3, 0, 1, 1, 4], A[6] is taken to be 0
The zip command works with matrices as well. This might be what you want.
A := Matrix([[1,0],[0,3]]);
B := Matrix([[2,1],[4,3]]);
foo := proc(a,b)
  if a=b then 0
  elif a <> 0 then a
  else b;
  end if;
end proc;
C := zip(foo, A, B);
Is the matrix sparse ? Say, with more than 80% zero ?
It's all the same product, with only different marketing.
One way to solve systems with inequations (a_1*b_2 - b_1*a_2 <> 0) is to introduce a new variable Z and the polynomial (a_1*b_2 - b_1*a_2)*Z-1. For your example: sys := {a_1^2*alpha+a_2^2*beta=a_1, 2*a_1*a_2*alpha+a_2^2*gamma=a_2, a_1*b_1*alpha+a_2*b_2*beta=b_1, a_1*b_2*alpha+a_2*b_1*alpha+a_2*b_2*gamma=b_2, b_1^2*alpha+b_2^2*beta=a_1+b_1, 2*b_1*b_2*alpha+b_2^2*gamma=a_2+b_2, (a_1*b_2-b_1*a_2)*Z-1}: vars := {a_1,a_2,b_1,b_2,Z}: sols := solve(sys, vars); Note that Maple thinks gamma is Euler's constant (0.5772156649...).
First 10 11 12 13 14 15 16 Page 12 of 19