This code works fine in Maple. When transferred to TA, the $i on the index in the coef:= command line will not compile. TA thinks the $ is naming a constant. Any other ideas on how to double index within the solve(op commands?
with(powseries);
powcreate(Ys(n) = a[n]);
tpsform(Ys, x, 5);
dy:= powdiff(Ys);
ddy:= powdiff(dy);
c1 := powpoly($d1, x);
c2 := powpoly($d2, x);
tpsform(c1, x);
tpsform(c2, x);
slnp := powadd(multiply(ddy, c1), multiply(Ys, c2));
slnnp := tpsform(slnp, x, 6);
coef:=solve({(op(2*i+1,slnnp),$i = 0 .. 3)}, {(a[i],$i= 1 .. 6)});
soln := subs(coef, tpsform(Ys, x, 6));
solna := convert(soln, polynom);
gsoln := sort(collect(solna, {a[0], a[5]}), x, ascending);
par := solve(subs(x = $equals, {gsoln = $y, diff(gsoln, x) = $yprime}), {a[0], a[5]});
fsoln := sort(convert(subs(par, gsoln), polynom), x, ascending);
Thanks,
Linda
Two different uses of $
I think the problem is that MapleTA uses $ to mean one thing, while Maple itself also uses $ to mean something else entirely. In Maple $ is an older form of seq -- which is what is being used in your solve line.
If you rewrite your first solve line using seq twice, I am guessing that that should fix things.
There really ought to be warnings about this in the MapleTA documentation!
Maple TA help page
On Maple TA's help page for $, it states:
"The use of the $ is reserved for variable definitions in algorithms in the Maple T.A. question syntax."
Scott
More explict
It should also explicitly state that that means that Maple's own $ command is thus unusable in MapleTA, and that seq should be used instead. Also, it might be nice to change the Maple documentation for $ to state that if the user is using MapleTA, that this command is disabled.
MapleTA vs Maple usage clashes
The usage of $ is yet another example of a clash between MapleTA and Maple.
Here is a workaround for $ in a MapleTA algorithm:
$n=range(2,6);
$ex=maple("diff(cos(x),seq(x,i=1..$n))");
Here are other examples of a clash:
In MapleTA, do not set up a function like this:
$f=maple("x->x^2");
You get garbage. You need to use
$f=maple("proc(x) x^2 end"); or
$f=maple("unapply(x^2,x)");
although the -> usage was OK in MapleTA 1.** (The conversion cost me a few hours of menial editing.)
Always watch out for ">" usages. Sometimes it will get interpreted as an html tag, especially when used in the "name" field. Things get ever more surreal if you try to juggle this with LaTeX authoring conversion.
My mental image of all this is that MapleTA is built on top of some Brownstone learning base that is analogous to our reptilian brains, and so we need to get used to these inconsistencies, unless and until it is rebuilt.