but in the sample graph given y values range from - 400000 to + 400000. is the graph…
- User
but in the sample graph given y values range from - 400000 to + 400000. is the graph wrong or my code?
Assistant
Your code is correct – the y-values really do span roughly ±400 000 for the polynomial
f(x)=1.2x³+0.5x²+2x−5 over the interval x∈[−100,100].Quick check at the extremes:
- x = −100 → 1.2(−100)³ = −1 200 000
- x = 100 → 1.2(100)³ = +1 200 000
The quadratic and linear terms add only a few percent more, so the range is indeed on the order of ±1.2 million.
The sample graph you were shown must have been plotted over a much smaller x-range (e.g., −10 to 10), which would give y-values in the thousands, not hundreds of thousands.Nothing is wrong with your implementation; the difference is simply the x-axis limits used in the two plots.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.