From: Chris S. <san...@us...> - 2005-09-12 08:07:55
|
Update of /cvsroot/stack/stack-1-0/scripts/maxima In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26368/scripts/maxima Modified Files: complexj.lisp stackmaxima.mac Log Message: Index: stackmaxima.mac =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/maxima/stackmaxima.mac,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** stackmaxima.mac 1 Sep 2005 09:14:50 -0000 1.31 --- stackmaxima.mac 12 Sep 2005 08:07:47 -0000 1.32 *************** *** 80,85 **** load("stacktex.lisp"); /* Loads LaTeX adaptions and preferences */ ! complexj:TRUE; ! if complexj then (j:%i,load("complexj.lisp")) else i:%i; /* Makes a complex j if needed */ /* ARRGH! */ --- 80,85 ---- load("stacktex.lisp"); /* Loads LaTeX adaptions and preferences */ ! /* Makes a complex j if needed */ ! make_complexJ(OPT_COMPLEXJ) := if OPT_COMPLEXJ=j then (j:%i,load("complexj.lisp")) else i:%i; /* ARRGH! */ *************** *** 201,204 **** --- 201,220 ---- RETURN(str) ); + + StackValidOb(val,note,fb):=BLOCK([str], + str:concat(" ValidationValid = [ ",val," ], ValidationNote = [ ",note," ], ValidationFeedBack= [ ",fb," ]"), + RETURN(str) + ); + + + /* ******************************************* */ + /* Validate an expression */ + /* ******************************************* */ + + stack_validate(ex) := BLOCK( + IF OPT_NoFloats AND anyfloatex(ex) THEN + RETURN(StackValidOb("false","Illegal_floats",StackAddFeedback("","Illegal_floats"))), + RETURN(StackValidOb("true","","")) + )$ /* ************************************/ *************** *** 221,226 **** if OPT_OUTPUT#"MathML" then ufn:CONCAT(" <html>",ufn,"</html> "), - - /* Removed on Windows: cd '",IMAGE_DIR,"' */ preamble:CONCAT("set key off set zeroaxis --- 237,240 ---- *************** *** 229,235 **** set output ",afn), set_plot_option([GNUPLOT_OUT_FILE,tfn]), ! set_plot_option([GNUPLOT_PREAMBLE, preamble]), if length(ra) = 1 then plot2d(ex,ra[1]), ! if length(ra) = 2 then plot2d(ex,ra[1],ra[2]), sysp:CONCAT(GNUPLOT_CMD," ",tfn), sysr:CONCAT(DEL_CMD," ",tfn), --- 243,249 ---- set output ",afn), set_plot_option([GNUPLOT_OUT_FILE,tfn]), ! set_plot_option([GNUPLOT_PREAMBLE, preamble]), if length(ra) = 1 then plot2d(ex,ra[1]), ! if length(ra) = 2 then plot2d(ex,ra[1],ra[2]), sysp:CONCAT(GNUPLOT_CMD," ",tfn), sysr:CONCAT(DEL_CMD," ",tfn), *************** *** 239,242 **** --- 253,295 ---- /* ********************************** */ + /* Analysis tests */ + /* ********************************** */ + + /* This determines if an expression is continuous + ex the expression, + v the variable, + xp the point at which to evaluate. */ + continuousp(ex,v,xp) := BLOCK([lp,lm], + lp: limit(ex,v,xp,MINUS), + lm: limit(ex,v,xp,PLUS), + /* print(lp), print(lm), */ + IF lp # UND + AND lm # UND + AND lp # IND + AND lm # IND + AND lp # INF + AND lm # INF + AND lp # MINF + AND lm # MINF + AND lp = lm + THEN TRUE ELSE FALSE + )$ + + + /* This determines if an expression is differentiable + ex the expression, + v the variable, + xp the point at which to evaluate, + n the number of times it is differentiated (optional). + */ + diffp(ex,[args]) := BLOCK([v,xp,n], + v:args[1], + xp:args[2], + n:1, + IF length(args)=3 THEN n:args[3], + RETURN(continuousp(diff(ex,v,n),v,xp)) + )$ + + /* ********************************** */ /* Algebraic tests */ /* ********************************** */ *************** *** 311,314 **** --- 364,381 ---- RETURN(ret) )$ + /* Decides is any floats are in the expression. */ + anyfloatex(ex) := BLOCK([PARTSWITCH,ret,kloop], + ret:FALSE, + IF floatnump(ex) THEN RETURN(TRUE), + IF atom(ex) THEN RETURN(FALSE), + PARTSWITCH:TRUE, + FOR kloop:1 WHILE PART(ex,kloop)#END DO + ret:ret OR anyfloatex(PART(ex,kloop)), + RETURN(ret) + )$ + + /* compare with*/ + /* coefl:map('first,rest(coeffs(SA,x))) */ + /* allinteger(l) returns true if all of the list are integers */ *************** *** 586,593 **** if errcatch(deg:degree(SA,v))=[] then RETURN(StackReturnOb("false","0","ATFacForm_error_degreeSA",StackAddFeedback("","ATFacForm_error_degreeSA"))), - /* Check all the coefficients are not floats */ - coefl:map('first,rest(coeffs(SA,x))), - if anyfloat(coefl) then - RETURN(StackReturnOb("false","0","ATFacForm_error_float",StackAddFeedback("","ATFacForm_error_float"))), aequiv:Stack_Test(SA,SB), /* An integer answe is always correct. */ --- 653,656 ---- *************** *** 647,650 **** --- 710,714 ---- ATPartFrac(SA,SBL) := BLOCK([NEGDISTRIB,val,rawmk,fb,ansnote,SB,v,quiet,facdum], NEGDISTRIB:FALSE, + /* Check for floats */ val:"", rawmk:1, fb:StackAddFeedback("","AT_NOTIMPLEMENTED"), ansnote:"", /* SBL is a list: the teacher's answer, the variable, and whether formative feedback is to be provided. */ Index: complexj.lisp =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/maxima/complexj.lisp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** complexj.lisp 25 Aug 2005 16:06:17 -0000 1.2 --- complexj.lisp 12 Sep 2005 08:07:47 -0000 1.3 *************** *** 7,8 **** --- 7,10 ---- (defprop $%i "j" texword) + + (defprop $%i "<mi>j</mi> " mathmlword) |