1. RE: matheval update

> From: Juergen Luethje [mailto:j.lue at gmx.de]

> Hi Matt, you wrote:
> 

> Very nice, I'm much interested in this project.
> 
> When I run 'mathdemo.ex', I got the following error message:
> 
>      C:\TEMP\matheval.e:143
>      resolve_math_ref has not been declared
>          id = resolve_math_ref( ref )

#$^@!&#$@%

Somehow matheval.e got overwritten by parseval.e.  I'll try to get it fixed
and up today.
 
> Also, I don't understand some parts of the documentation, for 
> instance:
> 
> <quote>
> [const]
> Floor
> { FLOOR, ARG1, { } }
> Returns: Greatest integer less than ARG1.
> <unquote>
> 
> How can a constant return something?

Sorry, I suppose I should change those 'constant' identifiers to something
else.  Each of those is really a type of matheval object--usually some sort
of function or operator, though there are also constants (numbers), matrices
and 'data'.  Basically, I suppose I'm pushing the envelope of what makedoc
was designed for, and wasn't sure what exactly to call these, and I settled
on 'const'.
 
> <quote>
> [func]
> Simplify
> Returns: Algebraically simplified matheval sequence.
> <unquote>
> 
> What arguments does 'Simplify' take, and what exactly is a 'matheval
> sequence'?

It takes a matheval sequence.  I'll fix this up.  A matheval sequence is a
three element sequence (this info is buried in the Extensions topic--I'll
make this more prominent).  The first element is an integer, corresponding
to what it actually is.  The second and third elements are sequences which
hold the data for the object.  Depending on the type of object, they can be
matheval sequences themselves, or some other form of data (specified by the
object type).  In the case of FLOOR, it expects a matheval sequence of type
CONSTANT:

{ FLOOR, { CONSTANT, {1.3}, {}}, {}}

It returns something by being evaluated.  Perhaps rather than returns, I
should say transforms?  I suppose the 'return' is actually happening within
the virtual machine of matheval.
 
> I like math, but it's dry stuff. So I think it would be nice, if there
> were some examples in the documentation.
> Thank you for this library! I believe it's great, but the 
> documentation
> is somewhat confusing for me, so I think I can't really see it's full
> potential. That's just me, of course.

Thanks for the feedback!  I'm sure it's not just you.  My documentation
skills aren't the best.  I'll try to put some examples in.  

You can use it (assuming I get the right files uploaded!) as a glorified
calculator using the simple demo I supplied, or you can do some fairly
complex mathematical operations with it, building equations and evaluating
them on the fly.  I've used it in EuSQL to handle the conditional WHERE
clauses of SQL, and plan to use it there for calculated fields, too.

I think it could also be a good tool for prototyping.  If you needed high
speed calculations, matheval ain't for you.  But if you're trying to figure
out *what* to calculate, it could be useful, since it could be easier to
tweak an equation or two and let matheval parse it, as opposed to changing
code.

It's also fun for me. :)  I want to get it to the point where it can do some
really powerful symbolic manipulations--simplifying, solving, calculus, etc.

I'll let you know when I get the corrected/improved version up.

Matt Lewis

new topic     » topic index » view message » categorize

2. RE: matheval update

> From: gertie at visionsix.com [mailto:gertie at visionsix.com]

> Why does GreaterOrEqual return zero if one of the args is 
> data? When using fuxxy logic, if these are bytebool, this
> function will always return zero if the values are above 2?


In fact, that's en error in the documentation.  I'd written the code a while
back, and was only just now documenting it (bad, bad, bad).  I misread what
I'd written.  GreaterOrEqual() uses Greater() and EqualTo() for it's
comparison, and will actually compare a CONSTANT's ARG1 to a DATA's ARG1.
This will be corrected, too.  (NB: DATA just means that ARG1 is an arbitrary
sequence--could be anything--used to pass 'data' for whatever purpose.)

