Mathbag.e is updated... Was: recursive arccos function...

new topic     » topic index » view thread      » older message » newer message

On Tue, 30 Sep 1997, Lee woo seob wrote:

> Hi all!
>
> following codes are the recursive version of "arccos" function
> which accept both the atom value, and the sequence of arbitrary structure.
> However, since it is my first trial of "recursive programming",
> i'm not sure if it has no leaks for all the conditions.
>
> Dear respectable programming gurus in this list, please check my
> codes and tell me whether this codes are correct or not!
>
> Bye -- from Lee, wooseob
> -------------------- codes start here ---------------------------------
> constant Pi=arctan(1)*4
> function arccos(object x)
>     sequence s
>     if atom(x) then
>         if x=1 then return 0
>         elsif x=-1 then return Pi
>         else return -arctan(x/sqrt(-x*x+1)) + Pi/2
>         end if
>     else
>         s={}
>         for i=1 to length(x) do s=s&{arccos(x[i])} end for
>         return s
>     end if
> end function
> ---- test program
> sequence s
> s={0.1,0.2,{{0.1,0.2}},0.3,{0.3}}
> ?arccos(s)
> ------------------- codes end here ------------------------------------

I've managed to upgrade mathbag.e, and *all* functions that can be,
(arcsin, arccos, etc.) *are* sequence compliant/coherent, and no recursion
was needed. It even avoids nasty divide by zero errors...

The new version is avaiable from:

    http:/www.student.comp.brad.ac.uk/~crwhite/public/euphoria/mathbag.e

...right now.

For those still having trouble with may web page, I'm working on a fix,
and if you want anything in the meantime, mail me for it...

--
Carl R White   | e-mail...:                    crwhite- at -comp.brad.ac.uk
               | finger...:             crwhite- at -dcsun1.comp.brad.ac.uk
               | web......: http://www.student.comp.brad.ac.uk/~crwhite/
Anti-Spam: Remove x's from header and change '- at -' to '@' in .sig

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu