(35s) y^x for y < 0 and x < 1 (complex roots)
04-29-2016, 06:28 AM (This post was last modified: 04-29-2016 11:39 AM by brianddk.)
Post: #1
 brianddk Junior Member Posts: 24 Joined: Apr 2016
(35s) y^x for y < 0 and x < 1 (complex roots)
Howdy,
I stumbled across a thread a while back discussing the following well documented behavior on the 35s
Code:
2 +/- 3 y^x LASTx 1/x y^x **INVALID y^x

Obviously if 'x' can be expressed as a rational number and if both the numerator and the denominator are both odd, then the sign of y is irrelevant and it will carry through the exponentiation.

To this end, I wrote a program that would take 'x' and 'y' and, if y < 0 and FP(x) > 0, then it would try to find an 'acceptable' rational representation of 'x' that had an odd numerator and denominator to yield a negative real result. Otherwise, it gives up and simply produces the answer in complex form. 'Acceptable' answers are given in the form of a user provided delta that that ratio must be within for the approximation to be accepted.

My question, is... is there a better way than brute force 'rationalization' to determine if an exponent will yield a real (non-imaginary) answer. I seem to recall a method using natural logs, but I don't know if it would get me closer to the question of real-vs-imaginary results.

PS... what I ended up with is effectively
Code:
Given:    x = n/d where n and d are odd   y where y < 0 f(x,y) = abs((y+0i)^(n/d)) * -1    ; where n is odd f(x,y) = abs((y+0i)^(n/d))         ; where n is even

MyCalcs: Physical: {hp48gx, hp50g, hp35s} Emu: {hp42s(Free42), hp41c(v41)}
Blog: https://brianddk.github.io/
04-29-2016, 09:09 AM (This post was last modified: 04-29-2016 09:21 AM by Dieter.)
Post: #2
 Dieter Senior Member Posts: 2,397 Joined: Dec 2013
RE: (35s) y^x for y < 0 and x < 1 (complex roots)
(04-29-2016 06:28 AM)brianddk Wrote:  Howdy,
I stumbled across a thread a while back discussing the following well documented behavior on the 35s
Code:
2 +/- 3 y^x LASTx 1/x y^x **INVALID y^x

Obviously if 'x' can be expressed as a rational number and if both the numerator and the denominator are both odd, then the sign of y is irrelevant and it will carry through the exponentiation.

According to this rule –8^(3/5) should work, but it doesn't => INVALID yx.

I think it's much simpler: the error in your example occurs because you want the calculator to evaluate (–8)^0,333333333333.
But this does NOT equal (–8)^(1/3), so no (real) result exists.

That's why there is a XROOT function (x√y, on the K key). –8 [ENTER] 3 [x√y] returns –2, as expected. Here no errors occur for y<0 if x is an odd integer.

So instead of –8^(3/5) you can use –8^3 = –512 and then the 5th root of this yields –3,4822.

Dieter
04-29-2016, 11:29 AM (This post was last modified: 04-29-2016 11:38 AM by brianddk.)
Post: #3
 brianddk Junior Member Posts: 24 Joined: Apr 2016
RE: (35s) y^x for y < 0 and x < 1 (complex roots)
(04-29-2016 09:09 AM)Dieter Wrote:  According to this rule –8^(3/5) should work, but it doesn't => INVALID yx.

I think it's much simpler: the error in your example occurs because you want the calculator to evaluate (–8)^0,333333333333.
But this does NOT equal (–8)^(1/3), so no (real) result exists.

That's why there is a XROOT function (x√y, on the K key). –8 [ENTER] 3 [x√y] returns –2, as expected. Here no errors occur for y<0 if x is an odd integer.

So instead of –8^(3/5) you can use –8^3 = –512 and then the 5th root of this yields –3,4822.

Your correct, I wasn't clear. What I meant was

Code:
Given:    x = n/d where d is odd   y where y < 0 f(x,y) = abs((y+0i)^(n/d)) * -1    ; where n is odd f(x,y) = abs((y+0i)^(n/d))         ; where n is even
The complex mantissa forces the matter, and ABS reflects it back to reals.

MyCalcs: Physical: {hp48gx, hp50g, hp35s} Emu: {hp42s(Free42), hp41c(v41)}
Blog: https://brianddk.github.io/
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)