Mr. Roman Pearce

1673 Reputation

19 Badges

17 years, 266 days
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

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: - 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).

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.

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);
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});
The nops command will tell you the number of elements in a list or a set.
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:
Left := table();  # empty table
for j from 1 to nops(ListThing) do
  if j=1 then
    Left[1] := ListThing[1];
  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.
Left := table();  # empty table
Left[1] := ListThing[1];
for j from 2 to nops(ListThing) do
  Left[j] := ListThing[j-1] minus ???;
end do:
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.

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

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];

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.
Maple can not compute Groebner bases over rings in general.
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),
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])),
Also note, Maple has more powerful methods for solving parametric systems like this. Perhaps someone more knowledgeable would like to comment ?
It doesn't look like any coefficients are 1. Try normal(eqn) or normal(eqn,'expanded');
sys := {a[12]*a[21],a[12]*a[31],a[21]*a[22],a[12]*a[41],a[31]*a[32],a[22]*a[41],a[32]*a[41], a[12]*a[22]=a[12]*a[32],a[21]*a[41]=-a[31]*a[41],a[22]^2=a[11]*a[22]+a[12]*a[42], a[11]*a[21]+a[11]*a[31]=a[22]*a[31]-a[21]*a[32],a[21]^2+a[11]*a[41]=-a[21]*a[42], a[11]*a[32]=a[32]^2-a[12]*a[42],a[22]*a[31]+a[21]*a[32]=a[32]*a[42]-a[22]*a[42], a[31]^2-a[11]*a[41]=a[31]*a[42],b[12]*b[21],b[12]*b[31],b[21]*b[22],b[12]*b[41], b[31]*b[32],b[22]*b[41],b[32]*b[41],b[12]*b[22]=b[12]*b[32],b[21]*b[41]=-b[31]*b[41], b[22]^2=b[11]*b[22]+b[12]*b[42],b[11]*b[21]+b[11]*b[31]=b[22]*b[31]-b[21]*b[32], b[21]^2+b[11]*b[41]=-b[21]*b[42],b[11]*b[32]=b[32]^2-b[12]*b[42], b[22]*b[31]+b[21]*b[32]=b[32]*b[42]-b[22]*b[42],b[31]^2-b[11]*b[41]=b[31]*b[42], a[11]*b[11]+b[11]^2=a[12]*b[21],a[11]*b[12]+b[11]*b[12]=a[12]*b[22]-b[11]*b[32], a[21]*b[11]+b[11]*b[21]=a[22]*b[21]-b[21]*b[41],b[11]*b[22]=a[22]*b[22]-b[12]*b[42], a[31]*b[11]+b[11]*b[21]=a[32]*b[21]-b[22]*b[31],a[31]*b[12]=a[32]*b[22]-b[22]*b[32], a[41]*b[11]+b[21]^2=a[42]*b[21],a[42]*b[22]=b[22]*b[42],a[11]*b[31]=-b[11]*b[31], b[12]*b[31]+b[32]^2=a[11]*b[32]+a[12]*b[42],a[21]*b[31]+b[21]*b[31]=a[22]*b[41], b[22]*b[31]+b[32]*b[42]=a[21]*b[32]+a[22]*b[42],a[31]*b[31]+b[11]*b[41]=-b[31]*b[42], a[31]*b[32]=a[32]*b[42]-b[32]*b[42],a[41]*b[31]+b[21]*b[41]=a[42]*b[41]-b[41]*b[42], a[41]*b[32]+b[22]*b[41]=a[42]*b[42]-b[42]^2,a[21]*b[12],a[12]*b[31],a[21]*b[22], a[12]*b[41],a[41]*b[12],a[32]*b[31],a[41]*b[22],a[32]*b[41], a[12]*b[11]+a[11]*b[12]=a[22]*b[12]-a[12]*b[32],a[12]*b[21]+a[11]*b[22]=a[22]*b[22]-a[12]*b[42], a[21]*b[11]+a[22]*b[31]=a[11]*b[31]+a[21]*b[32],a[21]*b[21]+a[22]*b[41]=a[11]*b[41]+a[21]*b[42], a[32]*b[11]+a[13]*b[12]=a[42]*b[12]-a[32]*b[32],a[32]*b[21]+a[31]*b[22]=a[42]*b[22]-a[32]*b[42], a[41]*b[11]+a[42]*b[31]=a[31]*b[31]+a[41]*b[32],a[41]*b[21]+a[42]*b[41]=a[31]*b[41]+a[41]*b[42], a[11]^2+a[11]*b[11]=-a[31]*b[12],a[11]*a[12]+a[21]*b[11]=a[12]*a[22]-a[32]*b[12],a[11]*a[21]=-a[21]*b[11], a[22]*b[11]=a[22]^2-a[42]*b[12],a[11]*a[31]+a[11]*b[21]=a[21]*a[32]-a[31]*b[22], a[12]*b[21]=a[22]*a[32]-a[32]*b[22],a[11]*a[41]+a[21]*b[21]=a[21]*a[42],a[22]*b[21]=a[22]*a[42]-a[42]*b[22], a[11]*a[31]+a[11]*b[31]=-a[31]*b[32],a[11]*a[32]=a[12]*a[42]-a[32]*b[32],a[21]*a[31]+a[21]*b[31]=-a[41]*b[32], a[21]*a[32]+a[22]*b[31]=a[22]*a[42]-a[42]*b[32],a[31]^2+a[11]*b[41]=-a[31]*b[42],a[32]*a[42]=a[32]*b[42], a[31]*a[41]+a[21]*b[41]=a[41]*a[42]-a[41]*b[42],a[22]*b[41]=a[42]^2-a[42]*b[42]}: vars := {a[11],a[12],a[21],a[22],a[31],a[32],a[41],a[42],b[11],b[12],b[21],b[22],b[31],b[32],b[41],b[42]}: sys := map(proc(a) `if`(type(a,equation),rhs(a)-lhs(a),a) end,sys): solve(sys,vars);
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)];
First 7 8 9 10 11 12 13 Last Page 9 of 19