Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim
In directory sc8-pr-cvs1:/tmp/cvs-serv16994/WEB-INF/maple/aim
Added Files:
Calc.mpl
Log Message:
New package aim/Calc for automatic generation of Calculus Examples, see http://maths-physics.org.uk/aiminfo/mod/forum/discuss.php?d=35
--- NEW FILE: Calc.mpl ---
read("Package.mpl"):
Package("aim/Diff","
This package provides a number of useful functions for use in
differentiation questions.
"
):
######################################################################
`Package/Assign`(
`aim/Calc/MakeSoln`::`list`,
"Expects a calc problem involving either a @Diff@, @Int@, or @Limit@.
Returns a list with two elements. The first is a list of hints for
the problem. The second is a list of the intermediate steps in the
problem. This uses Maple's @Student[Calculus1]@ package.
",
proc(prob)
local hintlist, steplist, hint, step;
step:=prob;
steplist:=[prob];
hint:=Student[Calculus1][Hint](step);
if nops([hint])>1 then hint:=hint[1]; fi;
hintlist:=[hint];
while hintlist[nops(hintlist)]<>[] do
step:=Student[Calculus1][Rule][hintlist[nops(hintlist)]](step);
steplist:=[op(steplist), rhs(step)];
hint:=Student[Calculus1][Hint](step);
if nops([hint])>1 then hint:=hint[1]; fi;
hintlist:=[op(hintlist), hint];
od;
return([hintlist,steplist]);
end
):
######################################################################
`Package/Assign`(
`aim/Calc/Soln`::`string`,
"Uses the @aim/Calc/MakeSoln@ procedure to generate a solution to a @Diff@,
@Int@, or @Limit@ problem, then returns a string of tex code to
format the solution.
",
proc(prob)
local Soln,Output,i;
Soln:=`aim/Calc/MakeSoln`(prob);
Output:=cat("\\begin{eqnarray*}\n", `aim/LaTeX`(Soln[2,1]), "=& ", `aim/LaTeX`(Soln[2,2]),
" & ", `aim/LaTeX`(Soln[1,1]), "\\\\ \n");
if nops(Soln[2])>2 then
for i from 3 to nops(Soln[2]) do
Output:=cat(Output, "=& ", `aim/LaTeX`(Soln[2,i]), " & ", `aim/LaTeX`(Soln[1,i-1]), "\\\\ \n");
od;
fi;
Output:=cat(Output,"\\end{eqnarray*}");
return(Output);
end
):
######################################################################
EndPackage():
|