Re: Boost-users Digest, Vol 866, Issue 4

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

Re: Boost-users Digest, Vol 866, Issue 4

Stephen Gross
Message: 10
Date: Wed, 5 Apr 2006 10:52:07 -0700
From: "Sohail Somani" <[hidden email]>
Subject: Re: [Boost-users] Equation idea (follow-up)
To: <[hidden email]>
Message-ID:
<[hidden email]>
Content-Type: text/plain; charset="us-ascii"


>Because people want to use different types. For example, some systems
may support higher precision for long double.

I think you have a good point on this one... The trick is to find a way to
do it that keeps the client syntax as simple.

>I think most boost users are pretty much power-users (for better or
worse).

Sure, so I guess the question is more like this: If we accept the premise
that the intended users of the toolkit aren't power users, then does it make
sense for boost to include? I think you have a valid point that maybe it's
not appropriate for boost. But at the same time, I figured that since it's
built so directly off of boost, it might be helpful. Then again, maybe the
best place for the equation toolkit is in a different toolkit bundle...?

--Steve


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

Re: Boost-users Digest, Vol 866, Issue 4

Sohail Somani
> >I think most boost users are pretty much power-users (for better or
> worse).
>
> Sure, so I guess the question is more like this: If we accept
> the premise
> that the intended users of the toolkit aren't power users,
> then does it make
> sense for boost to include? I think you have a valid point
> that maybe it's
> not appropriate for boost. But at the same time, I figured
> that since it's
> built so directly off of boost, it might be helpful. Then
> again, maybe the
> best place for the equation toolkit is in a different toolkit
> bundle...?

Im sure you'd get a really great response on a numerical analysis type
forum (I think there is a newsgroup sci.math.num-analysis or something)

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

Re: equation (really expression) idea

james.jones
In reply to this post by Stephen Gross
From: "Stephen Gross" <[hidden email]>
> >1. Types are not template-ized. I don't want everything to be a double.
> This is an interesting point. My goal so far has been to prioritize
> simplicity above all. The purpose of the toolkit is for letting people write
> arithmetic equations easily. In light of that, I think sticking with doubles
> makes sense.

So if I want to use a rational class, or a higher-precision double provided by a library, or a fixed-precision class, or a boolean type (a la Excel: if(x<y,x,y)) I'm out of luck? I appreciate simplicity of use, but you can still accomplish this by letting double be the default type (which makes sense, I think). Then non-power-users get double all the time, and power users can still do some hacking.

> Well, this is an interesting idea but it runs contrary to the metaphor I
> want. In the above example, the variables 'x' and 'y' work as global
> variables. I want the user to have to pass x and y directly to the equation.

I agree - which is why I wrote the bit about an evaluate function that takes positional arguments. Maybe named arguments are even better, though. I hadn't thought of that.

> If you had global-level variables, then it would be difficult to make the
> above example work properly (passing z on as x and y when f2 invokes f1)..

Please don't call them globals - they aren't. They're in the same scope as the expression.

However, as to your particular issue, this isn't a problem:

variable x, y, z;
expression expr1 = x + y;
expression expr2 = z + expr1;

A variable is just a special form of an expression, after all.

As to mapping, it would be nice to be able to write code like:

double v = expr1(x=5,y=10);
double w = expr2(x=2,y=3,z=8);

I should think the Boost parameter library could handle this.

Actually, maybe you don't even need the Boost parameter library. Just define operator() on expression to ignore its arguments (then x=5, y=10 sets the values of x and y, and expr1 is then evaluated in that context).

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

Please don't reply to digests (was: Boost-users Digest, Vol 866, Issue 4)

David Abrahams
In reply to this post by Stephen Gross
"Stephen Gross" <[hidden email]> writes:
  ...

http://www.boost.org/more/discussion_policy.htm

--
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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

Re: equation (really expression) idea

Paul Giaccone
In reply to this post by james.jones
[hidden email] wrote:

>As to mapping, it would be nice to be able to write code like:
>
>double v = expr1(x=5,y=10);
>double w = expr2(x=2,y=3,z=8);
>
>I should think the Boost parameter library could handle this.
>
>Actually, maybe you don't even need the Boost parameter library. Just define operator() on expression to ignore its arguments (then x=5, y=10 sets the values of x and y, and expr1 is then evaluated in that context).
>  
>
I agree - this is a more natural notation, as it is closer to what a
mathematician would write ("v = expr1(x, y) where x = 5 and y= 10").
Using arrows ("->") looks odd to a mathematician's eyes, as that means
"maps to", and it is expr1 that does the mapping, not the variables.

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