Hi,
I have a question about getting expressions into their shortest, most readable form.
I am solving a system of equations and pasting the resulting expression into a C program. What I ideally want is the expression that is shortest to read, but also takes the minimum number of floating point multiplies to evaluate (as it is calculated repeatedly within nested for loops).
In the cut down example below Maxima tells me the denominator is
( R3 + R2 + R1 ) R5 + ( R3 + R2 + R1 ) R4 + ( R2 + R1 ) R3
But from inspection this simplifies to
( R1 + R2 + R3 ).( R3 + R4 + R5 ) - ( R3 . R3 )
This second form is to my mind more readable and better reflects the underlying symmetries. It is also arguably slightly quicker to evaluate.
Thanks,
aspiceq
singleH:
eliminate([
V1 = R4*(I1 - I3),
V2 = R5*(I2 + I3),
I1 = (Vin - V1)/R1,
I2 = (Vin - V2)/R2,
I0 = I1 + I2,
V3 = V1 - V2,
I3 = V3/R3,
Z=Vin/I0
],[Vin,V1,V2,V3,I1,I2,I3])
$
ZsingleH:solve(singleH,Z);
print("Program Code")$
load("f90")$
f90(ZsingleH);
---------------------------------
All New Yahoo! Mail ? Tired of unwanted email come-ons? Let our SpamGuard protect you.