Mikey_W

35 Reputation

2 Badges

1 years, 99 days

MaplePrimes Activity


These are replies submitted by Mikey_W

@vv 

Thank you for this! Very useful!

Sorry for the delay in replying.

Best wishes

Mikey

@acer 

Anything you come up will be much appreciated.

Thank you for your time.

Best wishes

Mikey

@nm 

Interesting!

I might well ask someone at Maplesoft about this.

Cheers!

Mikey

@nm 

Thank you for your insightful comments.

I note that

evalhf(Pi)
3.14159265358979312

gives Pi correct as far as the 793 in the decimal readout. The 12 at the end is not correct, and I note that these digits correspond to the 17th and 18th significant figures.

Do I interpret this correctly that these last two digits are wrong because they go beyond "double precision", i.e. beyond the 16th significant figure? Is that is what is going on?

Best wishes

Mikey

@acer 

Thank you for this helpful answer. The information you provide gives me more insight into the underlying complexity of arithmetic withing computer architecture.

Do you have one or more particular examples of a computation that will be noticably faster on my machine when I use evalhf, versus evalf?  It would be interesting to see concrete examples when evalhf clearly "wins" over evalhf in terms of speed. All the calculations I have done, where evalhf is allowed, seem to have speeds which are not discernably different when I switch to just evalf.

Many thanks!

Mikey

This has all been most illuminating and interesting to see the discussion unfold.

My motivation for the question was related to working with dsolve in a slightly different context, but I really needed to get to the heart of how I can work with procedures in connection with implicit plotting and fsolve without the dreaded errors coming up.

The information provided has made things so much better for me, and the comments and coding suggestions and alternatives have been an appreciated bonus!

Best wishes

Mikey

@acer 

Your development of the examples to highlight the intricacies of what I was struggling with are so coherent and focused to demonstrate what Maple is doing.

In fact, I had been playing with this code I wrote, which is along the same lines as yours. So now I can implement the adjustments for alternative approaches that you recommend to circumnavigate possible errors.

G:=proc(u,v) local r,s;
if type(u,numeric) and type(v,numeric) then
  if u < 0 then
  r:=abs(u);
  s:=(1/3)*exp(-2*u)*sin(v);
  else r:=1-v*sin(4*u);
  s:=2*cos(v)^2*cos(u);
  end if:
  r+s;
else 'G'(u,v)
end if:
end proc:

with(plots):
implicitplot(G(x,y)=0,x=-1..4,y=-3..3, gridlines=true,colour="HotPink",
background="Wheat");

Absolutely terrific support and instruction.

Once again: thank you so very, very much!

Mikey

@WD0HHU 

I totally second this. The care and use of examples to highlight Maple's behaviour has been of the highest standard.

My understanding about these complicated (and they are objectively complicated) quirks and issues with regards to evaluation, delayed evaluation, (<clears throat: ahem>), "premature evaluation" 🤣 and how numeric or undeterined values are handled within procedures, and workarounds, has been so very enlightening.

My heartfelt gratitude!

Mikey

@acer 

What can I say? What a fabulous, clearly laid-out and articulated response!

This has done so much to help my understanding of what is going on.

I really appreciate the time and care you have put in when providing details of the code, and how Maple is processing the instructions.

Thank you again!

I am reworking/rewriting what you have written in my own words just to ensure I am absorbing it in the right way:

So, just to get my thinking straight on implicitplot, implicitplot is running many numeric processes (doing lots and lots of work similar to fsolve) to generate points to plot, right? Therefore, if the range given in implicitplot is x=-5..1 as in the example I've been using, then implicitplot starts off by setting a=-5 and working backwards through the definitions and procedures which create the equations relating a to b, in order to find the corresponding value of b. So your amended code (which is very sweet, I have to add 🥰) is grabbing, numeric values of a and b that implicitplot is generating to work with, chucking them into BC1(a,b) and BC2(a,b), and then playing with them (and, by inference using h(a,b) as well) to home in on the required ordered pairs (a,b) to plot.  Most importantly, because of this approach, since a and b are now certainly numeric, when it comes to working with BC2(a,b) (and therefore h(a,b)), there is no more need to have the original conditional construction in the defintion of procedure h(a,b), because now we have forced it that a and b will only ever be numeric at this stage, right?  How does that sound to you?

Brilliant work from you, though. Thanks again for your clarity.

Mikey

Page 1 of 1