HP Forums
Plotting a function not working correctly - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Plotting a function not working correctly (/thread-3630.html)



Plotting a function not working correctly - Ollie - 04-13-2015 03:46 PM

Hey!
I've been experimenting and finding roots of polynomials graphically but today I came across a weird glitch.
I tried to plot the following function: 0.1x^5 + 1.3x^4 - x^3 - 15x^2 - 8x - 1, a function that has 5 different roots.
The problem is that I cannot see the line that is supposed to cross the x-axis for the first time, all I see are very sparsely scattered dots instead of a continuous line.
Has anyone else come across such a problem before on the Prime? If so, have you found a fix for it?


RE: Plotting a function not working correctly - Han - 04-13-2015 04:32 PM

(04-13-2015 03:46 PM)Ollie Wrote:  Hey!
I've been experimenting and finding roots of polynomials graphically but today I came across a weird glitch.
I tried to plot the following function: 0.1x^5 + 1.3x^4 - x^3 - 15x^2 - 8x - 1, a function that has 5 different roots.
The problem is that I cannot see the line that is supposed to cross the x-axis for the first time, all I see are very sparsely scattered dots instead of a continuous line.
Has anyone else come across such a problem before on the Prime? If so, have you found a fix for it?

Check your plot settings. Press [Shift][Plot] to open the plot settings, and look at the second page of settings (use the menu option at the bottom of the screen to get to different pages of settings).


RE: Plotting a function not working correctly - John Colvin - 04-13-2015 06:56 PM

(04-13-2015 03:46 PM)Ollie Wrote:  Hey!
I've been experimenting and finding roots of polynomials graphically but today I came across a weird glitch.
I tried to plot the following function: 0.1x^5 + 1.3x^4 - x^3 - 15x^2 - 8x - 1, a function that has 5 different roots.
The problem is that I cannot see the line that is supposed to cross the x-axis for the first time, all I see are very sparsely scattered dots instead of a continuous line.
Has anyone else come across such a problem before on the Prime? If so, have you found a fix for it?

Plots ok on my Prime. You have to zoom in on the x-axis quite a bit to see where the curve crosses the axis. As Han suggested, check your plot settings to make sure your plot style is either fixed step segments or Adaptive-not fixed step dots.


RE: Plotting a function not working correctly - Ollie - 04-18-2015 11:43 AM

Unfortunately I'm still having problems with this.
I can see all the other intersections but there's one missing at x ~ -12.91
[Image: 315b2ff8f2.png]
Settings:
[Image: 05a7546c2e.png]
The more I go up the more lonely single dots I can see on the curve. :/
[Image: f13b9a1213.png]


RE: Plotting a function not working correctly - Tugdual - 04-18-2015 12:05 PM

(04-18-2015 11:43 AM)Ollie Wrote:  Unfortunately I'm still having problems with this.
I can see all the other intersections but there's one missing at x ~ -12.91
[Image: 315b2ff8f2.png]
Settings:
[Image: 05a7546c2e.png]
The more I go up the more lonely single dots I can see on the curve. :/
[Image: f13b9a1213.png]
Nothing really new to me here... Note that the 50g does a perfect job here, just much slower.


RE: Plotting a function not working correctly - Ollie - 04-18-2015 12:09 PM

(04-18-2015 12:05 PM)Tugdual Wrote:  Nothing really new to me here... Note that the 50g does a perfect job here, just much slower.

Are you trying to say that this is intended and not a bug/glitch of some sort?
Because if it is then that's just outright dumb, even my TI84 can graph the function perfectly without leaving any lonely dots on the curve.


RE: Plotting a function not working correctly - Tugdual - 04-18-2015 12:19 PM

(04-18-2015 12:09 PM)Ollie Wrote:  
(04-18-2015 12:05 PM)Tugdual Wrote:  Nothing really new to me here... Note that the 50g does a perfect job here, just much slower.

Are you trying to say that this is intended and not a bug/glitch of some sort?
Because if it is then that's just outright dumb, even my TI84 can graph the function perfectly without leaving any lonely dots on the curve.
I don't think it is intended, I'm just meant that it is a glitch I have seen a long time ago and was never fixed.


RE: Plotting a function not working correctly - Marcel - 04-18-2015 12:50 PM

Hi,
If you use the Advanced Graphing, you will see the correct graph, but this is very long and not very practicaly. All my TI calculator can graph this fonction correctly!
Marcel


RE: Plotting a function not working correctly - CR Haeger - 04-18-2015 02:49 PM

I'll ch k this out when I get home.

In the meantime, try out solve(), zeros() and fsolve() in CAS which should all give you solutions quickly.


RE: Plotting a function not working correctly - Alberto Candel - 04-18-2015 04:52 PM

Hi,

It looks like to be able to see the whole part of the graph that includes all roots, you need to set the x-range to include all roots, and the y-range to be at least the max/min of your polynomial over the selected x-range. In this case x from -15 to 15 and y from -100 to 100 seem to work. An estimate for the x-range can be easily found (Lagrange).


RE: Plotting a function not working correctly - Ollie - 04-18-2015 05:38 PM

(04-18-2015 04:52 PM)Alberto Candel Wrote:  Hi,

It looks like to be able to see the whole part of the graph that includes all roots, you need to set the x-range to include all roots, and the y-range to be at least the max/min of your polynomial over the selected x-range. In this case x from -15 to 15 and y from -100 to 100 seem to work. An estimate for the x-range can be easily found (Lagrange).

Ooh, It works!
It seems like the calculator sort of dismisses the parts that go outside your x- and y-ranges but setting the correct ranges fixes it.
Kinda annoying, but I guess we can live with it.
Thanks!


RE: Plotting a function not working correctly - Alberto Candel - 04-19-2015 12:23 AM

The max of your polynomial over the range of the roots (like -15<x<3) is not larger than 3000, but the plot shows the relevant part (the 5 roots) with a y-range setting of about +/-100.