I'm not sure what you mean by fuxxy logic or bytebool.  These types aren't
supported by matheval, although I notice that I didn't follow my own
convention of calling eval_addons().  I've fixed this, so you could support
this sort of thing as an add on.

Thanks for the feedback!

Matt Lewis

new topic     » goto parent     » topic index » view message » categorize

3. RE: matheval update

OK, I've made some fixes, updated some of the docs:

> Link to matheval:
> http://www14.brinkster.com/matthewlewis/matheval.zip
> 
> Matheval docs on-line:
> http://www14.brinkster.com/matthewlewis/matheval.htm
> 
> All my projects:
> http://www14.brinkster.com/matthewlewis/projects.html

Matt Lewis

new topic     » goto parent     » topic index » view message » categorize

4. RE: matheval update

Matt Lewis wrote:
> 
> 
> OK, I've made some fixes, updated some of the docs:
> 
> > Link to matheval:
> > http://www14.brinkster.com/matthewlewis/matheval.zip
> > 
> > Matheval docs on-line:
> > http://www14.brinkster.com/matthewlewis/matheval.htm
> > 
> > All my projects:
> > http://www14.brinkster.com/matthewlewis/projects.html
> 
> Matt Lewis
> 
> 

Hello again Matt,

What is your basic method of handling algebraic equations?

like:

    y=x*2*(z+9)


Take care for now,
Al

new topic     » goto parent     » topic index » view message » categorize

5. RE: matheval update

--=======647D700F=======

At 08:43 AM 6/13/03 -0400, you wrote:

>
>
>OK, I've made some fixes, updated some of the docs:
>
> > Link to matheval:
> > http://www14.brinkster.com/matthewlewis/matheval.zip
> >
> > Matheval docs on-line:
> > http://www14.brinkster.com/matthewlewis/matheval.htm
> >
> > All my projects:
> > http://www14.brinkster.com/matthewlewis/projects.html
>
>Matt Lewis

Hi Matt,

I get the following when running mathdemo.ex:


         Enter an expression to evaluate, 'help' or [Enter] to quit.

         Enter expression: 9!
         Result: 362880

         Enter expression: 10!
         Result: 3628800

         Enter expression: 11!

         Result: 39916800

         Enter expression: 12!

         Result: 39916800

         Enter expression: 13!

         Result: 479001600

         Enter expression:
------------------------------------------------------------------------

Note the same value is returned for 11! and 12!.  I downloaded the package 
from your site on Sunday, June 15 around 2:30 PM.  If no one can reproduce 
this, then I probably have a corrupt   include file.

                                 Bob

--=======647D700F=======
Content-Type: text/plain; charset=us-ascii; x-avg=cert;
x-avg-checked=avg-ok-4A492A4F
Content-Disposition: inline


---

--=======647D700F=======--

new topic     » goto parent     » topic index » view message » categorize

6. RE: matheval update

--- 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 message » categorize

7. RE: matheval update

--- Robert Elia <bobelia200 at netzero.net> wrote:
>          Enter expression: 11!
> 
>          Result: 39916800
> 
>          Enter expression: 12!
> 
>          Result: 39916800
> 
> Note the same value is returned for 11! and 12!.  I downloaded the package 
> from your site on Sunday, June 15 around 2:30 PM.  If no one can reproduce 
> this, then I probably have a corrupt   include file.

Bob, thanks for catching that.  It's a pretty simple fix, actually.  I do a
simple lookup for factorial (faster than calculating these things), and
duplicated 39916800 somehow.  If you delete one where FACTORIAL_LU is defined,
it should be fine.

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 message » categorize

8. RE: matheval update

Matt Lewis wrote:
> 
> 
> --- 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
> 

Hello again Matt,

Ok thanks, i'll have to take a look at it soon.

Take care for now,
Al

new topic     » goto parent     » topic index » view message » categorize

9. RE: matheval update

> From: Al Getz [mailto:Xaxo at aol.com]

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

