> however, for instance, > ((0&^)d.1) _1 > __ > is beyond my comprehension. Can anybody > explain this result?
Standard (or naive) way to evaluate integral of some number to the power x. integral of a^x dx can be rewritten as integral exp(log(a)*x) dx which can be easily evaluated to exp(log(a)*x) / log(a) and simplified to a^x/log(a) Which is fine... as long as the log of a is defined. But at a = 0, log(a) = __. Which blows up the whole thing. J's d. operator has a few issues, handling this is just one of them. Another issue: ((_9&^)d.1) NB. integral of (-9)^x gives _0.244136j_0.349606 That is clearly wrong. My fix should clear up a few of these issues. -------------------------------------------- On Mon, 10/2/17, Jose Mario Quintana <jose.mario.quint...@gmail.com> wrote: Subject: Re: [Jsource] d. fix To: sou...@jsoftware.com Date: Monday, October 2, 2017, 2:43 PM " My main point was that I'm not sure how the best way to handle integral of 0^x is. I guess it could be considered the integral of 0 (i.e. 0^x = 0). So ... " It seems that J evaluates 0^x as follows: _ if x < 0 1 if x = 0 0 if x > 0 So, which is the function, apart from adding a constant, whose derivative is 0&^? If x > 0 I would say it is 0"0; otherwise, it might be wise to regard it as undefined. Consider the derivative of 0^x, according to J, (0&^)d.1 __&*@(0&^) If x > 0 the evaluation makes sense to me; however, for instance, ((0&^)d.1) _1 __ is beyond my comprehension. Can anybody explain this result? NB. Wolfram Alpha NB. https://www.wolframalpha.com/input/?i=d%2Fdx(+0%5Ex) NB. d/dx(0^x) NB. 0 if x >0 NB. indeterminate otherwise Incidentally, although Wolfram Alpha regards 0^0 as undefined, it is fine with integral x^0 dx and agrees with J... NB. Wolfram Alpha NB. https://www.wolframalpha.com/input/?i=integral+x%5E0+dx NB. integral x^0 dx NB. x + constant (^&0)d._1 [ NB. Wolfram Alpha NB. https://www.wolframalpha.com/input/?i=d%2Fdx(+integral+x%5E0+dx) NB. d/dx( integral x^0 dx) NB. 1 (^&0)d._1 d.1 1 On Sun, Oct 1, 2017 at 9:18 PM, 'Jon Hough' via Source <sou...@jsoftware.com > wrote: > Yes, the sentence I wrote is essentially gibberish. I'll put it down to > tiredness. (J only defines 0^0 as 1). > My main point was that I'm not sure how the best way to handle integral of > 0^x is. I guess it could be considered the > integral of 0 (i.e. 0^x = 0). So > > (0&^) d. _1 > could either be 0 (+ some constant) > or > undefined. > > Wolfram Alpha decides to go with undefined. Seems reasonable, since if you > are trying to integrate 0^x anyway, you probably have other issues with > your code. > -------------------------------------------- > On Mon, 10/2/17, Jose Mario Quintana <jose.mario.quint...@gmail.com> > wrote: > > Subject: Re: [Jsource] d. fix > To: sou...@jsoftware.com > Date: Monday, October 2, 2017, 1:38 AM > > Ups! I think Jon might have in > mind x^0 as opposed to 0^x. > > On > Sun, Oct 1, 2017 at 12:28 PM, Jose Mario Quintana < > jose.mario.quint...@gmail.com> > wrote: > > > Knuth's > saying influencing the IEEE floating point standard pow > > function[[0] might be the main reason why > "most programming languague[s] > > ... > evaluate 0^0 as 1." > > > > At any rate, since J also evaluates 0^0 as > 1, Jon's point 0^x =1 is > > consistent > with J's evaluation of 0^x for any x (although ignoring, > for > > example, 0^_). > > > > [0] > > https://en.wikipedia.org/wiki/Exponentiation#Treatment_on_computers > > > > On Sun, Oct 1, 2017 > at 11:22 AM, Roger Hui <rogerhui.can...@gmail.com> > > wrote: > > > >> > Right, J, among several other > programming languages, regards 0^0 as 1. > >> > Wolfram Alpha and some > programming languages regard 0^0 as undefined: > >> > >> > https://www.wolframalpha.com/input/?i=0%5E0 > >> > >> On this point > (0^0 being undefined), Knuth says in *Two Notes on > Notation > >> <https://arxiv.org/PS_cache/math/pdf/9205/9205211v1.pdf>*, > >> > >> But no, > no, ten thousand times no! > >> > >> Some authors who say that 0^0 is > undefined continue to write polynomials > >> blithely as sigma(i=0,n) a[i] times x > ^ i. > >> > >> > >> > >> > >> On Sun, Oct 1, 2017 at 8:11 AM, Jose > Mario Quintana < > >> jose.mario.quint...@gmail.com> > wrote: > >> > >> > > " > >> > (0&^) d. _1 > gives a domain error. Possibly this is unwanted, I mean, > it > >> > could be considered as a > constant since 0^x = 1 in usual understanding, > >> but > >> > > Wolfram Alpha also has issues with this: > >> > https://www.wolframalpha.com/input/?i=integrate+0%5Ex > >> > " > >> > > > >> > Right, J, among several > other programming languages, regards 0^0 as 1. > >> > Wolfram Alpha and some > programming languages regard 0^0 as undefined: > >> > > >> > https://www.wolframalpha.com/input/?i=0%5E0 > >> > > >> > > >> > > >> > On > Sun, Oct 1, 2017 at 10:42 AM, 'Jon Hough' via Source > < > >> > sou...@jsoftware.com> > wrote: > >> > > >> > > I have made a couple of > minor edits and added some comments, and J > >> > syntax: > >> > > > https://github.com/jonghough/jsource/blob/master/jsrc/cd.c > LINES > >> 281 - > >> > > 301 > >> > > > > >> > > A couple of > points. > >> > > > >> > > (0&^) d. _1 gives a > domain error. Possibly this is unwanted, I mean, > >> it > >> > > > could be considered as a constant since 0^x = 1 in usual > >> understanding, > >> > but > >> > > > Wolfram Alpha also has issues with this: > >> > > https://www.wolframalpha.com/input/?i=integrate+0%5Ex > >> > > > >> > > > Negative bases for exponentials give complex > results. This is > >> > > > mathematically correct, but thought I would mention it > anyway. > >> > > e.g. > >> > > (_2&^) d. _1 > >> > > > %&0.693147180559945286j3.14159265358979312@(_2&^) > NB. > >> correct > >> > > see: https://www.wolframalpha.com/input/?i=integrate+(-2)%5Ex > >> > > > >> > > > Compare this to current J, where > >> > > (_2&^) d. _1 > >> > > gives a domain error. > >> > > > -------------------------------------------- > >> > > On Fri, 9/29/17, 'Jon > Hough' via Source <sou...@jsoftware.com> > wrote: > >> > > > >> > > Subject: Re: [Jsource] d. > fix > >> > > To: sou...@jsoftware.com > >> > > Date: Friday, September > 29, 2017, 12:15 PM > >> > > > >> > > Sorry Henry, > >> > > > >> > > > I somehow missed this email in my > >> > > inbox. > >> > > > >> > > > I will get the fixes you need done this > >> > > weekend. > >> > > > >> > > > Regards, > >> > > > Jon > >> > > > >> > > > -------------------------------------------- > >> > > On Mon, 9/25/17, Henry > Rich <henryhr...@gmail.com> > >> > > wrote: > >> > > > >> > > > Subject: [Jsource] d. fix > >> > > To: "'Jon > Hough' via Source" <sou...@jsoftware.com> > >> > > Date: Monday, September > 25, 2017, 1:06 > >> > > AM > >> > > > >> > > > John, > >> > > > >> > > I finally have my PC > back and > >> > > would > >> > > like to get your fix in > before > >> > > the next build, > which is happening > >> > > > any > >> > > day now. > However, I have issues > >> > > > with it: > >> > > > >> > > 1. Needs commentary. > The JE didn't > >> > > have > much to begin with & that > >> > > > needs > >> > > to > improve. So at least put in > >> > > > enough > >> > > > commentary that a reader can tell > >> > > > what you are doing without reading > >> > > the > >> > > C code. I put in an > average of > >> > > about one > line of comment for each > >> > > > line > >> > > of C. As > it stands it will me > >> > > > more time than I care to spend to > >> > > > verify that what you are doing is > >> > > valid. > >> > > > >> > > > As part of the commentary, translate > >> > > those long calls > [amp(ds(CDIV...] to > >> > > > J. > >> > > > >> > > 2. AT(x)==INT is no good, > because > >> > > there > >> > > may be flags set in > more > >> > > significant bits > of the type. Use > >> > > > (AT(x)&INT) > >> > > > >> > > When you respond, send me > your new > >> > > testcase > (gddot, I think) and point > >> > > > me to the fix, perhaps by simply > >> > > sending me the new > cd.c. > >> > > > >> > > hhr > >> > > > >> > > > > ------------------------------------------------------------ > >> ---------- > >> > > > For information about J forums see http://www.jsoftware.com/forum > >> s.htm > >> > > > > ------------------------------------------------------------ > >> ---------- > >> > > > For information about J forums see http://www.jsoftware.com/forum > >> s.htm > >> > > > > ------------------------------------------------------------ > >> ---------- > >> > > > 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