1. ABS(sequence)?
- Posted by Tor Bernhard Gausen <tor.gausen at C2I.NET> Feb 10, 1999
- 474 views
I ran into this silly little problem, but I'm not able to figure it out... At least not tonight. How do I get the absolute value of a variable? I can not use the IF statement, since I need to operate on sequences (and setting up a loop is not very tempting, since I feel the need for speed). Any help would be greatly appreciated. Thanks, Tor Bernhard Gausen
2. Re: ABS(sequence)?
- Posted by Adam Weeden <theskaman at MINDSPRING.COM> Feb 09, 1999
- 450 views
- Last edited Feb 10, 1999
------=_NextPart_000_0023_01BE5486.F78CC020 charset="iso-8859-1" >How do I get the absolute value of a variable? > >I can not use the IF statement, since I need to >operate on sequences (and setting up a loop is >not very tempting, since I feel the need for speed). As far as I can see. (And in my experience). there is no other way BESIDES using if and at least a while or a for loop. Adam Weeden WeedenSoft Technologies Available soon at weedensoft.com ------=_NextPart_000_0023_01BE5486.F78CC020 name="Adam W Weeden.vcf"
3. Re: ABS(sequence)?
- Posted by jiri babor <jbabor at PARADISE.NET.NZ> Feb 10, 1999
- 450 views
Wrong again: function abs(object x) --Carl's return x*((x>0)-(x<0)) end function -----Original Message----- From: Adam Weeden <theskaman at MINDSPRING.COM> To: EUPHORIA at LISTSERV.MUOHIO.EDU <EUPHORIA at LISTSERV.MUOHIO.EDU> Date: Wednesday, February 10, 1999 6:02 PM Subject: Re: ABS(sequence)? >>How do I get the absolute value of a variable? >> >>I can not use the IF statement, since I need to >>operate on sequences (and setting up a loop is >>not very tempting, since I feel the need for speed). > As far as I can see. (And in my experience). there is no other way BESIDES >using if and at least a while or a for loop. > >Adam Weeden >WeedenSoft Technologies > >Available soon at weedensoft.com >
4. Re: ABS(sequence)?
- Posted by Adam Weeden <theskaman at MINDSPRING.COM> Feb 10, 1999
- 452 views
------=_NextPart_000_00E0_01BE548C.BA12C720 charset="iso-8859-1" >Wrong again: > >function abs(object x) --Carl's > return x*((x>0)-(x<0)) >end function > I'm sorry that wasn't an algorithm I was aware of. P.S. When was I wrong the first time. ------=_NextPart_000_00E0_01BE548C.BA12C720 name="Adam W Weeden.vcf"
5. Re: ABS(sequence)?
- Posted by Roderick Jackson <rjackson at CSIWEB.COM> Feb 10, 1999
- 442 views
Hmm... you could square the number/sequence, then take the square root = of the=20 result. I doubt that would help in the speed department, though. AFAIK, the only (lower-math) operation that returns one value regardless = of sign is squaring. Otherwise you're probably stuck with a loop or IF = statement. Rod Jackson ---------- From: Tor Bernhard Gausen[SMTP:tor.gausen at C2I.NET] Sent: Tuesday, February 09, 1999 9:24 PM Subject: ABS(sequence)? I ran into this silly little problem, but I'm not able to figure it out... At least not tonight. How do I get the absolute value of a variable? I can not use the IF statement, since I need to operate on sequences (and setting up a loop is not very tempting, since I feel the need for speed). Any help would be greatly appreciated. Thanks, Tor Bernhard Gausen
6. Re: ABS(sequence)?
- Posted by "Carl R. White" <C.R.White at SCM.BRAD.AC.UK> Feb 10, 1999
- 441 views
On Wed, 10 Feb 1999, jiri babor wrote: ] function abs(object x) --Carl's ] return x*((x>0)-(x<0)) ] end function Not strictly true. It's *based* on mine... :) My functions run like this: function sgn(object x) -- Return sign(s) of/in an object return (x>0)-(x<0) end function function abs(object x) -- Return absolute value(s) of/in an object return x*sgn(x) end function -- Carl R White -- Final Year Computer Science at the University of Bradford E-mail........: cyrek- at -bigfoot.com -- Remove hyphens. Ta :) URL...........: http://www.bigfoot.com/~cyrek/ Uncrackable...: "19.6A.23.38.52.73.45 25.31.1C 3C.53.44.39.58"
7. Re: ABS(sequence)?
- Posted by jiri babor <jbabor at PARADISE.NET.NZ> Feb 11, 1999
- 480 views
Are you calling me a liar? Get stuffed, Carl! jiri -----Original Message----- From: Carl R. White <C.R.White at SCM.BRAD.AC.UK> To: EUPHORIA at LISTSERV.MUOHIO.EDU <EUPHORIA at LISTSERV.MUOHIO.EDU> Date: Thursday, February 11, 1999 3:41 AM Subject: Re: ABS(sequence)? >On Wed, 10 Feb 1999, jiri babor wrote: > >] function abs(object x) --Carl's >] return x*((x>0)-(x<0)) >] end function > >Not strictly true. It's *based* on mine... :) > >My functions run like this: > >function sgn(object x) -- Return sign(s) of/in an object > return (x>0)-(x<0) >end function > >function abs(object x) -- Return absolute value(s) of/in an object > return x*sgn(x) >end function > >-- >Carl R White -- Final Year Computer Science at the University of Bradford >E-mail........: cyrek- at -bigfoot.com -- Remove hyphens. Ta :) >URL...........: http://www.bigfoot.com/~cyrek/ >Uncrackable...: "19.6A.23.38.52.73.45 25.31.1C 3C.53.44.39.58" >
8. Re: ABS(sequence)?
- Posted by "Carl R. White" <C.R.White at SCM.BRAD.AC.UK> Feb 10, 1999
- 442 views
On Thu, 11 Feb 1999, jiri babor wrote: ] Are you calling me a liar? Get stuffed, Carl! jiri Just in a pedantic mood today. Trying to find people at this Uni who want to buy some computer equipment... :) puts(1, 'S' & (96 + {15,18,18,25}) -- :), Carl -- Carl R White -- Final Year Computer Science at the University of Bradford E-mail........: cyrek- at -bigfoot.com -- Remove hyphens. Ta :) URL...........: http://www.bigfoot.com/~cyrek/ Uncrackable...: "19.6A.23.38.52.73.45 25.31.1C 3C.53.44.39.58"
9. Re: ABS(sequence)?
- Posted by Jiri Babor <J.Babor at GNS.CRI.NZ> Feb 11, 1999
- 453 views
Carl, you wrote: >Just in a pedantic mood today. Trying to find people at this Uni who want >to buy some computer equipment... :) > >puts(1, 'S' & (96 + {15,18,18,25}) -- :), Pedantic? I'll show you pedantic: there is a missing closing round bracket at the end of your reluctant 'Sorry'. jiri
10. Re: ABS(sequence)?
- Posted by "Carl R. White" <C.R.White at SCM.BRAD.AC.UK> Feb 11, 1999
- 484 views
On Thu, 11 Feb 1999, Jiri Babor wrote: ] Pedantic? I'll show you pedantic: there is a missing closing round bracket at ] the end of your reluctant 'Sorry'. jiri Uh.. Jiri? No smiley here... Am I now "in the bad books" ? :( [ :) ? ] -- Carl R White -- Final Year Computer Science at the University of Bradford E-mail........: cyrek- at -bigfoot.com -- Remove hyphens. Ta :) URL...........: http://www.bigfoot.com/~cyrek/ Uncrackable...: "19.6A.23.38.52.73.45 25.31.1C 3C.53.44.39.58"
11. Re: ABS(sequence)?
- Posted by jiri babor <jbabor at PARADISE.NET.NZ> Feb 12, 1999
- 455 views
-----Original Message----- From: Carl R. White <C.R.White at SCM.BRAD.AC.UK> >On Thu, 11 Feb 1999, Jiri Babor wrote: > >] Pedantic? I'll show you pedantic: there is a missing closing round bracket at >] the end of your reluctant 'Sorry'. jiri > >Uh.. Jiri? No smiley here... Happy? >Am I now "in the bad books" ? :( [ :) ? ] Not in as many as I am! jiri