OK, I've had a chance to plug this into matheval, and after parsing and
simplifying, it stores the expression as:

(Z * 2X) + 18X

Computationally, this is not as efficient as it could be.  I've just changed
parseval.e to allow simplification to be turned off during parsing.  You
could alternatively do this to speed things up a little:

v := 2x
w := z+9
y := v*w

I plan to post the updated code later today.

Matt Lewis

new topic     » goto parent     » topic index » view message » categorize

10. RE: matheval update

Matt Lewis wrote:
> 
> 
> > From: Al Getz [mailto:Xaxo at aol.com]
> 
> > What is your basic method of handling algebraic equations?
> > 
> > like:
> > 
> >     y=x*2*(z+9)
> 
> OK, I've had a chance to plug this into matheval, and after parsing and
> simplifying, it stores the expression as:
> 
> (Z * 2X) + 18X
> 
> Computationally, this is not as efficient as it could be.  I've just 
> changed
> parseval.e to allow simplification to be turned off during parsing.  You
> could alternatively do this to speed things up a little:
> 
> v := 2x
> w := z+9
> y := v*w
> 
> I plan to post the updated code later today.
> 
> Matt Lewis
> 

Hi again Matt,

Ok, i'll have to take a look at it.

I did the 'include' file thing with my evaluator, but
the problem was it could never be bound in that form.
I was hoping to find another way of doing it that would
be fast too, and could be bound.

Take care for now,
Al

new topic     » goto parent     » topic index » view message » categorize

11. RE: matheval update

> From: Al Getz [mailto:Xaxo at aol.com]

> Matt Lewis wrote:

> > I plan to post the updated code later today.

> Hi again Matt,
> 
> Ok, i'll have to take a look at it.
> 
> I did the 'include' file thing with my evaluator, but
> the problem was it could never be bound in that form.
> I was hoping to find another way of doing it that would
> be fast too, and could be bound.

I've put the updates on my page:
Library: http://www14.brinkster.com/matthewlewis/matheval.zip
   Docs: http://www14.brinkster.com/matthewlewis/matheval.htm

I think that matheval is probably fast enough for most things, but if you
know what you need to calculate before hand, it would be faster to hand code
the math.  The purpose of matheval is to give you a more powerful and
flexible way to do things, and it shouldn't have any problem being bound or
compiled.  It's become an integral part of EuSQL, where it's used to parse
and evaluate SQL WHERE clauses, and will eventually be used to evaluate
calculated fields.

Matt Lewis

new topic     » goto parent     » topic index » view message » categorize

12. RE: matheval update

Matt Lewis wrote:
> 
> 
> > From: Al Getz [mailto:Xaxo at aol.com]
> 
> > Matt Lewis wrote:
> 
> > > I plan to post the updated code later today.
> 
> > Hi again Matt,
> > 
> > Ok, i'll have to take a look at it.
> > 
> > I did the 'include' file thing with my evaluator, but
> > the problem was it could never be bound in that form.
> > I was hoping to find another way of doing it that would
> > be fast too, and could be bound.
> 
> I've put the updates on my page:
> Library: http://www14.brinkster.com/matthewlewis/matheval.zip
>    Docs: http://www14.brinkster.com/matthewlewis/matheval.htm
> 
> I think that matheval is probably fast enough for most things, but if 
> you
> know what you need to calculate before hand, it would be faster to hand 
> code
> the math.  The purpose of matheval is to give you a more powerful and
> flexible way to do things, and it shouldn't have any problem being bound 
> or
> compiled.  It's become an integral part of EuSQL, where it's used to 
> parse
> and evaluate SQL WHERE clauses, and will eventually be used to evaluate
> calculated fields.
> 
> Matt Lewis
> 

Hello again Matt,

I didnt mean to imply that your evaluator didnt bind or anything
like that, i was just stating that mine doesnt bind because
it uses dynamic includes.
Would be nice if binding could handle that too smile

Take care for now,
Al

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu