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 8354265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:29:57+00:00 2026-06-09T09:29:57+00:00

Problem: Given a polynomial of degree n (with coefficients a 0 through a n-1

  • 0

Problem: Given a polynomial of degree n (with coefficients a0 through an-1) that is guaranteed to be increasing from x = 0 to xmax, what is the most efficient algorithm to find the first m points with equally-spaced y values (i.e. yi – yi-1 == c, for all i)?

Example: If I want the spacing to be c = 1, and my polynomial is f(x) = x^2, then the first three points would be at y=1 (x=1), y=2 (x~=1.4142), and y=3 (x~=1.7321).


I’m not sure if it will be significant, but my specific problem involves the cube of a polynomial with given coefficients. My intuition tells me that the most efficient solution should be the same, but I’m not sure.

I’m encountering this working through the problems in the ACM’s problem set for the 2012 World Finals (problem B), so this is mostly because I’m curious.


Edit: I’m not sure if this should go on the Math SE?

  • 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-06-09T09:29:58+00:00Added an answer on June 9, 2026 at 9:29 am

    You can find an X for a given Y using a binary search. It’s logarithmic time complexity, proportional to the size of the range of x values, divided by your error tolerance.

    def solveForX(polyFunc, minX, maxX, y, epsilon):
        midX = (minX + maxX) / 2.0
        if abs(polyFunc(midX) - y) < epsilon:
            return midX
        if polyFunc(midX) > y:
            return solveForX(polyFunc, minX, midX, y, epsilon)
        else:
            return solveForX(polyFunc, midX, maxX, y, epsilon)
    
    print solveForX(lambda x: x*x, 0, 100, 2, 0.01)
    

    output:

    1.416015625
    

    Edit: to expand on an idea in the comments, if you know you will be searching for multiple X values, it’s possible to narrow down the [minX, maxX] search range.

    def solveForManyXs(polyFunc, minX, maxX, ys, epsilon):
        if len(ys) == 0:
            return []
        midIdx = len(ys) / 2
        midY = ys[midIdx]
        midX = solveForX(polyFunc, minX, maxX, midY, epsilon)
        lowYs = ys[:midIdx]
        highYs = ys[midIdx+1:]
        return solveForManyXs(polyFunc, minX, midX, lowYs, epsilon) + \
        [midX] + \
        solveForManyXs(polyFunc, midX, maxX, highYs, epsilon)
    
    ys = [1, 2, 3]
    print solveForManyXs(lambda x: x*x, 0, 100, ys, 0.01)
    

    output:

    [1.0000884532928467, 1.41448974609375, 1.7318960977718234]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Problem: Given a list of spheres, find all empty spaces that are completely enclosed
Problem: Given a list of strings, find the substring which, if subtracted from the
First the practical application that led me to the problem: Given a set of
Please help me out with an algorithm for the following problem - Given a
I have a homework question that says: Problem 1: Given the array [ 22
Problem: Given : n points that are strongly correlated to a 3d k-sided non-convex
Does anyone know an algorithm for the following problem: Given a undirected connected graph
I'm looking for a relatively efficient function to solve the following problem: Given records
Here is the problem : Give a algorithm that takes a positive integer n
I wrote a Javascript function that solves a typical problem: Given an HTML element,

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.