HP Forums
Why won't the prime graph 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: Why won't the prime graph correctly? (/thread-13012.html)



Why won't the prime graph correctly? - gba456 - 05-22-2019 02:16 PM

I'm trying to graph f(x) = x^0.4 * (x+3). However, it doesn't graph anything lower than x=0. Desmos graphs it correctly, but this doesn't. Any help?


RE: Why won't the prime graph correctly? - Aries - 05-22-2019 02:56 PM

Try y = x^(2/5)*(x+3) Wink
Best,

Aries Smile


RE: Why won't the prime graph correctly? - ijabbott - 05-22-2019 03:08 PM

(05-22-2019 02:16 PM)gba456 Wrote:  I'm trying to graph f(x) = x^0.4 * (x+3). However, it doesn't graph anything lower than x=0. Desmos graphs it correctly, but this doesn't. Any help?

It doesn't like fractional powers of negative numbers. Try this instead:

F1(X) = (5 NTHROOT X)^2 * (X+3)

Or:

F1(X) = (X^2)^0.2 * (X+3)


RE: Why won't the prime graph correctly? - DrD - 05-22-2019 04:34 PM

In Advanced Graphing, (using upper case variables): V1: Y=X^0.4*(X+3)

[attachment=7279]


RE: Why won't the prime graph correctly? - cyrille de brébisson - 05-23-2019 06:13 AM

Hello

The "problem" is that (-2)^0.4 is a complex number, not a real as most people have been lead to expect by their math teachers.

Prime does indeed graph the graph as mathematician would expect it.

power of a non decimal number is only equivalent to a nth root when x>=0, this "equivalence" does not carry on when x<0.

If you do want to calculate/draw the nth root, use the nthroot function.

Cyrille


RE: Why won't the prime graph correctly? - Aries - 05-23-2019 09:14 AM

Quite the contrary, teachers know very well what they are teaching, calculators are stupid and/or badly programmed Wink

[Image: funcgraph.jpg]

Best,

Aries Smile


RE: Why won't the prime graph correctly? - Nigel (UK) - 05-23-2019 03:42 PM

(05-23-2019 09:14 AM)Aries Wrote:  Quite the contrary, teachers know very well what they are teaching, calculators are stupid and/or badly programmed Wink
Best,

Aries Smile
I suppose different people have different opinions. Here are what the four calculators with me at school (I teach Physics) today say:
  • DM42: doing 1 +/- ENTER 3 1/x y^x gives the first complex cube root of -1, rather than -1.
  • WP34S: doing 1 +/- ENTER 3 1/x y^x gives DOMAIN ERROR.
  • Casio Classwiz fx-85GTX: doing (-1)^(1/3) gives -1.
  • HP Prime: (-1)^(1/3) gives an error in Home mode (only integral powers of negative numbers allowed) and a complex result in CAS mode.
I like all of these calculators and I think they behave well.

On a calculator that can handle complex numbers, the complex result is what I would expect. If a calculator tells me that \((-1)^{1/3}\) is \(-1\), I don't know what result it will give me for \((-1\pm{\bf i}\epsilon)^{1/3}\). The cut in the complex plane must be somewhere unusual.

On a calculator that handles only real numbers, I prefer an error. The problem is that when the power is a real number - for example, \(-0.4\) - a calculator that tries to give a real answer must first turn the power into a rational number, express it in its lowest terms, and then throw an error only if the denominator is even. The Casio appears to do this - \((-1)^{0.4}\) gives 1, powers of 0.401 up to 0.407 give Math Error, and a power of 0.408 gives -1. It's logical, it's consistent, but is it sensible?

I think that to put the Prime's behaviour down to being "badly programmed" is to miss the point. There is a conceptual difference between a fractional power and an integral nth root: whether to ignore this difference, or if not, how to address it, aren't trivial questions. I think the Prime gets it right by having two separate functions, each behaving as I'd expect. If I were a maths teacher teaching fractional powers at a basic level, I might prefer the behaviour of the Casio. I'm surprised to hear that the TI NSpire appears to follow the Casio - is there a complex mode that needs to be turned on, and if so, does this change the behaviour?

Nigel (UK)


RE: Why won't the prime graph correctly? - Gilles - 05-23-2019 06:21 PM

(05-23-2019 03:42 PM)Nigel (UK) Wrote:  
(05-23-2019 09:14 AM)Aries Wrote:  Quite the contrary, teachers know very well what they are teaching, calculators are stupid and/or badly programmed Wink
Best,

Aries Smile
I suppose different people have different opinions. Here are what the four calculators with me at school (I teach Physics) today say:
  • DM42: doing 1 +/- ENTER 3 1/x y^x gives the first complex cube root of -1, rather than -1.
  • WP34S: doing 1 +/- ENTER 3 1/x y^x gives DOMAIN ERROR.
  • Casio Classwiz fx-85GTX: doing (-1)^(1/3) gives -1.
  • HP Prime: (-1)^(1/3) gives an error in Home mode (only integral powers of negative numbers allowed) and a complex result in CAS mode.
I like all of these calculators and I think they behave well.

Nigel (UK)

WolframAlpha gives the same complex result as does the HP50g, newRPL, HPPrime (in home mode,set allow complex number). There is a bug in the NSpire here


RE: Why won't the prime graph correctly? - roadrunner - 05-23-2019 06:38 PM

(05-23-2019 03:42 PM)Nigel (UK) Wrote:  is there a complex mode that needs to be turned on, and if so, does this change the behaviour?

Nigel (UK)

Complex on left, complex off right:

[attachment=7307]

-road


RE: Why won't the prime graph correctly? - toml_12953 - 05-23-2019 06:59 PM

(05-23-2019 03:42 PM)Nigel (UK) Wrote:  HP Prime: (-1)^(1/3) gives an error in Home mode (only integral powers of negative numbers allowed) and a complex result in CAS mode.

On my Prime in Home mode I get 0.500000000001+0.866025403784*i

I have "Allow complex output from real input" checked in settings.


RE: Why won't the prime graph correctly? - Gilles - 05-23-2019 07:27 PM

(05-23-2019 06:59 PM)toml_12953 Wrote:  
(05-23-2019 03:42 PM)Nigel (UK) Wrote:  HP Prime: (-1)^(1/3) gives an error in Home mode (only integral powers of negative numbers allowed) and a complex result in CAS mode.

On my Prime in Home mode I get 0.500000000001+0.866025403784*i

I have "Allow complex output from real input" checked in settings.

I think that's the correct behavior. It's old for me but my teachers always teached me that the |C set is a superset of |R (wich is a superset of |Q, which is superset of Z, wich is superset of |N). From a mathematical point of view, you can have no solution in |R and one (or more) solution in |C, but you cant have a principal solution in |R wich is different in |C : it is not consistant. It will be like to get a different result in |N and in |R: a nonsense. But i'm not mathematician and I'm interested of mathematicien point of view. Perhaps i'm wrong.

Edit : the graph of the NSPIRE (up), are inconsistant in this point of view.


RE: Why won't the prime graph correctly? - Nigel (UK) - 05-24-2019 09:16 AM

(05-23-2019 06:59 PM)toml_12953 Wrote:  
(05-23-2019 03:42 PM)Nigel (UK) Wrote:  HP Prime: (-1)^(1/3) gives an error in Home mode (only integral powers of negative numbers allowed) and a complex result in CAS mode.

On my Prime in Home mode I get 0.500000000001+0.866025403784*i

I have "Allow complex output from real input" checked in settings.
You are correct. I wanted to see what the Prime would do if complex output was disallowed, so I had "Allow complex output from real input" unticked. I should have made that clear. Thank you!

Nigel (UK)


RE: Why won't the prime graph correctly? - toml_12953 - 05-24-2019 10:04 AM

(05-23-2019 06:21 PM)Gilles Wrote:  WolframAlpha gives the same complex result as does the HP50g, newRPL, HPPrime (in home mode,set allow complex number). There is a bug in the NSpire here

The Nspire CX CAS and Nspire CX II CAS give the complex answer if complex is turned on in settings and -1 if complex results are turned off. In real mode, -1 could be considered correct since cubing the cube root of -1 gives the original number:

