Alex (or anyone else!),
You point out that fractional or decimal depends on how it's used, and function calls may cause decimals instead of fractions -- is there a general rule for when it stays fractional and when it's converted to decimal?
Here's a simplified version of the issue I'm having:
How can I code something like
$num = Compute("42/9");
$func_sub = Compute("cos(sqrt3x)");
$func = $num*$func_sub;
to generate a "Correct Answer" that typesets as
42/19 cos(sqrt(3)x)
instead of
4.66667*cos(1.73205*x)
Doing Compute("$num_quote $func_sub->{string}") does maintain the sqrt(3) but I can't figure out anything that maintains the 42/19.
Same question for
Context()->variables->add(k=>"Real");
$const = Compute("31/2");
$func_const = Compute("k*sin(sqrt7x)");
$func_subbed = $func_const->substitute(k=>$const);
Hopefully that illuminates the inner workings for me, and helps me get a handle on both answer display and the weird numerical tolerance issue I described above.
Thanks! - Thomas