The paper about Herbie is very interesting. Since SymPy is primarily 
symbolic it would work well at producing expressions via Herbie that would 
perform well -- an optimized expression for evaluation. It reminds me a 
little of the Fu-heuristics that are used for trigonometric simplifications.

/c

On Thursday, March 12, 2020 at 10:47:01 AM UTC-5, Shubham thorat wrote:
>
> The current evalf() is used to evaluate a numerical expression into a 
> floating-point number using an arbitrary precision library mpmath.
>
> What I want to do is to get the best answer for different ranges that 
> varies from (-inf, inf) without increasing precision.
> for example:
> expr1 = (x + 1)**0.5 - x**0.5
>
> when we calculate it for x = 10000000000000000.98698698, we get 0
> -     expr1.subs(x,10000000000000000.98698698)  = 0
>
> but if we rewrite the expr1 as 1/(x**0.5 + (x + 1)**0.5), we get a better 
> answer without catastrophic cancellation as in the previous case.
> -    expr2 = 1/(x**0.5 + (x + 1)**0.5)
> -    expr2.subs(x,10000000000000000.98698698) = 5.00000000000000e-9
>
> I am proposing to implement this paper:  
> https://herbie.uwplse.org/pldi15-paper.pdf
>
> -    Where an expression can be rewritten to get the best possible answer 
> without increasing the precision.
> -    The rewriting database will have different function and properties 
> like commutativity, associativity, distributivity, (x + y) = (x**2 - 
> y**2)/(x - y), (x - y) = (x**3 - y**3)/(x**2 + y**2 + x*y), x = exp(log( x 
> )) etc.
> -    I want to create a class where a symbolic expression along with its 
> optional range is given as an input, which will be rewritten to get the 
> best possible expression.
>
> Please correct me if I have made mistake in understanding the things, also 
> suggest the scope and changes for this.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/151f58c0-0e83-4849-82e3-fac3173bd56c%40googlegroups.com.

Reply via email to