RE: matheval update

new topic     » goto parent     » topic index » view thread      » older message » newer message

--- Al Getz <Xaxo at aol.com> wrote:

> Hello again Matt,
> 
> What is your basic method of handling algebraic equations?
> 
> like:
> 
>     y=x*2*(z+9)

Sorry it's taken so long...been on vacation, and have had phone
troubles...anyway...

I'm not sure what you're asking, exactly.  I don't have a copy of matheval
handy right now, but the value of 'Y' would be set to something like
(pseudo-matheval):

MULTIPLY( 2x, ADD(z, 9))

You could do this by parsing and evaluating "y:=x*2*(z+9)" or by parsing
"x*2*(z+9)" and passing that to SetVar().  To evaluate y at specific points
(x,z), just use SetVar() to set the values of x and z, then Evaluate() y:

sequence void, y
void = Evaluate( Parse( "y:=x*2*(z+9)" ))
y = Parse( "y" )
for i = 1 to 3 do
  for j = 1 to 3 do
    SetVar( "x", i )
    SetVar( "z", j )
    printf(1,"y(%d, %d) = %s\n", {i, j, PPExp( Evaluate( y ) ) })
  end for
end for

The symbolic stuff all happens in symeval.e.  I have routines like MultiplyOut,
SeparateAddition, LikeTerms, etc, which are somewhat self explanatory, and move
stuff around so that they can be simplified.

Matt Lewis


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu