Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7512815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:59:16+00:00 2026-05-29T23:59:16+00:00

I am trying to find the minimax polynomial approximation for sine and cosine using

  • 0

I am trying to find the minimax polynomial approximation for sine and cosine using the remez exchange algorithm in MATLAB. The need precision out to 23 bits because I am implementing the sine and cosine functions for IEEE-754 floating point.

Using this link here (refer to pages 8 through 15), the instructions are given for finding the polynomial using Mathematica and Maple, however, I am not sure how to extrapolate these methods for MATLAB.

According to Table 3, I need to use a 5th or 6th order polynomial to get ~23 bits (after the decimal point) of accuracy.

I am planning on first performing a range reduction of all incoming theta to between -pi/4 to +pi/4, then performing the sine or cosine function as necessary (The end goal is to implement exp(i*x) = cos(x) + i*sin(x).

I might be able to follow the instructions of this paper myself, but I don’t know how to use the remez function for my purposes here. Also, I don’t follow why the author used equation (6) (on page 9), nor do i understand how the equation for k (on page 11) was determined (where does 2796201 come from?) and why does the defining form of the polynomial we want to end up with change to sin9x) = x + kx^3 + x^5*P(x^2).

Would it be better to use the firpm function instead (since remez is deprecated)?

Thank you, all help and guidance are greatly appreciated, as well as edits to ensure the best answer possible to my question.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T23:59:17+00:00Added an answer on May 29, 2026 at 11:59 pm

    I’d not bother trying to develop approximations of your own. Simpler is to pick up a copy of “Computer Approximations”, Hart, et al. A good university library should have it. 23 bits is about 7 decimal digits, so just pick an approximation that gives you the accuracy you need. You can choose either a simple polynomial approximation, or use a rational polynomial, usually a bit better as long as you can tolerate the divide.

    Range reduction does make sense, in fact, I chose the same range (+/-pi/4) in my own tools because this choice of range is particularly easy to work with.

    Edit: (An example of the use of the approximations one can find in Hart.)

    Here I’ll find an approximation for sin(x), where x lies in the interval [0,pi/4]. My goal will be to choose an approximation with absolute accuracy of at least 1.e-7 over that interval. Of course, if you have a negative value for x, we know that sin(x) is an odd function, so this is trivial.

    I note that the approximations in Hart tend to be of the form sin(alphapix), where x lies in the interval [0,1]. If I then choose an approximation for alpha = 1/2, I’d get an approximation that is valid over the chosen interval. So for an approximation over the interval [0,pi/4] we look for alpha = 1/4.

    Next, I look for an approximation that is indicated to have absolute accuracy of at least 7 digits or so, and I’ll prefer to use rational polynomial approximations, since they tend to be a bit more efficient. Scanning down the tables on page 118 (my copy of Hart is from 1978) I find an approximation with alpha = 1/4 that fits the bill: index 3060.

    This approximation will be of the form

    sin(alpha*pi*x) = x*P(x^2)/Q(x^2)
    

    So now I tab over to the page that gives the coefficients for SIN 3060. In my copy, it falls on pages 199-200. There are 5 coefficients, P00, P01, P02, Q00, Q01. (Watch out for the somewhat non-standard scientific notation used here.) Thus P (the numerator polynomial) has 3 terms in it, while Q, the denominator has 2 terms. Writing it out, I get this:

    sin(alpha*pi*x) = (52.81860134812 -4.644800481954*x^3 + 0.0867545069521*x^5)/ ...
        (67.250731777791 + x^2)
    

    Lets try it now in MATLAB.

    x = linspace(0,pi/4,10001);
    xt = x*4/pi; % transform to [0,1]
    sine = @(x) (52.81860134812*x -4.644800481954*x.^3 + ...
         0.0867545069521*x.^5)./(67.250731777791 + x.^2);
    
    max(abs(sin(x) -sine(xt)))
    ans =
       1.6424e-09
    
    plot(x,sin(x)- sine(xt),'-')
    

    Error for the sin approximation over [0,pi/4]

    Note the 1e-9 attached to the y-axis.

    It looks like this is the most reasonable choice of approximation for sin(x) over that specific interval, although this gives about 29 bits of accuracy instead of the 23 bits you asked for. If you are willing to choose a different range reduction interval, there are a few choices that might save a term, possibly at a cost of a few bits that you don’t need.

    log2(max(abs(sin(x) -sine(xt))))
    ans =
          -29.182
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using SQL2008, I'm trying to figure out an efficient query to find a row
Trying to find out if it's possible to use SQLAlchemy on Heroku. Thanks.
Trying to find an example that has css rollover using sprites & sliding door
While trying to find an answer to Android Jasper Reporting I found out that
I'm trying to apply minimax algorithm for the game tictactoe 3D in c++. I'm
We are trying to find out any technologies/libraries available in .NET stack (even wrappers
I am trying find out what is postgres can handle safely inside of transaction,
I'm trying to brand our SharePoint 2010 site using designer but can't find the
I'm trying to find a minimal adequate model using AIC in R. I keep
As a follow-up to this question , it's trying to find out how to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.