Menu

#3 math.h

open
nobody
None
5
2015-02-28
2003-08-30
Anonymous
No

A maths library is urgently needed for BrickOS. Someone
has already had a go at:
http://news.lugnet.com/robotics/rcx/legos/?n=3269

This only includes a few functions.
I would expect a full version of math.h to include the
following mathematical functions:

sine
cosine
tangent
natural log (ln)
absolute value of a number (makes a number positive)
factorial (!)
square root

Discussion

  • Nobody/Anonymous

    Logged In: NO

    By the way, my email is: clarkrjk at yahoo dot com

     
  • William J Koontz

    Logged In: YES
    user_id=910801

    I have some functions to add to this.
    I got these power series formulas from math sites and converted
    them to C for brickOS.
    I tested them with a spreadsheet using Excel's SERIESSUM
    function.
    I have a spreadsheet and a jpg of a graph made with
    OpenOffice (I deleted windows so don't use excel anymore!)
    it compares the OpenOffice calc sine and cosine function
    values with the ones calculated with these power series, out
    to the same number of iterations I used in these BrickOS
    functions. The inverse functions and square root are
    similar in accuracy which is pretty good. We can credit
    Isaac Newton, and a few other mathmatical genuises for the math.
    The jpg is here: http://billkoontz.com/files/rcxmath.jpg
    The spreadsheet which was created in excel needs to be
    doctored up before I can edit it correctly in OpenOffice,
    since I used some charting features apparently not yet
    available in OpenOffice :( I'll post it on my website when I
    trim it down.
    I'll also continue working on this and try to add the other
    functions you mentioned, factorial and log should be easy, I
    thought I did ABS once but can't find it, hmmm....

     
  • William J Koontz

    Logged In: YES
    user_id=910801

    OOPS, forgot to put a link to the code!!!! DUH!!!
    Its also on my website: http://billkoontz.com/robots.html
    Just go here theres links to all that I mentioned....

     

Log in to post a comment.