To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.handyboardOpen lugnet.robotics.handyboard in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / Handy Board / 6165
6164  |  6166
Subject: 
Re: Dumb math question related to Navigation and encoders
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Wed, 5 May 1999 20:12:34 GMT
Original-From: 
Will Bain <WILLBAIN@CS.saynotospamUMT.EDU>
Viewed: 
805 times
  
Bob_Kelly/First_Union@firstunion-reit.com wrote:
How do you compute, using Handyboard Interactive C, the Sin, Cos, Tan,
Arctan, etc. ?

This is actually a very good question.

Generally, math function libraries use what is called a Taylor series
expansion of a trigonometric function to return an approximation to the
function with arbitrary precision.  The more terms from the series that
you add up, the more accurate the approximation.

The first few terms for the Taylor series expansion of arctan(x) are:

x - (1/3)x^3 + (1/5)x^5 - (1/7)x^7 + (1/9)x^9 - (1/11)x^11 + ...

The resulting angle is in radians.  This series will converge for x < 1
(if x is greater than 1, you can compute the series for 1/x, to give
pi/2 radians minus the angle you're looking for).

You could write a function that returns the series out to the first few
terms, and it would probably be close enough to arctan(x) to use for
dead reckoning.  For example, if x is 0.5773... (i.e., the angle is pi/6
= 30 degrees), then the last term above equals about 0.0002 radians
(about 0.01 degrees).  If you use a divide & conquer method for the
exponentiation, you could compute many terms in the series fairly
efficiently.

-- Will
                                          , ,
        __@_/             \_@__           |/
          |                /__,           o             @_/
          )\              )              ( \            (\/\\,
~~~~~~~~~ ' ` ~~~~~~~~~~~ ` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Wendy Parson,            Idealism is fine, but as it approaches reality
Will Bain,                                the cost becomes prohibitive.
& Tatoosh                                     --William F. Buckley, Jr.



Message is in Reply To:
  Dumb math question related to Navigation and encoders
 
How do you compute, using Handyboard Interactive C, the Sin, Cos, Tan, Arctan, etc. ? Is there some sort of built in math library file that I can use or is it some sort of formula? I want to implement some rough dead reckoning ability and this stuff (...) (25 years ago, 5-May-99, to lugnet.robotics.handyboard)

3 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR