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

new topic     » topic index » view message » categorize

2. Re: ABS(sequence)?

------=_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"

new topic     » goto parent     » topic index » view message » categorize

3. Re: ABS(sequence)?

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
>

new topic     » goto parent     » topic index » view message » categorize

4. Re: ABS(sequence)?

------=_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"

new topic     » goto parent     » topic index » view message » categorize

5. Re: ABS(sequence)?

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

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

new topic     » goto parent     » topic index » view message » categorize

6. 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"

new topic     » goto parent     » topic index » view message » categorize

7. Re: ABS(sequence)?

Are you calling me a liar? Get stuffed, Carl!  jiri blink

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

new topic     » goto parent     » topic index » view message » categorize

8. Re: ABS(sequence)?

On Thu, 11 Feb 1999, jiri babor wrote:

] Are you calling me a liar? Get stuffed, Carl!  jiri blink

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"

new topic     » goto parent     » topic index » view message » categorize

9. Re: ABS(sequence)?

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

new topic     » goto parent     » topic index » view message » categorize

10. Re: ABS(sequence)?

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"

new topic     » goto parent     » topic index » view message » categorize

11. Re: ABS(sequence)?

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



smile smile smile smile smile smile smile smile  Happy?


>Am I now "in the bad books" ? :( [ :) ? ]


Not in as many as I am!  jiri

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu