Boost logo

Boost :

Subject: Re: [boost] [Units & Spirit] libraries
From: Daniel J. Duffy (dduffy_at_[hidden])
Date: 2009-06-07 22:35:45

I would like to generate well-formed units and create expressions of the followiong kinds:
Examples of unit expressions:
1. 2m + 15m*32s/16s = 32m.
2. 3m*7s + 2m*10s/5m = 21m + 4s -> ERROR. Can't add meters to seconds.

The second group looks more tricky.
Examples of simplification:
1. (x-2)^2 + 4x^2 - 2^x + 1 = 5x^2 - 8x + 10
2. x^2 + 7x + 10 = (x + 2)(x + 5)
3. (a + b)(a - b) = a^2 - b^2
4. sin(x)^2 + cos(x)^2 = 1
5. 2sin(x)cos(x) = sin(2x)

One tricky part is for example #5 where the code needs to 'know' trigonometry.
best regards



From: boost-bounces_at_[hidden] on behalf of Hartmut Kaiser
Sent: Mon 08-06-2009 01:46
To: boost_at_[hidden]
Subject: Re: [boost] [Units & Spirit] libraries

> I am using the Units library for Dimensional Analysis. So far it is
> very useful. Up till now I am using it in a hard-coded/compile time way
> as in a test.cpp.
> My inteterst is in using Units as part of a larger run-time system so I
> need some way of making my code more flexible. Lambda library is an
> option here but I would also like to create units and quanties from
> string input as well as being able to parse these strings to units and
> then store the units in a database.
> Can I use Spirit (and Serialization) for these features? Maybe the
> functionality already exist, and I have not found it.

Sure Spirit is your friend for all parsing and output generation needs.
What did you have in mind?

Regards Hartmut

Unsubscribe & other changes:

Boost list run by bdawes at, gregod at, cpdaniel at, john at