if you are given a function say f(x) = aXn + bXn-1 +...+z where Xn,Xn-1...are polynomials.
You dont need to worry about the function though.
Question:
If there is already a function call getFX(int x) that evaluates f(x) given x and returns the value, write a function does the reverse meaning given f(x) getX()?
Firstly, you dont have any idea of the function. Its a black box.
based on your suggestion it seems linear:
for example: f(x) = X^2 + X + 1;
now when x = 3, f(x) = 13
x = 6, f(x) = 43
using this information i can get y =10x -17, however if i have a value say f(x) = 111, it gives as x=12.8 and this is clearly wrong as x should have been 10 instead.
So this doe not take linearity as you have mentioned.
@chrisname: I am asking for suggestions as inputs if you dont feel the need to give one then you are not compelled to save your sarcasm. Thanks. Its a forum where ideas are exchanged.
I really don't think I understand the question.
Given a value, solve for x. Or given a function solve for x.
There is no method I know of to solve nth degree polynomial equations exactly; however, something like Newton's method comes to mind when asked to approximate.
This seems too complicated to be the answer though, so maybe I don't follow...
the thing is we dont have the exact f(x) function and we dont need to know the exact function. its a black box(but it is a polynomial).All you are given is a method that you could use , its the getFX(int x) function which returns the f(x) value given x. Now using this method create a function called getx() that returns the value of x instead given f(x).
I was stuck at this question and the only clue(not exactly a clue i would say) i was given was that it was something to do with roots and you had to use the f(x) function.