Mr. Roman Pearce

## 1678 Reputation

18 years, 311 days
CECM/SFU
Research Associate

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

## spam suggestions...

It's just spam. It looks like someone has a script that creates new users and posts crap on the site. It's nothing special, every site has to deal with this. I offer the following suggestions for a future revision of Mapleprimes: - avoid imposing onerous rules on new posters, as this is always the wrong way to go - make it easier and more efficient to flag mass postings, for example, in the index for each forum: http://www.mapleprimes.com/mapleprimesforums/gethelp/howdoimaple - when posts are flagged by two or more users with good reputations (100+ points?) hide them and block the originating ip address until an administrator can review it (within a day or two).

## nothing...

I wouldn't bet anything because the probability of getting cheated goes up with the stakes.  Bringing \$20000 to a gambling parlour is a good way to lose \$20000.

## workaround...

I didn't see how to do this using any of the standard Maple commands. Here's a short program:
```simp := proc(f) local F,R,M,V, f1;
F,R,M,V := Groebner:-SubstituteRootOfs(f);
f1 := normal(subs(F,f));
subs(R, simplify(f1, M, indets(f1)));
end proc:

f := -(1/12)*(-g*vb-g+z*g-g^(2/3)*z+g^(2/3)*vb)*(g^(1/3)+1)^5/g^(2/3);
simp(f);
```

## Below is some input in Maple...

Below is some input in Maple syntax. The expand function multiplies everything out.
```eqn := (a+b)^2;
eqn2 := expand(eqn);
```
Now suppose you want to plug in some values for a and b.
```eval(eqn2, {a=2, b=3});
```

## nops...

The nops command will tell you the number of elements in a list or a set.
```Thing:=[3,7,6,5];
nops(Thing);  # returns 4
```
In your second question, you should avoid using a list for Left and use a hash table instead. In Maple lists are immutable arrays, so whenever you change an element it makes a copy of the whole list. You might try something like this:
```ListThing:=[{3,7,6,5},{2,4,6,5},{1,3,5,7}];
Left := table();  # empty table
for j from 1 to nops(ListThing) do
if j=1 then
Left := ListThing;
else if j > 1 then
Left[j] := ListThing[j-1] minus ???;
end if;
end do:

# make a list at the end
Left := [seq(Left[i], i=1..nops(ListThing))];
```
A couple of observations. To use union, intersection, and minus the objects should be sets instead of lists. Hence, {3,7,6,5} instead of [3,7,6,5] in ListThing. Also, you can pull the if statement out of the loop to make the code more efficient, as shown below. Finally, I wrote ??? in place of OtherSet[IndexingSet[j]] because I wasn't sure what that should be.
```ListThing:=[{3,7,6,5},{2,4,6,5},{1,3,5,7}];
Left := table();  # empty table
Left := ListThing;
for j from 2 to nops(ListThing) do
Left[j] := ListThing[j-1] minus ???;
end do:
```

## gnu screen...

You may also want to try the GNU screen command. If your connection times out your programs continue to run and you can log back in and reattach them whenever you want. Very useful program.

## ifactors...

If you're coding something you might want to use the ifactors command instead of ifactor.

## coeffs...

Assuming you mean: f := zin-z2*(z3*(z1*(zin+I*z1*tan(beta1*d1)) +I*z3*(tan(beta3*d3))*(z1+I*zin*tan(beta1*d1))) +I*z2*(tan(beta2*d2))*(z3*(z1+I*zin*tan(beta1*d1)) +I*z1*(zin+I*z1*tan(beta1*d1))*tan(beta3*d3)))/(z2*(z3*(z1 +I*zin*tan(beta1*d1))+I*z1*(zin+I*z1*tan(beta1*d1))*tan(beta3*d3)) +I*z3*(z1*(zin+I*z1*tan(beta1*d1))+I*z3*(tan(beta3*d3))*(z1 +I*zin*tan(beta1*d1)))*tan(beta2*d2)); It's a rational expression in zin, not a polynomial. You can get the coefficients of the numerator and denominator separately: C := [coeffs(expand(numer(f)), zin, 'm')]; M := [m]; C := [coeffs(expand(denom(f)), zin, 'm')]; M := [m];

## progress bar...

There's no way to implement a progress bar in general, unless it is known in advance what a computation will do. For example, when solving a linear system you could reasonably estimate the time it might take, but that might be only one step in a more complicated algorithm, where the size of the linear system is not known or can not be estimated at the beginning. In short, you could do it for simple computations. But many algorithms in Maple do a large number of those.

