Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim
In directory sc8-pr-cvs1:/tmp/cvs-serv6646
Modified Files:
Inert.mpl LaTeX.mpl SET.mpl
Log Message:
Changes to LaTeX routines to accomodate pdf output, Also minor typos and bug fixes.
Index: Inert.mpl
===================================================================
RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Inert.mpl,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Inert.mpl 8 Sep 2003 03:44:13 -0000 1.4
--- Inert.mpl 12 Sep 2003 03:16:07 -0000 1.5
***************
*** 28,32 ****
An InertExpr contains both its mathematical value and its LaTeX formatting.<br/><br/>
! The #TeX# command can be used to return the LaTeX formatting of an @InertExpr@ while the #Value# command can be used to obtain the mathematical value of an @InertExpr@. For example, @TeX(Sin(0))@ will return the string \"sin(0)\" while @Value(Sin(0))@ will return 0.<br/><br/>
The #Apply# command can also be used to treat either an @InertExpr@ or an ordinary Maple expression as a function. The first argument is treated as a function and applied to the remaining arguments as illustrated in the following exmaples:<br/><br/>
--- 28,32 ----
An InertExpr contains both its mathematical value and its LaTeX formatting.<br/><br/>
! The #TeX# command can be used to return the LaTeX formatting of an @InertExpr@ while the #Value# command can be used to obtain the mathematical value of an @InertExpr@. For example, @TeX(Sin(0))@ will return the string \"\\sin(0)\" while @Value(Sin(0))@ will return 0.<br/><br/>
The #Apply# command can also be used to treat either an @InertExpr@ or an ordinary Maple expression as a function. The first argument is treated as a function and applied to the remaining arguments as illustrated in the following exmaples:<br/><br/>
***************
*** 249,253 ****
RETURN("Wrong number of arguments")
fi;
! Values:=seq(`if`(type(NewArgs[j],InertExpr),NewArgs[j]['Value'],NewArgs[j]),j=1..n);
f:=F['Map'];
d:=F['Domain'];
--- 249,255 ----
RETURN("Wrong number of arguments")
fi;
! Values:=seq(`if`(type(NewArgs[j],InertExpr),
! eval(NewArgs[j])['Value'],
! eval(NewArgs)[j]),j=1..n);
f:=F['Map'];
d:=F['Domain'];
***************
*** 938,944 ****
proc(x) # TeX
if x=1 then
! "{\\boldmath e}"
else
! PercentStringToProc("{\\boldmath e}^{%1}")(x);
fi;
end,
--- 940,946 ----
proc(x) # TeX
if x=1 then
! "{\\it e}"
else
! PercentStringToProc("{\\it e}^{%1}")(x);
fi;
end,
***************
*** 962,966 ****
"The Inert exponential function.",
`new/Inert`( proc(x) ln(x) end, # Map
! "ln\\left(%1\\right)", # TeX
1, # Nargs
'algebraic', # Domain
--- 964,968 ----
"The Inert exponential function.",
`new/Inert`( proc(x) ln(x) end, # Map
! "\\ln\\left(%1\\right)", # TeX
1, # Nargs
'algebraic', # Domain
***************
*** 987,991 ****
"The Inert sine function.",
`new/Inert`( sin, # Map
! "sin(%1)", # TeX
1, # Nargs
'algebraic',# Domain
--- 989,993 ----
"The Inert sine function.",
`new/Inert`( sin, # Map
! "\\sin(%1)", # TeX
1, # Nargs
'algebraic',# Domain
***************
*** 1003,1007 ****
"The Inert cos function.",
`new/Inert`( cos, # Map
! "cos(%1)", # TeX
1, # Nargs
'algebraic',# Domain
--- 1005,1009 ----
"The Inert cos function.",
`new/Inert`( cos, # Map
! "\\cos(%1)", # TeX
1, # Nargs
'algebraic',# Domain
***************
*** 1019,1023 ****
"The Inert tan function.",
`new/Inert`( tan, # Map
! "tan(%1)", # TeX
1, # Nargs
proc(x::algebraic) # Domain
--- 1021,1025 ----
"The Inert tan function.",
`new/Inert`( tan, # Map
! "\\tan(%1)", # TeX
1, # Nargs
proc(x::algebraic) # Domain
***************
*** 1064,1079 ****
`Inert/Union`::Inert,
"The Inert Set function (represents a SET object).",
! `new/Inert`( proc() # Map FIX ME
! if type([args],list(SET)) then
! `SET/Union`(args)
! else
! `union`(args)
! fi
! end,
proc() # TeX
cat(TeX(args[1]),seq(cat("\\cup{}",TeX(args[i])),i=2..nargs))
end,
! 0, # Nargs
! 'anything', # Domain
"Union", # Name
true, # Needs parentheses
--- 1066,1075 ----
`Inert/Union`::Inert,
"The Inert Set function (represents a SET object).",
! `new/Inert`(`SET/Union`, # Map
proc() # TeX
cat(TeX(args[1]),seq(cat("\\cup{}",TeX(args[i])),i=2..nargs))
end,
! -1, # Nargs
! 'SET', # Domain
"Union", # Name
true, # Needs parentheses
Index: LaTeX.mpl
===================================================================
RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/LaTeX.mpl,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** LaTeX.mpl 10 Sep 2003 15:26:09 -0000 1.7
--- LaTeX.mpl 12 Sep 2003 03:16:07 -0000 1.8
***************
*** 24,74 ****
`Package/Dependencies` = ["Util"]:
! `Package/Assign`(
! `latex/latex/function`,
! "",
! proc(e)
! local `(`, `)`, `,`, texlist, lf, `{`, `}`,`\\,`;
! if 1 < nops(op(0, e)) or
! type(op(0, e), 'function') and op([0, 0], e) = '`@`' or
! type(op(0, e), {'`+`', '`*`'})
! then
! texlist := `latex/prinpar`(op(0, e))
! elif type(op(0, e), {'string', 'symbol'}) then
! lf := cat(`latex/`,op(0, e));
! if (eval(lf) <> eval(lf,1)) then
! RETURN(eval(cat(`latex/`,op(0, e))(op(e))));
! else
! texlist := `\\,`,`latex/print`(op(0, e));
! fi;
! else
! texlist := `\\,`,`latex/print`(op(0, e));
! fi;
! texlist, `latex/latex/commalist`([op(e)], `,`, `(`, `)`)
! end
! ):
! # KM
! `Package/Assign`(
! `latex/latex/symbol`,
! "",
! proc(QQ)
! local texlist, s,n,`{`, `}`, `\\_`;
! option system, remember;
! if assigned(`latex/special_names`[cat(``,QQ)]) then
! texlist := `latex/special_names`[cat(``,QQ)]
! elif member(QQ, eval(`latex/greek`, 1)) then
! texlist := `latex/latex/copy`(cat(`\\`,QQ))
! else
! texlist := `latex/latex/copy`(QQ);
! s := convert(texlist,string);
! if s <> "" and substring(s,1..1) = "&" then
! s := substring(s,2..-1);
! n := convert(s,name);
! texlist := `latex/latex/copy`(n);
! fi;
! fi;
! RETURN(texlist);
! end
! ):
`Package/Assign`(
--- 24,74 ----
`Package/Dependencies` = ["Util"]:
! #`Package/Assign`(
! # `latex/latex/function`,
! # "",
! # proc(e)
! # local `(`, `)`, `,`, texlist, lf, `{`, `}`,`\\,`;
! # if 1 < nops(op(0, e)) or
! # type(op(0, e), 'function') and op([0, 0], e) = '`@`' or
! # type(op(0, e), {'`+`', '`*`'})
! # then
! # texlist := `latex/prinpar`(op(0, e))
! # elif type(op(0, e), {'string', 'symbol'}) then
! # lf := cat(`latex/`,op(0, e));
! # if (eval(lf) <> eval(lf,1)) then
! # RETURN(eval(cat(`latex/`,op(0, e))(op(e))));
! # else
! # texlist := `\\,`,`latex/print`(op(0, e));
! # fi;
! # else
! # texlist := `\\,`,`latex/print`(op(0, e));
! # fi;
! # texlist, `latex/latex/commalist`([op(e)], `,`, `(`, `)`)
! # end
! #):
! ## KM
! #`Package/Assign`(
! # `latex/latex/symbol`,
! # "",
! # proc(QQ)
! # local texlist, s,n,`{`, `}`, `\\_`;
! # option system, remember;
! # if assigned(`latex/special_names`[cat(``,QQ)]) then
! # texlist := `latex/special_names`[cat(``,QQ)]
! # elif member(QQ, eval(`latex/greek`, 1)) then
! # texlist := `latex/latex/copy`(cat(`\\`,QQ))
! # else
! # texlist := `latex/latex/copy`(QQ);
! # s := convert(texlist,string);
! # if s <> "" and substring(s,1..1) = "&" then
! # s := substring(s,2..-1);
! # n := convert(s,name);
! # texlist := `latex/latex/copy`(n);
! # fi;
! # fi;
! # RETURN(texlist);
! # end
! #):
`Package/Assign`(
***************
*** 76,84 ****
"This function overrides the default Maple routine for
LaTeX'ing powers, to prevent doing conversions of expressions into
! various other forms and to handle the @exp@ function. We can use #InerExpr# objects to format as we desire.",
! proc (e::anything)
! local texlist,`[`,`\\frac `,`\\sqrt `,`]`,`{`,`}`;
!
! texlist := NULL;
# I don't ever want it to do any of this... I'll force it to simplify if I want it that way
# dist if type(op(2,e),'fraction') and abs(op([2, 1],e)) = 1
--- 76,124 ----
"This function overrides the default Maple routine for
LaTeX'ing powers, to prevent doing conversions of expressions into
! various other forms and to handle the @exp@ function.",
! proc(e)
! local texlist, `[`, `\\frac `, `\\sqrt `, `]`, `{`, `}`;
! option
! `Copyright (c) 1992 by the University of Waterloo. All rights reserved.`;
! texlist := NULL;
! # KM Prevent these ad hoc conversions...
! # KM only allow radicals for single digit numbers
! #
! # WAS: if type(op(2, e), 'fraction') and abs(op([2, 1], e)) = 1 and
! # WAS: abs(op([2, 2], e)) < 10 then
! # WAS: if op(2, e) < 0 then texlist := texlist, `{`, `\\frac `, `{`, 1,
! # WAS: `}`, `{`, `latex/print`(1/e), `}`, `}`
! # WAS: else
! # WAS: texlist := texlist, `\\sqrt `;
! # WAS: if op(2, e) <> 1/2 then
! # WAS: texlist := texlist, `[`, 1/op(2, e), `]`
! # WAS: end if;
! # WAS: texlist := texlist, `{`, `latex/print`(op(1, e)), `}`
! # WAS: end if
! if type(op(2, e),fraction) and op(2,e)=1/2 and
! type(op(1,e),integer) and 0<=op(1,e) and op(1,e)<10 then
! texlist := texlist, `\\sqrt `, `{`, `latex/print`(op(1, e)), `}`
! # END KM
! else
! if type(op(1, e), {
! 'function', '`+`', '`*`', 'fraction', '`^`', 'series', 'negative'})
! # KM
! and not op(1,e)=exp(1)
! # END KM
! then texlist := texlist, `latex/latex/prinpar`(op(1, e))
! elif type(op(1, e), 'nonreal') and not type(op(1, e), 'imaginary')
! then texlist := texlist, `latex/latex/prinpar`(op(1, e))
! else texlist := texlist, `{`, `latex/print`(op(1, e)), `}`
! fi;
! texlist := texlist, `^`, `{`, `latex/print`(op(2, e)), `}`
! fi;
! texlist
! end
! ):
!
! #proc (e::anything)
! # local texlist,`[`,`\\frac `,`\\sqrt `,`]`,`{`,`}`;
! #
! # texlist := NULL;
# I don't ever want it to do any of this... I'll force it to simplify if I want it that way
# dist if type(op(2,e),'fraction') and abs(op([2, 1],e)) = 1
***************
*** 88,120 ****
# dist texlist := `\\sqrt `,`{`,`latex/print`(op(1,e)),`}`;
# dist else
! if type(op(1,e),{'`+`','`*`','`^`','function','series','fraction','negative'})
! # KM
! and not op(1,e)=exp(1)
! # END KM
! then
! texlist:=texlist,`latex/latex/prinpar`(op(1,e))
! else
! texlist:=texlist,`{`,`latex/print`(op(1,e)),`}`
! fi;
! texlist:=texlist,`^`,`{`,`latex/print`(op(2,e)),`}`;
! # KM
! # dist fi;
! # END KM
! texlist
! end
! ):
# KM
`Package/Assign`(
`latex/exp`::string,
! "This is a replacement for the @`latex/exp`@ command which works exactly the same, except that it boldmath's the e.
",
proc()
! local e, `{`, `}`;
! if nargs=1 and args[1]=1 then
! `{`, `\\boldmath `, e,`}`;
! else
! `{`, `{`, `\\boldmath `, e,`}`, `^`, `{`, `latex/print`(args), `}`,`}`;
! fi;
end
):
--- 128,157 ----
# dist texlist := `\\sqrt `,`{`,`latex/print`(op(1,e)),`}`;
# dist else
! # if type(op(1,e),{'`+`','`*`','`^`','function','series','fraction','negative'})
! # then
! # texlist:=texlist,`latex/latex/prinpar`(op(1,e))
! # else
! # texlist:=texlist,`{`,`latex/print`(op(1,e)),`}`
! # fi;
! # texlist:=texlist,`^`,`{`,`latex/print`(op(2,e)),`}`;
! ## KM
! ## dist fi;
! ## END KM
! # texlist
! # end
! #):
# KM
`Package/Assign`(
`latex/exp`::string,
! "This is a replacement for the @`latex/exp`@ command which works exactly the same, except that italicizes the e, since TtH doesn't otherwise.
",
proc()
! local e, `{`, `}`;
! if nargs=1 and args[1]=1 then
! `{`, `\\it `, e,`}`;
! else
! `{`, `{`, `\\it `, e,`}`, `^`, `{`, `latex/print`(args), `}`,`}`;
! fi;
end
):
***************
*** 124,128 ****
`latex/latex/matrix`,
"This function overrides the default Maple routine for
! LaTeX'ing matrices. The sole change is that one line has been
modifed to prevent the insertion of extra whitespace
that confuses TtH.
--- 161,165 ----
`latex/latex/matrix`,
"This function overrides the default Maple routine for
! LaTeX'ing matrices. The sole change is that one line has been
modifed to prevent the insertion of extra whitespace
that confuses TtH.
Index: SET.mpl
===================================================================
RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/SET.mpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SET.mpl 1 Sep 2003 05:55:59 -0000 1.1
--- SET.mpl 12 Sep 2003 03:16:07 -0000 1.2
***************
*** 12,16 ****
"There is a problem with trying to use Maple sets in
AIM questions, namely that Maple sets have no particular
! guarenteed order to their elements. This is a problem in
AIM because we want the order to depend only on the
randomization seed, so that, e.g. if we print a set in a
--- 12,16 ----
"There is a problem with trying to use Maple sets in
AIM questions, namely that Maple sets have no particular
! guaranteed order to their elements. This is a problem in
AIM because we want the order to depend only on the
randomization seed, so that, e.g. if we print a set in a
|