Well, for example: https://code.jsoftware.com/wiki/Essays/Newton's_Method
If your function is not supported by J's differentiation mechanism, you would want to use a different approach. But the function you mention is differentiable and it looks like J can handle it: 9!:3(5) require 'math/calculus' %@(*: + ^.) deriv_jcalculus_ 1 (+: + %) * -@%@*:@(*: + ^.) So this suggests that you should expect good numbers from newton's method (assuming that that's a valid representation of the derivative of that function -- it looks right but I have not tested it adequately to say for sure). That said, you might want to plot the function, as a sanity check. For example: require'plot' plot %@(*: + ^.) 0.01*i.300 I hope this helps, -- Raul On Wed, Nov 4, 2020 at 10:58 PM Piet de Jong <[email protected]> wrote: > > I was hoping for more of a “J” type solution. > > For example if f(x,y) = (x^2 + log y)^{-1} = c > Then given c and say x, I can solve for y. (ie write J function) > Or given c and y I can solve for x. (ie write a J function) > (I’m assuming domains etc are ok. — this is just an example.) > > So instead of following this long process of finding the two functions I was > hoping in J there would be a “clean and tidy” way of doing things. > > Probably impossible even for simple functions f. > > > On 5 Nov 2020, at 2:24 pm, Raul Miller <[email protected]> wrote: > > > > The answer is: sometimes yes, sometimes no. > > > > See https://en.wikipedia.org/wiki/Equation_solving for some of the issues. > > > > If f can be expressed as a polynomial, you might want to consider > > using https://www.jsoftware.com/help/dictionary/dpdot.htm > > > > Thanks, > > > > -- > > Raul > > > > On Wed, Nov 4, 2020 at 7:27 PM Piet de Jong <[email protected]> wrote: > >> > >> Still trying to learn/improve my J after 25 years. > >> > >> Here is the issue. I’m probably having a pipe dream. > >> > >> Suppose you have an implicit function f(x,y)=0 which is relatively > >> “clean” (ie simple to specify) > >> > >> Is there a “clean/efficient” way in J to solve for y given x or vice versa. > >> > >> I know I can write a function g such that g x gives y and g^:_1 y gives > >> x. > >> But is there a cleaner way? The g and its inverse may be complicated > >> even if f is relatively simple. > >> ---------------------------------------------------------------------- > >> 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
