Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3834/WEB-INF/maple/aim
Modified Files:
Int.mpl Matrix.mpl PartialFraction.mpl Subject.mpl Test.mpl
Util.mpl
Log Message:
Various minor improvements
Index: Int.mpl
===================================================================
RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Int.mpl,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Int.mpl 1 Sep 2003 20:22:23 -0000 1.4
--- Int.mpl 10 Mar 2004 02:06:53 -0000 1.5
***************
*** 136,140 ****
local q,argtype,ans,diffans,rightans,integrand,var,subsvars,varstr,
! feedback,note,mark,t,val,intconst,u,base,expt,newvar,ns;
if type(a,`aim/Question/Attempt`) then
--- 136,141 ----
local q,argtype,ans,diffans,rightans,integrand,var,subsvars,varstr,
! feedback,note,mark,t,val,intconst,u,base,expt,newvar,ns,
! err,differr;
if type(a,`aim/Question/Attempt`) then
***************
*** 165,169 ****
note := "";
! diffans := traperror(simplify(simplifyabs(diff(ans,var))));
t := `aim/CheckVars`(ans, integrand);
--- 166,175 ----
note := "";
! err := traperror(simplify(`aim/HypToExp`(ans - rightans),symbolic));
! err := traperror(simplify(simplifyabs(diff(err,var)),symbolic));
! diffans := traperror(simplify(simplifyabs(diff(ans,var)),symbolic));
! differr :=
! traperror(expand(simplify(`aim/HypToExp`(diffans - integrand),symbolic)));
!
t := `aim/CheckVars`(ans, integrand);
***************
*** 181,188 ****
# you give Maple. simplifyabs here takes care of examples like int(1/u, u)
# where the student gives the answer: ln(abs(u)) + C
! elif traperror(simplify(simplifyabs(diff(simplify(ans - rightans))))) = 0 or
! traperror(expand(simplify(diffans - integrand))) = 0 or
! traperror(expand(simplify(diffans - integrand), assume = positive)) = 0
! then
feedback := "";
note := "";
--- 187,191 ----
# you give Maple. simplifyabs here takes care of examples like int(1/u, u)
# where the student gives the answer: ln(abs(u)) + C
! elif err = 0 or differr = 0 then
feedback := "";
note := "";
Index: Matrix.mpl
===================================================================
RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Matrix.mpl,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Matrix.mpl 9 Jan 2004 08:19:20 -0000 1.4
--- Matrix.mpl 10 Mar 2004 02:06:53 -0000 1.5
***************
*** 81,85 ****
local A;
! A := evalm(a);
if type(A,vector) then
--- 81,85 ----
local A;
! A := evalm(eval(a));
if type(A,vector) then
Index: PartialFraction.mpl
===================================================================
RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/PartialFraction.mpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PartialFraction.mpl 10 Oct 2003 09:49:31 -0000 1.1
--- PartialFraction.mpl 10 Mar 2004 02:06:53 -0000 1.2
***************
*** 590,594 ****
bad := false;
if type(t,complexcons) then
! a := infinity; n := 0; c := 1;
else
if type(t,`*`) then
--- 590,594 ----
bad := false;
if type(t,complexcons) then
! a := infinity; n := 0; c := t;
else
if type(t,`*`) then
***************
*** 735,739 ****
extrapoles := {op(t['Poles'])} minus {op(Q['Poles'])};
missingpoles := {op(Q['Poles'])} minus {op(t['Poles'])};
! if extrapoles <> {} then
attempt['AddAnswerNote',__("Extra poles")];
polestring :=
--- 735,744 ----
extrapoles := {op(t['Poles'])} minus {op(Q['Poles'])};
missingpoles := {op(Q['Poles'])} minus {op(t['Poles'])};
! if extrapoles = {infinity} then
! attempt['AddAnswerNote',__("Extra pole at infinity")];
! attempt['AddFeedback',
! sprintf(__("Your answer involves a constant term or a positive power of %s, which should not be there; you should only have terms of the form (%s-a)<sup>-n</sup>."),xx,xx)];
! return([0,attempt['Feedback'],attempt['AnswerNote']]);
! elif extrapoles <> {} then
attempt['AddAnswerNote',__("Extra poles")];
polestring :=
***************
*** 747,751 ****
return([0,attempt['Feedback'],attempt['AnswerNote']]);
fi;
! if missingpoles <> {} then
attempt['AddAnswerNote',__("Missing poles")];
polestring :=
--- 752,762 ----
return([0,attempt['Feedback'],attempt['AnswerNote']]);
fi;
! if missingpoles = {infinity} then
! attempt['AddAnswerNote',__("Missing pole at infinity")];
! attempt['AddFeedback',
! sprintf(__("Your answer is missing some terms. As well as terms of the form (%s-a)<sup>-n</sup>, you also need a constant term or some powers of %s."),xx,xx)
! ];
! return([0,attempt['Feedback'],attempt['AnswerNote']]);
! elif missingpoles <> {} then
attempt['AddAnswerNote',__("Missing poles")];
polestring :=
***************
*** 758,766 ****
for p in Q['Poles'] do
if Q['PoleOrder',p] <> t['PoleOrder',p] then
! attempt['AddAnswerNote',__("Wrong orders")];
! attempt['AddFeedback',
! __("Your answer has poles in the right places, but some or all of the poles have the wrong order, so you must have found the wrong general form for the partial fraction decomposition.")
! ];
! return([0,attempt['Feedback'],attempt['AnswerNote']]);
fi;
od;
--- 769,785 ----
for p in Q['Poles'] do
if Q['PoleOrder',p] <> t['PoleOrder',p] then
! if p = infinity then
! attempt['AddAnswerNote',__("Wrong order at infinity")];
! attempt['AddFeedback',
! sprintf(__("Your answer has the wrong order at infinity. In other words, you have the wrong number of terms of the form %s<sup>k</sup>."),xx)
! ];
! return([0,attempt['Feedback'],attempt['AnswerNote']]);
! else
! attempt['AddAnswerNote',__("Wrong orders")];
! attempt['AddFeedback',
! __("Your answer has poles in the right places, but some or all of the poles have the wrong order, so you must have found the wrong general form for the partial fraction decomposition.")
! ];
! return([0,attempt['Feedback'],attempt['AnswerNote']]);
! fi;
fi;
od;
Index: Subject.mpl
===================================================================
RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Subject.mpl,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Subject.mpl 19 Sep 2003 13:04:47 -0000 1.4
--- Subject.mpl 10 Mar 2004 02:06:53 -0000 1.5
***************
*** 760,764 ****
if type([h],[`aim/Quiz/History`]) then
marks[quiz['Name']] := h['TotalMarkCode'];
! key := max(key,h['TotalMarkKey']);
total := total + h['TotalMark'] * quiz['Weight'];
else
--- 760,764 ----
if type([h],[`aim/Quiz/History`]) then
marks[quiz['Name']] := h['TotalMarkCode'];
! key := min(0,max(key,h['TotalMarkKey']));
total := total + h['TotalMark'] * quiz['Weight'];
else
Index: Test.mpl
===================================================================
RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Test.mpl,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Test.mpl 2 Nov 2003 01:30:39 -0000 1.7
--- Test.mpl 10 Mar 2004 02:06:54 -0000 1.8
***************
*** 85,95 ****
"Return @true@ if Maple can simplify @ans - rightans@ to zero.",
proc(ans::anything,rightans::anything)
! evalb(
! traperror(evalb(
! simplify(expand(evalm(ans - rightans)),
! symbolic
! ) = 0
! )) = true
! );
end
):
--- 85,98 ----
"Return @true@ if Maple can simplify @ans - rightans@ to zero.",
proc(ans::anything,rightans::anything)
! local err,ret;
! try
! err := ans - rightans;
! err := `aim/HypToExp`(err);
! err := simplify(expand(evalm(err)),symbolic);
! ret := evalb(evalb(err = 0) = true);
! return(ret);
! catch:
! return(false);
! end try;
end
):
Index: Util.mpl
===================================================================
RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Util.mpl,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Util.mpl 25 Sep 2003 19:01:15 -0000 1.6
--- Util.mpl 10 Mar 2004 02:06:54 -0000 1.7
***************
*** 531,533 ****
--- 531,552 ----
# END KM
+
+ `Package/Assign`(
+ `aim/HypToExp`,
+ "Converts hyperbolic functions to exponentials, eg cosh(x) becomes
+ (exp(x) + exp(-x))/2. This is needed because for some reason,
+ Maple will not simplify 2*cosh(x) - exp(x) - exp(-x) to zero.
+ ",
+ proc(t)
+ eval(subs(
+ sinh = ((x) -> (exp(x) - exp(-x))/2),
+ cosh = ((x) -> (exp(x) + exp(-x))/2),
+ tanh = ((x) -> (exp(x) - exp(-x))/(exp(x) + exp(-x))),
+ csch = ((x) -> 2/(exp(x) - exp(-x))),
+ sech = ((x) -> 2/(exp(x) + exp(-x))),
+ coth = ((x) -> (exp(x) + exp(-x))/(exp(x) - exp(-x))),
+ t));
+ end
+ ):
+
EndPackage():
|