Ondrej and smchir, Thanks for the continued help. I take this problem as a hard case for root finders to address, so that is why I have been comparing solutions across various software, including sympy. I have tried plotting this function and zooming in on certain sections of the domain but have had trouble visualizing the discontinuities and "true" zeros. What started off as a comparison of solutions has morphed into a deepening investigation of this particular function and the various flavors of algorithms. I am at least learning how cool sympy is along the way. I'll update this post as I learn more...
On Apr 14, 6:53 am, smichr <[email protected]> wrote: > It seems like there are a couple of issues here. > > 1) when you use solve, you are getting the exact answer for the > problem posed. f(x) = 1e80*exp(x)-1e300 is exactly zero at w = > log(1.0e-380). Call this value of w, Z. > > 2) The question you are trying to answer is "how far away from Z" does > the computer think that f(x) is 0? A very useful exercise is to get a > program that can graph this and then zoom in on the graph near > log(1e-380). You may see several values that are 0; the graph will not > be smooth, it will have discrete jumps in it. There are two reasons > this might be so: a) two values of x are really not different to > machine precision and b) two different values of x don't result in > f(x) values that are different. I think it is even possible that there > is no value that is exactly 0 for your function. > > Be careful when using rootfinding routines to answer this question. > They usually have controls to stop searching for a root when two > identical y values are found, when the y values are within a certain > threshold of 0 or when the bounds have collapsed (i.e. values of x are > no longer distinguishable to machine precision or are within a certain > distance of each other). > > If I define > > >>> def f(x): > > ... return N(1e80*exp(x)-1e-300) > > I get > > >>> f(-874.982335337737311) > > -7.90654222690305e-315>>> f(-874.982335337737310) > > 1.05780295494719e-313 > > You might read the docstrings for the different root-finding methods > that you are using to see if you can control the searching to obtain > something close to the above. -- You received this message because you are subscribed to the Google Groups "sympy" group. 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.