Profiling tools generally count CPU seconds, which means they add the times from all the CPUs that you use. It is not uncommon for parallel algorithms to use more CPU time in total, due to extra overhead like communication or resource contention.

## no...

Maple can not compute Groebner bases over rings in general.

## plug in values...

Plugging in values is probably the fastest way because then the coefficients will be numbers instead of polynomials. You can write a loop as follows. Suppose I have some values for K1, K2, and K3 in lists. You can construct all substitutions as shown below:
```K1vals := [1,2,3,4,5]:
K2vals := [6,7,8,9,10]:
K3vals := [11,12,13,14,15]:
S := {seq(seq(seq({K1=i, K2=j, K3=k}, i=K1vals), j=K2vals), k=K3vals)}:
```
Then for each set, plug in the values and solve the system:
```sys := {a2+a3+a5+a6-1, 2*a1+2*a4+4*a5-1.6-2*0.2,
a2+2*a3+a4-0.77-0.2, K2*a2*a4-(a1*a3), K3*a4*a6-(a1*a2),
(K1*((a1+a2+a3+a4+a5+a6)^2/4)*(a5*a6))-(a1^3*a2)}:
sols := {seq(fsolve(subs(i,sys)) union i, i=S)};
```
Note that I am using fsolve to get numerical solutions. It only finds one solution per set but, but it is possible to find all of them using RootFinding:-Isolate (Maple 11 and up).
```sols := {seq(
seq([op(i),op(j)], j=RootFinding:-Isolate(subs(i,sys),[a1,a2,a3,a4,a5,a6])),
i=S)};
```
Also note, Maple has more powerful methods for solving parametric systems like this. Perhaps someone more knowledgeable would like to comment ?

## normal...

It doesn't look like any coefficients are 1. Try normal(eqn) or normal(eqn,'expanded');

## fixed...

sys := {a*a,a*a,a*a,a*a,a*a,a*a,a*a, a*a=a*a,a*a=-a*a,a^2=a*a+a*a, a*a+a*a=a*a-a*a,a^2+a*a=-a*a, a*a=a^2-a*a,a*a+a*a=a*a-a*a, a^2-a*a=a*a,b*b,b*b,b*b,b*b, b*b,b*b,b*b,b*b=b*b,b*b=-b*b, b^2=b*b+b*b,b*b+b*b=b*b-b*b, b^2+b*b=-b*b,b*b=b^2-b*b, b*b+b*b=b*b-b*b,b^2-b*b=b*b, a*b+b^2=a*b,a*b+b*b=a*b-b*b, a*b+b*b=a*b-b*b,b*b=a*b-b*b, a*b+b*b=a*b-b*b,a*b=a*b-b*b, a*b+b^2=a*b,a*b=b*b,a*b=-b*b, b*b+b^2=a*b+a*b,a*b+b*b=a*b, b*b+b*b=a*b+a*b,a*b+b*b=-b*b, a*b=a*b-b*b,a*b+b*b=a*b-b*b, a*b+b*b=a*b-b^2,a*b,a*b,a*b, a*b,a*b,a*b,a*b,a*b, a*b+a*b=a*b-a*b,a*b+a*b=a*b-a*b, a*b+a*b=a*b+a*b,a*b+a*b=a*b+a*b, a*b+a*b=a*b-a*b,a*b+a*b=a*b-a*b, a*b+a*b=a*b+a*b,a*b+a*b=a*b+a*b, a^2+a*b=-a*b,a*a+a*b=a*a-a*b,a*a=-a*b, a*b=a^2-a*b,a*a+a*b=a*a-a*b, a*b=a*a-a*b,a*a+a*b=a*a,a*b=a*a-a*b, a*a+a*b=-a*b,a*a=a*a-a*b,a*a+a*b=-a*b, a*a+a*b=a*a-a*b,a^2+a*b=-a*b,a*a=a*b, a*a+a*b=a*a-a*b,a*b=a^2-a*b}: vars := {a,a,a,a,a,a,a,a,b,b,b,b,b,b,b,b}: sys := map(proc(a) `if`(type(a,equation),rhs(a)-lhs(a),a) end,sys): solve(sys,vars);

## lists and op...

The op command will give you the sequence of elements in a list or set. Then, make a new list: ``` a := [[1,2],[3,4]]; b := [[5,6],[7,8],[9,10]]; c := [op(a), op(b)]; ```
﻿