d. 1 wants to be able to use the chain rule for 2^2*x, and it seems
like the implementation was from an early version of J, and has not
kept up with all the more recent changes. So, you should put that
changed term into an f@g form.

In other words, use (8: + (2&^) + (2&^)@(2&*))

Thanks,

-- 
Raul


On Mon, Jan 29, 2018 at 1:46 AM, Skip Cave <[email protected]> wrote:
> I see what I did wrong.
>
> The equation is:  8 + (2^x) - 2^2*x = 0
>
> The  third term is (2^2*x) not (2^2^x)
>
> That should get close to the answer x=1.75372
>
> I'm mostly interested in how to formulate the code to implement the Newton
> Raphson solution
> using
>
> N=: 1 : '- u % u d. 1'
>
> In the NR code, where does the equation verb go?
> How does it need to be structured? Where does the iteration count limit go?
>
> Skip
>
>
>
>
> Skip Cave
> Cave Consulting LLC
>
> On Mon, Jan 29, 2018 at 12:19 AM, Rob Hodgkinson <[email protected]> wrote:
>
>> @Skip et al …
>>
>> also apologies for my sill definitions, I should have used y inside the
>> definitions not x (!!!), sorry if I confused the issue…
>>
>> as in here for the first interpretation …
>>
>> x,"0 (3 : '8+(2^y)-((2^2)^y)') x=:1.6+0.05*i.8
>>
>> …/Rob
>>
>> > On 29 Jan 2018, at 3:49 pm, Jose Mario Quintana <
>> [email protected]> wrote:
>> >
>> > In that case,
>> >
>> >   (X=. (8 + (2 ^ ]) - (2 ^ 2) ^ ])New (^:22) 1)
>> > 1.75372489
>> >
>> > is a root,
>> >
>> >   (8 + (2 ^ ]) - (2 ^ 2) ^ ])X
>> > 0
>> >
>> > but, it is not the only one,
>> >
>> >   (X=. (8 + (2 ^ ]) - (2 ^ 2) ^ ])New (^:22) 0.5j_0.5)
>> > 1.24627511j4.53236014
>> >
>> >   (8 + (2 ^ ]) - (2 ^ 2) ^ ])X
>> > 8.8817842e_16j7.72083702e_15
>> >
>> >
>> >
>> > On Sun, Jan 28, 2018 at 9:27 PM, Raul Miller <[email protected]>
>> wrote:
>> >
>> >> Hmm...
>> >>
>> >> I had originally thought about calling out the (2^2)^x interpretation
>> >> as a possibility, because rejected that, because that would be better
>> >> expressed as 4^x
>> >>
>> >> But it's possible that Skip got the 1.75379 number from someone who
>> >> thought different about this.
>> >>
>> >> And, to be honest, it is an ambiguity in the original expression -
>> >> just one that I thought should be rejected outright, rather than
>> >> suggested.
>> >>
>> >> Which gets us into another issue, which is that what one person would
>> >> think is obviously right is almost always what some other person would
>> >> think is obviously wrong... (and this issue crops up all over, not
>> >> just in mathematic and/or programming contexts).
>> >>
>> >> --
>> >> Raul
>> >>
>> >>
>> >> On Sun, Jan 28, 2018 at 9:08 PM, Rob Hodgkinson <[email protected]>
>> wrote:
>> >>> @Skip
>> >>>
>> >>> Skip, I am a confused in your original post… your actual post read;
>> >>>
>> >>> ================================================
>> >>> What is the best iterative way to solve this equation:
>> >>> (-2^2^x) + (2^x) +8 =0
>> >>> then later to Raul,
>> >>> 0 = 8 + (2^x) - 2^2^x    NB. Is correct, and the answer is real
>> >>> The answer is close to 1.75379
>> >>> ================================================
>> >>>
>> >>> However I suspect your original syntax was not J syntax (could it have
>> >> been math type syntax ?) as it differs on the J style right-to-left
>> syntax
>> >> on the 2^2^x expression.
>> >>>
>> >>> The 2 possible interpretations are shown below and only the Excel type
>> >> syntax seems to get close to your expected answer.
>> >>>
>> >>> NB. Excel interpretation
>> >>>   x,"0 (3 : '8+(2^x)-((2^2)^x)') x=:1.6+0.05*i.8
>> >>> 1.6        1.84185
>> >>> 1.65       1.28918
>> >>> 1.7        0.692946
>> >>> 1.75       0.0498772                NB. intercept seems close to your
>> >> expected value of 1.75379
>> >>> 1.8    _0.64353
>> >>> 1.85  _1.39104
>> >>> 1.9    _2.19668
>> >>> 1.95  _3.06478
>> >>>
>> >>> NB. J style interpretation
>> >>>   x,"0 (3 : '8+(2^x)-(2^2^x)') x=:1.6+0.05*i.8
>> >>> 1.6      2.85522
>> >>> 1.65    2.33325
>> >>> 1.7      1.74188
>> >>> 1.75    1.07063
>> >>> 1.8      0.307207                 NB. But in this model the intercept
>> is
>> >> above 1.8, but this is the model that has been coded in responses to
>> your
>> >> post ??
>> >>> 1.85  _0.562844
>> >>> 1.9    _1.5566
>> >>> 1.95  _2.69431
>> >>>
>> >>> Please clarify, thanks, Rob
>> >>>
>> >>>
>> >>>> On 29 Jan 2018, at 12:48 pm, Jose Mario Quintana <
>> >> [email protected]> wrote:
>> >>>>
>> >>>> Moreover, apparently there is at least another solution,
>> >>>>
>> >>>>  ((-2^2^X) + (2^X) +8 ) [  X=. 2.9992934709539156j_13.597080425481581
>> >>>> 5.19549681e_16j_2.92973749e_15
>> >>>>
>> >>>>
>> >>>> On Sun, Jan 28, 2018 at 7:28 PM, Jose Mario Quintana <
>> >>>> [email protected]> wrote:
>> >>>>
>> >>>>> Are you sure?
>> >>>>>
>> >>>>>  u New
>> >>>>> - (u %. u D.1)
>> >>>>>
>> >>>>>  ,. (8 + (2 ^ ]) - 2 ^ 2 ^ ])New (^:(<22)) 1
>> >>>>>        1
>> >>>>> 3.44167448
>> >>>>> 3.25190632
>> >>>>> 3.03819348
>> >>>>> 2.7974808
>> >>>>> 2.53114635
>> >>>>> 2.25407823
>> >>>>> 2.00897742
>> >>>>> 1.86069674
>> >>>>> 1.82070294
>> >>>>> 1.81842281
>> >>>>> 1.81841595
>> >>>>> 1.81841595
>> >>>>> 1.81841595
>> >>>>> 1.81841595
>> >>>>> 1.81841595
>> >>>>> 1.81841595
>> >>>>> 1.81841595
>> >>>>> 1.81841595
>> >>>>> 1.81841595
>> >>>>> 1.81841595
>> >>>>> 1.81841595
>> >>>>>
>> >>>>>  (8 + (2 ^ ]) - 2 ^ 2 ^ ]) 1.81841595
>> >>>>> _8.21739086e_8
>> >>>>>
>> >>>>>  (8 + (2 ^ ]) - 2 ^ 2 ^ ]) 1.75379
>> >>>>> 1.01615682
>> >>>>>
>> >>>>> PS.  Notice that New is a tacit version (not shown) of Louis' VN
>> >> adverb.
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>> On Sun, Jan 28, 2018 at 5:52 PM, Skip Cave <[email protected]>
>> >>>>> wrote:
>> >>>>>
>> >>>>>> Raul,
>> >>>>>>
>> >>>>>> You had it right in the first place.
>> >>>>>>
>> >>>>>> 0 = 8 + (2^x) - 2^2^x    NB. Is correct, and the answer is real
>> >>>>>>
>> >>>>>> The answer is close to 1.75379
>> >>>>>>
>> >>>>>> I wanted to know how to construct the Newton Raphson method using
>> the
>> >>>>>> iteration verb N described in the link: http://code.jsoftware.
>> >>>>>> com/wiki/NYCJUG/2010-11-09
>> >>>>>> under "A Sampling of Solvers - Newton's Method"
>> >>>>>>
>> >>>>>> N=: 1 : '- u % u d. 1'
>> >>>>>>
>> >>>>>> Skip
>> >>>>>>
>> >>>>>>
>> >>>>>>
>> >>>>>>
>> >>>>>>
>> >>>>>> Skip Cave
>> >>>>>> Cave Consulting LLC
>> >>>>>>
>> >>>>>> On Sun, Jan 28, 2018 at 4:38 PM, Raul Miller <[email protected]
>> >
>> >>>>>> wrote:
>> >>>>>>
>> >>>>>>> Eh... I *think* you meant what would be expressed in J as:
>> >>>>>>>
>> >>>>>>> 0 = 8 + (2^x) - 2^2^x
>> >>>>>>>
>> >>>>>>> I'd probably try maybe a few hundred rounds of newton's method
>> first,
>> >>>>>>> and see where that leads.
>> >>>>>>>
>> >>>>>>> But there's an ambiguity where the original expression (depending
>> on
>> >>>>>>> the frame of reference of the poster) could have been intended to
>> be:
>> >>>>>>>
>> >>>>>>> 0 = 8 + (2^x) + _2^2^x
>> >>>>>>>
>> >>>>>>> [if that is solvable, x might have to be complex]
>> >>>>>>>
>> >>>>>>> Thanks,
>> >>>>>>>
>> >>>>>>> --
>> >>>>>>> Raul
>> >>>>>>>
>> >>>>>>> On Sun, Jan 28, 2018 at 5:25 PM, Skip Cave <
>> [email protected]>
>> >>>>>>> wrote:
>> >>>>>>>> What is the best iterative way to solve this equation:
>> >>>>>>>>
>> >>>>>>>> (-2^2^x) + (2^x) +8 =0
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>> Skip Cave
>> >>>>>>>> Cave Consulting LLC
>> >>>>>>>> ------------------------------------------------------------
>> >>>>>> ----------
>> >>>>>>>> For information about J forums see http://www.jsoftware.com/forum
>> >>>>>> s.htm
>> >>>>>>> ------------------------------------------------------------
>> >> ----------
>> >>>>>>> For information about J forums see http://www.jsoftware.com/
>> >> forums.htm
>> >>>>>> ------------------------------------------------------------
>> >> ----------
>> >>>>>> For information about J forums see http://www.jsoftware.com/
>> >> forums.htm
>> >>>>>>
>> >>>>>
>> >>>>>
>> >>>> ------------------------------------------------------------
>> ----------
>> >>>> For information about J forums see http://www.jsoftware.com/
>> forums.htm
>> >>>
>> >>> ----------------------------------------------------------------------
>> >>> For information about J forums see http://www.jsoftware.com/forums.htm
>> >> ----------------------------------------------------------------------
>> >> For information about J forums see http://www.jsoftware.com/forums.htm
>> >>
>> > ----------------------------------------------------------------------
>> > For information about J forums see http://www.jsoftware.com/forums.htm
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to