On Friday, August 31, 2018 at 11:44:37 AM UTC-7, William wrote: > > On Fri, Aug 31, 2018 at 11:15 AM, John H Palmieri > <jhpalm...@gmail.com <javascript:>> wrote: > > The question > > > > > > > https://ask.sagemath.org/question/43517/conflicting-sage-vs-wolfram-evaluation-of-a-limit/ > > > > > brought the following question to mind: can you specify the precision to > > which a function is evaluated when plotting it? The particular > > ask.sagemath.org question involves a function which has "inherent > numerical > > instability", as kcrisman says in his answer. For example, evaluating > V(20, > > 1).n() will result in "ValueError: power::eval(): division by zero", but > > V(20,1).n(300) gives an actual number. Is there a way to pass the > numerical > > precision to the plot function? > > > > (I am not an expert in the plotting code in Sage, but when I look at the > > plot code, I see the function "generate_plot_points" which calls > > float(f(...)). That makes me think that the available precision is > fixed. > > But maybe I'm wrong.) > > I wrote a lot of the plot code and I think it only works with floats. > I don't think we implemented anything at all to automatically deal > with high precision. > > As a workaround, if you have a function f you want to plot to high > precision, maybe do this: > > R = RealField(500) > def wrap(x): > # x is a floating point number > return f(R(x)) > > plot(wrap, ...) > > --- > > Alternatively, compute in any way you want (to very high precision) a > list v of pairs (x,y), then do "line(v)" to get a plot of that. >
I can't get the 'wrap' approach to work, but generating the list of pairs works well. Thanks! John > > > > > -- > > John > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "sage-support" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to sage-support...@googlegroups.com <javascript:>. > > To post to this group, send email to sage-s...@googlegroups.com > <javascript:>. > > Visit this group at https://groups.google.com/group/sage-support. > > For more options, visit https://groups.google.com/d/optout. > > > > -- > William (http://wstein.org) > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.