I should add, I have given up on Maxima being fast at plotting and some
other types of problems that can be done better on a multicore machine or
GPU or just using another programming language.
Rich
On 10/7/2011 10:26 AM, Richard Hennessy wrote:
>
> Consider if x>a and x>b then u else v;
>
> It is equivalent to the following, .... not really...
In some cases it does not matter.
> if you agree with the idea that how an expression evaluates is all that
> matters.
I'm not sure what you mean by this.
In mean in some cases it does not matter.
>
>
> (u - v) * unit_step(x - max(a, b)) + v;
"no, can't do that since it evaluates both u and v.
If it cannot be determined if " x>a and x>b" or not, then NEITHER u
nor v is evaluated."
Well, it is good to be able to go the other way and convert to "if then"
from the "unit_step form" if you want speedier calculations, in certain
cases. Lets say you have a complex expression involving unit_step in a lot
of places and you want to plot it. I have tried converting to "if then
form" first and it does speed up how long it takes to plot, but it also
takes time to do the converting. In some cases the whole process of
converting to "if then form" and plotting is faster that just plotting the
function "as is" in its original unit_step() form. I can provide an example
in a .mac file. The reason is because the "if then" does not
unconditionally evaluate BOTH u and v.
Rich