I don’t think that’s Linda’s problem here. Rather, she has S2 -y which will yield _6 */ S2 - y is still _6 So (S2 y) * */ S2 - y gives _36, and we end up with root(-36)
In general, the absolute value of taher2 is incorrect. eg, taher2 5 12 13 NB. Should be 30.... 0j8.75 Mike Please reply to mike_liz....@tiscali.co.uk. Sent from my iPad > On 6 Sep 2018, at 08:39, 'Bo Jacoby' via Programming > <programm...@jsoftware.com> wrote: > > > 3,4,5 (4 : 'y-x') 6 > > 3 4 1 > > (3,4,5) (4 : 'y-x') 6 > 3 2 1 > > you see? > > Den torsdag den 6. september 2018 09.26.56 CEST skrev Linda Alvord > <lindaalvor...@outlook.com>: > > I got a domain error. Is this right (in a complex plane)? > > > S2=: 13 :'-:+/y' > > taher2=: 13 : '%: (S2 y)* */ S2-y NB.[ S2=. -: +/ y' > > S2 3 4 5 > 6 > > taher2 3 4 5 > 0j6 > > taher2 > [: %: S2 * [: */ [: S2 - > > > ;:'[: %: ([: -: +/) * [: */ ([: -: +/) - ]' > ┌──┬──┬─┬──┬──┬─┬─┬─┬─┬──┬─┬─┬─┬──┬──┬─┬─┬─┬─┬─┐ > │[:│%:│(│[:│-:│+│/│)│*│[:│*│/│(│[:│-:│+│/│)│-│]│ > └──┴──┴─┴──┴──┴─┴─┴─┴─┴──┴─┴─┴─┴──┴──┴─┴─┴─┴─┴─┘ > > I'm more and more convinced that humans should write > Using 13 :, and then study boxed tacit. In this Cap > Tells me to think halve not match. Use times with insert not with things to > the right. Finally use square root > not root. > > Hope you have good classes! > > Linda > > -----Original Message----- > From: Programming <programming-boun...@forums.jsoftware.com> On Behalf Of > Cliff Reiter > Sent: Tuesday, September 4, 2018 8:52 AM > To: programm...@jsoftware.com > Subject: Re: [Jprogramming] Tacit form: How to handle intermediate result..? > > Your 13 created a tacit verb > > taher=: 13 : '%: s2 * */ s2-y [ s2=. -: +/ y' > taher > [: %: ([: -: +/) * [: */ ([: -: +/) - ] > > >> On 9/4/2018 7:50 AM, Martin Kreuzer wrote: >> Hi all - >> >> To calculate the area of a flat triangle, using Heron's formula, >> A(a,b,c)= sqrt( s2*(s2-a)*(s2-b)*(s2-c) ) I wrote a simple function >> doing this: >> >> * get the three sides (as list input y) >> * compute the half perimeter s2 >> * build the differences s2-y >> * build product >> * take square root >> >> My explicit solution looks like this >> >> taher=: 13 : '%: s2 * */ s2-y [ s2=. -: +/ y' >> >> and works >> >> taher 3 4 5 >> 6 >> >> Suggested tacit version looks like this (and works too) >> >> tahert=: [: %: ([: -: +/) * [: */ ([: -: +/) - ] >> >> Q: Is there a way to reference the intermediate result of ([: -: +/) >> the half perimeter s2 within the tacit expression, as has been done in >> the explicit..? >> [Guess the interpreter takes care of this anyway; my question aims at >> whether a shorter formulation could be reached.] >> >> Thanks >> -M >> >> ---------------------------------------------------------------------- >> For information about J forums see >> https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.j >> software.com%2Fforums.htm&data=02%7C01%7C%7C54f7c9bbd6b348dff2c508 >> d612653f7d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C63671662339303 >> 7195&sdata=x4R6JLnq1eX9JJ4REKcEmgY2eTHoc49xApSgXlAfPc8%3D&rese >> rved=0 > > ---------------------------------------------------------------------- > For information about J forums see > https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&data=02%7C01%7C%7C54f7c9bbd6b348dff2c508d612653f7d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636716623393037195&sdata=x4R6JLnq1eX9JJ4REKcEmgY2eTHoc49xApSgXlAfPc8%3D&reserved=0 > ---------------------------------------------------------------------- > 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