Mike, thanks. I noticed I missed that out too.

I have added fexp and merged.

Thanks,
Jon
     On Sunday, February 7, 2021, 09:19:56 PM GMT+9, 'Michael Day' via 
Programming <[email protected]> wrote:  
 
 For interest,  I had a look at the changes in the script.

I tried both derivatives,  and both failed in different ways:
a)  polynomials using p. :
    (1 2 3 & p. ) deriv 1   NB. result should be 2 6&p.
0&p.
    (0 & p. ) deriv 1  NB. ok!
0&p.

b)   f() ^ h()
    (*: ^ *:) deriv 1
|domain error: deriv_jcalculus_
|       13!:8(3)

After some puzzlement,  I traced the difficulties with each:
a)  line 170
      if. coeffs=. -: '' do. '0&p.' return.
should of course be
      if. coeffs -: '' do. '0&p.' return.

b) I couldn't see what was wrong until I realised that fexp is undefined!
So adding a definition along the lines of the other fops removes the 
error condition.

fexp =: 4 : 0
'((',x,')^(',y,'))'
)

I wouldn't dare try altering the online source code!

Cheers,

Mike

On 05/02/2021 04:34, 'Jon Hough' via Programming wrote:
> I wrote a bug report and fix in the source chat a couple of weeks ago. There 
> was no response, so I guess I wrote in the wrong chat.
>
> The calculus addon script has one glaring issue, and one small issue with an 
> easy fix.
>
> The glaring issue is the inability to differentiate the constant zero function
>
> 0&p.
>
> that gives an error.
>
> The fix is here: https://github.com/jsoftware/math_calculus/pull/2
>
> I think this should be fixed asap, as it also causes an error on double 
> differentiation of a linear polynomial.
>
> 1 2&p.
>
> The other issue is differentiating a general f^g function, which currently 
> gives an error, but is easily doable.
>
> Thanks,
> Jon
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm


-- 
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

----------------------------------------------------------------------
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