Also it is a good thing if you can plot the function for visual inspection.
t. Esa -----Original Message----- From: Programming <programming-boun...@forums.jsoftware.com> On Behalf Of Henry Rich Sent: Friday, February 7, 2020 12:18 PM To: programm...@jsoftware.com Subject: Re: [Jprogramming] Derivatives Newton's method is good for final polishing of a root when you are very close. It can do weird things when you are not close. Like here. Study this case and see what happened. Henry Rich On 2/6/2020 9:23 PM, Skip Cave wrote: > ]x=.i:3 > > _3 _2 _1 0 1 2 3 > > 0^x > > _ _ _ 1 0 0 0 > > > x=.0 > > (x^x)=2*x > > 0 NB. Zero is not a root > > (x^x)=2*x > > 0 > > x^x > > 1 > > 2*x > > 0 > > > So why does Newton Raphson show a zero root for (x^x)=2*x? > > (^~ - +:) Newton 2 > > 2 > > (^~ - +:) Newton 1 > > 0 NB. Something wrong here! > > (x^x)=2*x ? > > Skip Cave > Cave Consulting LLC > > > On Thu, Feb 6, 2020 at 5:38 PM Don Kelly <d...@shaw.ca> wrote: > >> Bo is correct >> >> There is a "zero rule" so n^0 =1 if n is not equal to 0. Bo is correct >> >> the only possible 0^0 is the same as 0*0 >> >> Possibly the coding for ^ should take this into account. >> >> >> >> On 2020-02-05 10:14 p.m., Skip Cave wrote: >>> Bo, >>> The original equation is: >>> (x^x)=2*x >>> 2 is clearly a root. 0 is clearly not, as 0^0 = 1 >>> >>> >>> Skip Cave >>> >>> >>> >>> On Wed, Feb 5, 2020 at 2:37 PM 'Bo Jacoby' via Programming < >>> programm...@jsoftware.com> wrote: >>> >>>> Skip. (x^x)-(2*x) = x*(x-2) is zero for x=0 and x=2. Two real roots. >>>> Newton Raphson finds one of these depending on the value of the initial >>>> guess. >>>> Bo. >>>> Den onsdag den 5. februar 2020 19.08.23 CET skrev Henry Rich < >>>> henryhr...@gmail.com>: >>>> >>>> Yeah, a rational y wouldn't ever quite satisfy 0 = _2 0 1 p. y >>>> >>>> Henry Rich >>>> >>>> On 2/5/2020 1:04 PM, Devon McCormick wrote: >>>>> You especially need guardrails if you try something like this: >>>>> _2 0 1&p. Newton 1 NB. OK - square root of 2 >>>>> 1.41421 >>>>> _2 0 1&p. Newton 1x NB. Try extended precision >>>>> C-c C-c|break NB. After waiting a while... >>>>> | _2 0 1&p.Newton 1 >>>>> NB. Failure to terminate... >>>>> >>>>> >>>>> On Wed, Feb 5, 2020 at 7:34 AM Henry Rich <henryhr...@gmail.com> >> wrote: >>>>>> I misread your function. >>>>>> >>>>>> (^~ - +:) Newton 1.1 >>>>>> 0.346323j1.2326e_32 >>>>>> (^~ - +:) Newton 0.5 >>>>>> 0.346323 >>>>>> >>>>>> Still need those guardrails! >>>>>> >>>>>> Henry Rich >>>>>> >>>>>> On 2/5/2020 2:21 AM, Skip Cave wrote: >>>>>>> In "Fifty Shades of J" chapter 23, the Newton Raphson algorithm is >>>>>>> described thusly: >>>>>>> >>>>>>> Newton =: adverb : ']-u%(u D.1)'(^:_)("0) >>>>>>> >>>>>>> How would that be defined using the new derivative verbs? >>>>>>> >>>>>>> Also, what is the replacement for d.? >>>>>>> >>>>>>> How would I find the roots of (x^x)=2*x using Newton Raphson? >>>>>>> >>>>>>> Skip >>>>>>> >>>>>>> Skip Cave >>>>>>> Cave Consulting LLC >>>>>>> >> ---------------------------------------------------------------------- >>>>>>> For information about J forums see >> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&data=01%7C01%7C%7C61edfb1ad3dd44fbabc308d7abb70d17%7C5090e269dbea4e98a9aa3e70be5890f7%7C0&sdata=31tr2STlzWs7rOlY%2F5UvFqWhqgJHQ1h0XB1qjSprWy8%3D&reserved=0 >>>>>> ---------------------------------------------------------------------- >>>>>> For information about J forums see >> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&data=01%7C01%7C%7C61edfb1ad3dd44fbabc308d7abb70d17%7C5090e269dbea4e98a9aa3e70be5890f7%7C0&sdata=31tr2STlzWs7rOlY%2F5UvFqWhqgJHQ1h0XB1qjSprWy8%3D&reserved=0 >>>> ---------------------------------------------------------------------- >>>> For information about J forums see >>>> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&data=01%7C01%7C%7C61edfb1ad3dd44fbabc308d7abb70d17%7C5090e269dbea4e98a9aa3e70be5890f7%7C0&sdata=31tr2STlzWs7rOlY%2F5UvFqWhqgJHQ1h0XB1qjSprWy8%3D&reserved=0 >>>> >>>> ---------------------------------------------------------------------- >>>> For information about J forums see >>>> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&data=01%7C01%7C%7C61edfb1ad3dd44fbabc308d7abb70d17%7C5090e269dbea4e98a9aa3e70be5890f7%7C0&sdata=31tr2STlzWs7rOlY%2F5UvFqWhqgJHQ1h0XB1qjSprWy8%3D&reserved=0 >>>> >>> ---------------------------------------------------------------------- >>> For information about J forums see >>> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&data=01%7C01%7C%7C61edfb1ad3dd44fbabc308d7abb70d17%7C5090e269dbea4e98a9aa3e70be5890f7%7C0&sdata=31tr2STlzWs7rOlY%2F5UvFqWhqgJHQ1h0XB1qjSprWy8%3D&reserved=0 >> ---------------------------------------------------------------------- >> For information about J forums see >> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&data=01%7C01%7C%7C61edfb1ad3dd44fbabc308d7abb70d17%7C5090e269dbea4e98a9aa3e70be5890f7%7C0&sdata=31tr2STlzWs7rOlY%2F5UvFqWhqgJHQ1h0XB1qjSprWy8%3D&reserved=0 >> > ---------------------------------------------------------------------- > For information about J forums see > https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&data=01%7C01%7C%7C61edfb1ad3dd44fbabc308d7abb70d17%7C5090e269dbea4e98a9aa3e70be5890f7%7C0&sdata=31tr2STlzWs7rOlY%2F5UvFqWhqgJHQ1h0XB1qjSprWy8%3D&reserved=0 ---------------------------------------------------------------------- For information about J forums see https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&data=01%7C01%7C%7C61edfb1ad3dd44fbabc308d7abb70d17%7C5090e269dbea4e98a9aa3e70be5890f7%7C0&sdata=31tr2STlzWs7rOlY%2F5UvFqWhqgJHQ1h0XB1qjSprWy8%3D&reserved=0 Tämän viestin sisältö liitteineen on luottamuksellinen ja tarkoitettu vain sen vastaanottajalle. Jos et ole viestin tarkoitettu vastaanottaja, pyydämme sinua poistamaan viestin liitteineen ja sen jälkeen ilmoittamaan asiasta välittömästi viestin lähettäjälle. Viestin sisällön paljastaminen, kopioiminen tai muu käyttö on kielletty. The contents of this message and any attachments are confidential and meant solely for the intended recipient. If you are not the intended recipient, we kindly ask that you delete the message and its attachments, and immediately notify the sender of the email. Disclosing, copying or using the contents of the message is strictly prohibited. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm