On Tuesday, April 3, 2012 1:18:00 AM UTC+5:30, Aaron Meurer wrote:
>
> I don't get the point of doing it that way. Wouldn't that mean that
> you always do the arithmetic in mpmath, and then only convert to numpy
> at the end? That would defeat the purpose of using numpy.
Yeah. What I meant is that the representation of the interval will be in
mpi.
During evaluation of an expression with numpy, we call to_ndarray() on the
interval,
which will provide us with the numpy array representing the interval. Then
we can,
by a set of rules evaluate the expression using numpy.
Example:
>>> r = mpi([5,15])
>>> a = sin(x)
>>> eval(a, r)
def eval(expr, inter, lib = 'numpy'):
parse the expression.
range = to_ndarray(inter)
apply the rule for sine.
get back the interval.
Something on these lines. This will allow me to use mpi and still evaluate
expressions using numpy.
> Probably it's better to create a library that is backend agnostic, and
> plug numpy and mpmath into it (but do it in such a way so that you can
> still take advantage of the mpi functionality that is already in
> mpmath).
>
> Aaron Meurer
>
> On Sat, Mar 31, 2012 at 11:44 PM, Bharath M R <[email protected]>
> wrote:
> > @Aaron & Stefan
> >
> > I thought about the interval arithmetic implementation and I came up with
> > this.
> >
> > Derive from mpmath interval arithmetic class and implement all the
> features.
> > Add an `to_ndarray()` function to the class which converts the interval
> to
> > an
> > numpy array.
> > An `eval(expr, lib = 'numpy') which evaluates and returns the result
> based
> > on the
> > rules.
> >
> > Is this a good strategy? or should I implement the complete interval
> > arithmetic in
> > sympy separately.
> >
> >
> >
> >>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "sympy" group.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msg/sympy/-/_PSpO9E6gNcJ.
> >
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group at
> > http://groups.google.com/group/sympy?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sympy/-/nKSYOfgU1TMJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy?hl=en.