((-1)^(1/3))^3 = -1

(-1)^(1/3) = -1
Ans^3 = -1


RE: Why won't the prime graph correctly? - Tim Wessman - 05-24-2019 10:43 AM

So basically...

[Image: lknmh.jpg]

The issue with any mathematical device is when people just say "I didn't get what I thought, so therefore it is wrong" when the correct response is "Why?".


RE: Why won't the prime graph correctly? - toml_12953 - 05-24-2019 12:46 PM

(05-24-2019 10:43 AM)Tim Wessman Wrote:  So basically...

[Image: lknmh.jpg]

The issue with any mathematical device is when people just say "I didn't get what I thought, so therefore it is wrong" when the correct response is "Why?".

But what I thought was right otherwise why would I think it? Big Grin


RE: Why won't the prime graph correctly? - ijabbott - 05-24-2019 03:36 PM

I was playing around with plotting (in the Function app) the following function, which is a variant of the original function in this thread (I added the ABS()):

F1(X)=ABS(X^0.4)*(X+3)

As expected, values for X>=0 are plotted always, but values for X<0 are only plotted when "Allow complex output from real input" is selected in the Home Settings.

EDIT - THIS BIT IS WRONG:
Then I tried to override the "Allow complex output from real input" setting in the Symbolic Setup, but changing the "Complex" setting from "System" to "Off" or "On" didn't seem to have any effect on the values plotted - it still only depended on the setting in Home Settings. Any idea why that should be the case?

After repeating the above test, the "Complex" setting in "Symbolic Setup" does have an effect, although the On/Off setting is inverted (see below). I'm not sure what I was doing wrong the first time (I have installed a connectivity kit since then).

There are some other oddities about configuring the Complex setting in the Symbolic Setup. First of all, the setting here seems to be inverted. Setting it to "On" disables complex output from real inputs in the calculator. Setting it to "Off" enables complex output from real inputs in the calculator. Secondly, setting Complex to "Off" or "On" in the Symbolic Setup hides the complex display format setting in Home Settings. You just get a string that says "See Symbolic Setup", but the complex display format is not configurable in the Symbolic Setup.

(Note: I was using the HP Prime virtual calculator version from 2018-10-16 for the above tests.)


RE: Why won't the prime graph correctly? - toml_12953 - 05-24-2019 04:06 PM

(05-24-2019 03:36 PM)ijabbott Wrote:  There are some other oddities about configuring the Complex setting in the Symbolic Setup. First of all, the setting here seems to be inverted. Setting it to "On" disables complex output from real inputs in the calculator. Setting it to "Off" enables complex output from real inputs in the calculator. Secondly, setting Complex to "Off" or "On" in the Symbolic Setup hides the complex display format setting in Home Settings. You just get a string that says "See Symbolic Setup", but the complex display format is not configurable in the Symbolic Setup.

Thanks a lot! Your post gave me a headache just trying to follow the settings! Smile


RE: Why won't the prime graph correctly? - ijabbott - 05-24-2019 04:44 PM

(05-24-2019 04:06 PM)toml_12953 Wrote:  
(05-24-2019 03:36 PM)ijabbott Wrote:  There are some other oddities about configuring the Complex setting in the Symbolic Setup. First of all, the setting here seems to be inverted. Setting it to "On" disables complex output from real inputs in the calculator. Setting it to "Off" enables complex output from real inputs in the calculator. Secondly, setting Complex to "Off" or "On" in the Symbolic Setup hides the complex display format setting in Home Settings. You just get a string that says "See Symbolic Setup", but the complex display format is not configurable in the Symbolic Setup.

Thanks a lot! Your post gave me a headache just trying to follow the settings! Smile

Actually, I made a mistake in the bit before that paragraph, and have edited the post to correct it.

To illustrate: go to Symbolic Setup (Shift - Symb) and set Complex to On. Then press the Home key and try and take the square root of -1. (Fail!) Now go back to Symbolic Setup and set Complex to Off. Now try and take the square root of -1 again. (Success!)