j

Differentiation in J


I am a beginner learning J based on this book (2015 version). I was able to run all examples until this one from the calculus chapter:

   ^&3  d. 1
3&*@(^&2)

I get this error locally:

|spelling error (invalid inflection)
|   ^&3 d. 1
|       ^

Can someone share the correct way to compute this derivative in J?

I run the following J version:

   9!:14 ''
j9.5.2/j64arm/darwin/commercial/www.jsoftware.com/2024-02-02T18:38:04/clang-14-0-0/SLEEF=1

and get a similar error in J Playground.


Solution

  • From Obsolete Syntax:

    Support for calculus (d. D. D:) - the functions of these primitives are provided by the math/calculus addon

    You can read more, including the reasoning for the removal of the primitives, at Addons/math/calculus.

    You have to install 'math/calculus', though I think on the playground you need to use the github link instead:

    install'github:jsoftware/math_calculus'
    require'math/calculus'
    ^&3 deriv_jcalculus_ 1