Idea for equation library

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Idea for equation library

Stephen Gross
I've got an idea for a toolkit that uses boost::lambda to let you write
'equations' on the fly in c++. For instance, consider the following
pseudo-code:

==================
Equation e = x + y;
print e(x -> 5, y -> 10) // Prints 15
e = x - y
print e(x -> 5, y -> 10) // Prints -5
Equation d = eq(e) + z
print d(x -> 1, y -> 2, z -> 3) // Prints 2
==================

The idea is that you can encapsulate an algebraic function in a standalone
'Equation' instance, and dynamically reassign that equation. It's built off
of boost::lambda (of course), but it lets you name the variables rather than
just refer to them with the standard placeholders (_1, _2, etc.). Is it
worthwhile for me to post the toolkit code on this group?

Thanks,
--Steve

Stephen Gross
Case Western School of Medicine
Cleveland, OH

"By Grabthar's hammer, by the sons of Worvan, you shall be avenged." - Dr.
Lazarus


_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: Idea for equation library

Sohail Somani
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of
> Stephen Gross
> Is it
> worthwhile for me to post the toolkit code on this group?

Heck yes.
_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: Idea for equation library

james.jones
In reply to this post by Stephen Gross
Stephen Gross wrote:
> The idea is that you can encapsulate an algebraic function in a standalone
> 'Equation' instance, and dynamically reassign that equation. It's built off
> of boost::lambda (of course), but it lets you name the variables rather than
> just refer to them with the standard placeholders (_1, _2, etc.). Is it
> worthwhile for me to post the toolkit code on this group?

I'd love to see this. But it should be called "Expression", not "Equation" - the concepts you'd be creating aren't "equations".

Equation: x + y = z
Expression: x + y

- James
_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: Idea for equation library

Stephen Henry
In reply to this post by Stephen Gross
It's quite a nice idea, but I'm not too sure why anyone would want to
use it. There are already a number of optimised and fully featured
mathematical libraries out there. Without somesort a capability for
algebraic manipulation, for example, the ability to determine the value
of a variable within an equation given a number of relations (which
coincidently would be really useful, but non-trivial to implement), the
library basically amounts to some santatic sugar.

What I find interesting, however, is the named associations for function
arguments ( x -> 5 ), for example, but I think there is already a
library in Boost that enables such functionality.

S.

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Stephen Gross
Sent: 04 April 2006 18:29
To: Boost
Subject: [Boost-users] Idea for equation library

I've got an idea for a toolkit that uses boost::lambda to let you write
'equations' on the fly in c++. For instance, consider the following
pseudo-code:

==================
Equation e = x + y;
print e(x -> 5, y -> 10) // Prints 15
e = x - y
print e(x -> 5, y -> 10) // Prints -5
Equation d = eq(e) + z
print d(x -> 1, y -> 2, z -> 3) // Prints 2 ==================

The idea is that you can encapsulate an algebraic function in a
standalone 'Equation' instance, and dynamically reassign that equation.
It's built off of boost::lambda (of course), but it lets you name the
variables rather than just refer to them with the standard placeholders
(_1, _2, etc.). Is it worthwhile for me to post the toolkit code on this
group?

Thanks,
--Steve

Stephen Gross
Case Western School of Medicine
Cleveland, OH

"By Grabthar's hammer, by the sons of Worvan, you shall be avenged." -
Dr.
Lazarus


_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users