Roots

classic Classic list List threaded Threaded
21 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Roots

Stan Gorodenski
I got curious about the imaginary number, the square root of -1.
compute z = (-1)**(1/2).
Of course, that cannot be computed. I then did
compute z = (27)**(1/3).
The number returned was 3, as expected. I did this just to make sure I
had the compute statement right. I then did
compute z = (1)**(1/3).
I got back the number 1 as expected. I then did
compute z = (-1)**(1/3).
I should get back the number -1. Instead I got an error message. Why is
it that SPSS cannot give the right answer?
Stan

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Roots

Kirill Orlov
See DOMAIN ERRORS paragraph in Command Syntax Reference.


15.11.2019 4:53, Stan Gorodenski пишет:
> compute z = (-1)**(1/3).

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Roots

Stan Gorodenski
Thanks. I did not know this paragraph existed. However, all it did was
tell me that SPSS cannot carry out the compute, which I already knew,
but not why. All the domain errors they list, I believe, except
(-1)**(1/3) and a number too large to be represented in the computer,
are not mathematically defined and so I would not expect SPSS to be able
to carry out a calculation. However, (-1)**(1/3) is mathematically
defined. I tried this on my HP 35s hand calculator and it came up with
an error. This did not seem unreasonable because this is an inexpensive
calculating machine. I then went to SPSS, a more advanced software, and
discovered SPSS cannot do it either. Does anyone know why? Is it not
possible with the language upon which SPSS is based? I wonder if SAS can
do it. Does anyone know?
Stan

On 11/15/2019 2:12 AM, Kirill Orlov wrote:
> See DOMAIN ERRORS paragraph in Command Syntax Reference.
>
>
> 15.11.2019 4:53, Stan Gorodenski пишет:
>> compute z = (-1)**(1/3).
>
>
>
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Roots

Bruce Weaver
Administrator
In reply to this post by Kirill Orlov
https://www.ibm.com/support/knowledgecenter/en/SSLVMB_26.0.0/statistics_reference_project_ddita/spss/base/syn_transformation_expressions_domain_errors.html



Kirill Orlov wrote
> See DOMAIN ERRORS paragraph in Command Syntax Reference.
>
>
> 15.11.2019 4:53, Stan Gorodenski пишет:
>> compute z = (-1)**(1/3).
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: Roots

Rich Ulrich
I wonder - Is there any demand for the exception-coding
that would be necessary?  How many people write code
where they want to take the fractional root of a negative
number, where the fraction is the reciprocal of an odd integer?
( Note, the fraction cannot be expressed EXACTLY on a binary
computer. How is that accommodated?)

The natural programming solution to non-integer roots is
to use logs.  I suppose if there is an area where the problem
comes up, specialized programs for that area might do it.
I suspect the efficient solution might use a special subroutine
call rather than an in-line expression.

--
Rich Ulrich


From: SPSSX(r) Discussion <[hidden email]> on behalf of Bruce Weaver <[hidden email]>
Sent: Friday, November 15, 2019 11:35 AM
To: [hidden email] <[hidden email]>
Subject: Re: Roots
 
https://www.ibm.com/support/knowledgecenter/en/SSLVMB_26.0.0/statistics_reference_project_ddita/spss/base/syn_transformation_expressions_domain_errors.html



Kirill Orlov wrote
> See DOMAIN ERRORS paragraph in Command Syntax Reference.
>
>
> 15.11.2019 4:53, Stan Gorodenski пишет:
>> compute z = (-1)**(1/3).
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Roots

David Greenberg
In reply to this post by Stan Gorodenski
I tried it in Stata. the  command display (-.3333)^(1/3) produces an
error message. Removing the second set of parentheses yields -.3333.
David Greenberg, NYU Sociology Dept.

On Fri, Nov 15, 2019 at 10:37 AM Stan Gorodenski <[hidden email]> wrote:

>
> Thanks. I did not know this paragraph existed. However, all it did was
> tell me that SPSS cannot carry out the compute, which I already knew,
> but not why. All the domain errors they list, I believe, except
> (-1)**(1/3) and a number too large to be represented in the computer,
> are not mathematically defined and so I would not expect SPSS to be able
> to carry out a calculation. However, (-1)**(1/3) is mathematically
> defined. I tried this on my HP 35s hand calculator and it came up with
> an error. This did not seem unreasonable because this is an inexpensive
> calculating machine. I then went to SPSS, a more advanced software, and
> discovered SPSS cannot do it either. Does anyone know why? Is it not
> possible with the language upon which SPSS is based? I wonder if SAS can
> do it. Does anyone know?
> Stan
>
> On 11/15/2019 2:12 AM, Kirill Orlov wrote:
> > See DOMAIN ERRORS paragraph in Command Syntax Reference.
> >
> >
> > 15.11.2019 4:53, Stan Gorodenski пишет:
> >> compute z = (-1)**(1/3).
> >
> >
> >
> >
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Roots

Stan Gorodenski
In reply to this post by Rich Ulrich
I don't know if there is any demand, but I think the square root of -1
is used in electronics. I'm not into this so I really don't know. I did
not pose this question because I have an application for it. I was just
curious since it seems that sophisticated software packages like SPSS
and SAS should be able to do it. I just sent an email to join the SAS
discussion group and will ask them if SAS can do it. I suppose one could
write a routine to return a -1 if the the denominator of the exponent is
an odd number.
Stan

On 11/15/2019 10:05 AM, Rich Ulrich wrote:

> I wonder - Is there any demand for the exception-coding
> that would be necessary?  How many people write code
> where they want to take the fractional root of a negative
> number, where the fraction is the reciprocal of an odd integer?
> ( Note, the fraction cannot be expressed EXACTLY on a binary
> computer. How is that accommodated?)
>
> The natural programming solution to non-integer roots is
> to use logs.  I suppose if there is an area where the problem
> comes up, specialized programs for that area might do it.
> I suspect the efficient solution might use a special subroutine
> call rather than an in-line expression.
>
> --
> Rich Ulrich
>
> ------------------------------------------------------------------------
> *From:* SPSSX(r) Discussion <[hidden email]> on behalf of
> Bruce Weaver <[hidden email]>
> *Sent:* Friday, November 15, 2019 11:35 AM
> *To:* [hidden email] <[hidden email]>
> *Subject:* Re: Roots
> https://www.ibm.com/support/knowledgecenter/en/SSLVMB_26.0.0/statistics_reference_project_ddita/spss/base/syn_transformation_expressions_domain_errors.html
>
>
>
> Kirill Orlov wrote
> > See DOMAIN ERRORS paragraph in Command Syntax Reference.
> >
> >
> > 15.11.2019 4:53, Stan Gorodenski пишет:
> >> compute z = (-1)**(1/3).
> >
> > =====================
> > To manage your subscription to SPSSX-L, send a message to
>
> > LISTSERV@.UGA
>
> >  (not to SPSSX-L), with no body text except the
> > command. To leave the list, send the command
> > SIGNOFF SPSSX-L
> > For a list of commands to manage subscriptions, send the command
> > INFO REFCARD
>
>
>
>
>
> -----
> --
> Bruce Weaver
> [hidden email]
> http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
> ===================== To manage your subscription to SPSSX-L, send a
> message to [hidden email]
> <mailto:[hidden email]> (not to SPSSX-L), with no body text
> except the command. To leave the list, send the command SIGNOFF
> SPSSX-L For a list of commands to manage subscriptions, send the
> command INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: SPSSX-L Digest - 14 Nov 2019 to 15 Nov 2019 (#2019-237)

Eugene Komaroff
In reply to this post by Stan Gorodenski
SAS returned the correct answer:
x = -1**(1/3) = -1;

Eugene


On Sat, Nov 16, 2019 at 12:00 AM SPSSX-L automatic digest system <[hidden email]> wrote:
There are 7 messages totaling 551 lines in this issue.

Topics of the day:

  1. Roots (6)
  2. Map conversion utility problems

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

----------------------------------------------------------------------

Date:    Fri, 15 Nov 2019 12:12:20 +0300
From:    Kirill Orlov <[hidden email]>
Subject: Re: Roots

See DOMAIN ERRORS paragraph in Command Syntax Reference.


15.11.2019 4:53, Stan Gorodenski пишет:
> compute z = (-1)**(1/3).

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

------------------------------

Date:    Fri, 15 Nov 2019 08:27:29 -0700
From:    ChrisKeran <[hidden email]>
Subject: Map conversion utility problems

I'm trying to use the Map Conversion Utility, however it seems to take 10
minutes to refresh.
Also, when I select the "Delete individual elements" task, it doesn't show
the list of elements to delete, and doesn't seem to allow me to select the
element on the map preview. Thoughts?



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

------------------------------

Date:    Fri, 15 Nov 2019 08:36:17 -0700
From:    Stan Gorodenski <[hidden email]>
Subject: Re: Roots

Thanks. I did not know this paragraph existed. However, all it did was
tell me that SPSS cannot carry out the compute, which I already knew,
but not why. All the domain errors they list, I believe, except
(-1)**(1/3) and a number too large to be represented in the computer,
are not mathematically defined and so I would not expect SPSS to be able
to carry out a calculation. However, (-1)**(1/3) is mathematically
defined. I tried this on my HP 35s hand calculator and it came up with
an error. This did not seem unreasonable because this is an inexpensive
calculating machine. I then went to SPSS, a more advanced software, and
discovered SPSS cannot do it either. Does anyone know why? Is it not
possible with the language upon which SPSS is based? I wonder if SAS can
do it. Does anyone know?
Stan

On 11/15/2019 2:12 AM, Kirill Orlov wrote:
> See DOMAIN ERRORS paragraph in Command Syntax Reference.
>
>
> 15.11.2019 4:53, Stan Gorodenski пишет:
>> compute z = (-1)**(1/3).
>
>
>
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

------------------------------

Date:    Fri, 15 Nov 2019 09:35:01 -0700
From:    Bruce Weaver <[hidden email]>
Subject: Re: Roots

https://www.ibm.com/support/knowledgecenter/en/SSLVMB_26.0.0/statistics_reference_project_ddita/spss/base/syn_transformation_expressions_domain_errors.html



Kirill Orlov wrote
> See DOMAIN ERRORS paragraph in Command Syntax Reference.
>
>
> 15.11.2019 4:53, Stan Gorodenski пишет:
>> compute z = (-1)**(1/3).
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

------------------------------

Date:    Fri, 15 Nov 2019 17:05:05 +0000
From:    Rich Ulrich <[hidden email]>
Subject: Re: Roots

I wonder - Is there any demand for the exception-coding
that would be necessary?  How many people write code
where they want to take the fractional root of a negative
number, where the fraction is the reciprocal of an odd integer?
( Note, the fraction cannot be expressed EXACTLY on a binary
computer. How is that accommodated?)

The natural programming solution to non-integer roots is
to use logs.  I suppose if there is an area where the problem
comes up, specialized programs for that area might do it.
I suspect the efficient solution might use a special subroutine
call rather than an in-line expression.

--
Rich Ulrich

________________________________
From: SPSSX(r) Discussion <[hidden email]> on behalf of Bruce Weaver <[hidden email]>
Sent: Friday, November 15, 2019 11:35 AM
To: [hidden email] <[hidden email]>
Subject: Re: Roots

https://www.ibm.com/support/knowledgecenter/en/SSLVMB_26.0.0/statistics_reference_project_ddita/spss/base/syn_transformation_expressions_domain_errors.html



Kirill Orlov wrote
> See DOMAIN ERRORS paragraph in Command Syntax Reference.
>
>
> 15.11.2019 4:53, Stan Gorodenski пишет:
>> compute z = (-1)**(1/3).
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

------------------------------

Date:    Fri, 15 Nov 2019 12:15:09 -0500
From:    David Greenberg <[hidden email]>
Subject: Re: Roots

I tried it in Stata. the  command display (-.3333)^(1/3) produces an
error message. Removing the second set of parentheses yields -.3333.
David Greenberg, NYU Sociology Dept.

On Fri, Nov 15, 2019 at 10:37 AM Stan Gorodenski <[hidden email]> wrote:
>
> Thanks. I did not know this paragraph existed. However, all it did was
> tell me that SPSS cannot carry out the compute, which I already knew,
> but not why. All the domain errors they list, I believe, except
> (-1)**(1/3) and a number too large to be represented in the computer,
> are not mathematically defined and so I would not expect SPSS to be able
> to carry out a calculation. However, (-1)**(1/3) is mathematically
> defined. I tried this on my HP 35s hand calculator and it came up with
> an error. This did not seem unreasonable because this is an inexpensive
> calculating machine. I then went to SPSS, a more advanced software, and
> discovered SPSS cannot do it either. Does anyone know why? Is it not
> possible with the language upon which SPSS is based? I wonder if SAS can
> do it. Does anyone know?
> Stan
>
> On 11/15/2019 2:12 AM, Kirill Orlov wrote:
> > See DOMAIN ERRORS paragraph in Command Syntax Reference.
> >
> >
> > 15.11.2019 4:53, Stan Gorodenski пишет:
> >> compute z = (-1)**(1/3).
> >
> >
> >
> >
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

------------------------------

Date:    Fri, 15 Nov 2019 10:26:33 -0700
From:    Stan Gorodenski <[hidden email]>
Subject: Re: Roots

I don't know if there is any demand, but I think the square root of -1
is used in electronics. I'm not into this so I really don't know. I did
not pose this question because I have an application for it. I was just
curious since it seems that sophisticated software packages like SPSS
and SAS should be able to do it. I just sent an email to join the SAS
discussion group and will ask them if SAS can do it. I suppose one could
write a routine to return a -1 if the the denominator of the exponent is
an odd number.
Stan

On 11/15/2019 10:05 AM, Rich Ulrich wrote:
> I wonder - Is there any demand for the exception-coding
> that would be necessary?  How many people write code
> where they want to take the fractional root of a negative
> number, where the fraction is the reciprocal of an odd integer?
> ( Note, the fraction cannot be expressed EXACTLY on a binary
> computer. How is that accommodated?)
>
> The natural programming solution to non-integer roots is
> to use logs.  I suppose if there is an area where the problem
> comes up, specialized programs for that area might do it.
> I suspect the efficient solution might use a special subroutine
> call rather than an in-line expression.
>
> --
> Rich Ulrich
>
> ------------------------------------------------------------------------
> *From:* SPSSX(r) Discussion <[hidden email]> on behalf of
> Bruce Weaver <[hidden email]>
> *Sent:* Friday, November 15, 2019 11:35 AM
> *To:* [hidden email] <[hidden email]>
> *Subject:* Re: Roots
> https://www.ibm.com/support/knowledgecenter/en/SSLVMB_26.0.0/statistics_reference_project_ddita/spss/base/syn_transformation_expressions_domain_errors.html
>
>
>
> Kirill Orlov wrote
> > See DOMAIN ERRORS paragraph in Command Syntax Reference.
> >
> >
> > 15.11.2019 4:53, Stan Gorodenski пишет:
> >> compute z = (-1)**(1/3).
> >
> > =====================
> > To manage your subscription to SPSSX-L, send a message to
>
> > LISTSERV@.UGA
>
> >  (not to SPSSX-L), with no body text except the
> > command. To leave the list, send the command
> > SIGNOFF SPSSX-L
> > For a list of commands to manage subscriptions, send the command
> > INFO REFCARD
>
>
>
>
>
> -----
> --
> Bruce Weaver
> [hidden email]
> http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
> ===================== To manage your subscription to SPSSX-L, send a
> message to [hidden email]
> <mailto:[hidden email]> (not to SPSSX-L), with no body text
> except the command. To leave the list, send the command SIGNOFF
> SPSSX-L For a list of commands to manage subscriptions, send the
> command INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

------------------------------

End of SPSSX-L Digest - 14 Nov 2019 to 15 Nov 2019 (#2019-237)
**************************************************************
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Roots

Jon Peck
In reply to this post by Stan Gorodenski
I thought it would  be interesting to explore negative numbers exponentiated to fractional powers in other systems.  Here is what I found.  (NaN is a value for not a number.  Equivalent to SYSMIS.)


SPSS Statistics
compute z = (-1)**(1/3).  
SYSMIS
Warning # 523
>During the execution of the indicated command, an attempt was made to raise a
>non-positive number to a fractional power, e.g.  (-3)**2.5.

golang
output := math.Pow(-1, 1./3.)
NaN
No warning

Python
(-1)**(1./3.)
no result - calculation is stopped
ValueError: negative number cannot be raised to a fractional power

R
 (-1)^(1/3)
 NaN
No warning

Although I have not seen the SPSS internal transformation code, I expect that it uses logs to calculate exponentiation with a fractional power, hence the error.

The expression could be refactored to get a result in the case where the denominator of the exponent is odd but not as a general solution.  Since Statistics, as with most statistical packages, does not support complex numbers in expressions, that solution is not available.

From Wikpedia...

The powers of negative real numbers are not always defined and are discontinuous even where defined. In fact, they are only defined when the exponent is a rational number with the denominator being an odd integer. 
 

If the definition of exponentiation of real numbers is extended to allow negative results then the result is no longer well-behaved.

Neither the logarithm method nor the rational exponent method can be used to define br as a real number for a negative real number b and an arbitrary real number r. Indeed, er is positive for every real number r, so ln(b) is not defined as a real number for b ≤ 0.

The rational exponent method cannot be used for negative values of b because it relies on continuity. The function f(r) = br has a unique continuous extension[15] from the rational numbers to the real numbers for each b > 0. But when b < 0, the function f is not even continuous on the set of rational numbers r for which it is defined.

For example, consider b = −1. The nth root of −1 is −1 for every odd natural number n. So if n is an odd positive integer, (−1)(m/n) = −1 if m is odd, and (−1)(m/n) = 1 if m is even. Thus the set of rational numbers q for which (−1)q = 1 is dense in the rational numbers, as is the set of q for which (−1)q = −1. This means that the function (−1)q is not continuous at any rational number q where it is defined.

On the other hand, arbitrary complex powers of negative numbers b can be defined by choosing a complex logarithm of b.




On Fri, Nov 15, 2019 at 10:26 AM Stan Gorodenski <[hidden email]> wrote:
I don't know if there is any demand, but I think the square root of -1
is used in electronics. I'm not into this so I really don't know. I did
not pose this question because I have an application for it. I was just
curious since it seems that sophisticated software packages like SPSS
and SAS should be able to do it. I just sent an email to join the SAS
discussion group and will ask them if SAS can do it. I suppose one could
write a routine to return a -1 if the the denominator of the exponent is
an odd number.
Stan

On 11/15/2019 10:05 AM, Rich Ulrich wrote:
> I wonder - Is there any demand for the exception-coding
> that would be necessary?  How many people write code
> where they want to take the fractional root of a negative
> number, where the fraction is the reciprocal of an odd integer?
> ( Note, the fraction cannot be expressed EXACTLY on a binary
> computer. How is that accommodated?)
>
> The natural programming solution to non-integer roots is
> to use logs.  I suppose if there is an area where the problem
> comes up, specialized programs for that area might do it.
> I suspect the efficient solution might use a special subroutine
> call rather than an in-line expression.
>
> --
> Rich Ulrich
>
> ------------------------------------------------------------------------
> *From:* SPSSX(r) Discussion <[hidden email]> on behalf of
> Bruce Weaver <[hidden email]>
> *Sent:* Friday, November 15, 2019 11:35 AM
> *To:* [hidden email] <[hidden email]>
> *Subject:* Re: Roots
> https://www.ibm.com/support/knowledgecenter/en/SSLVMB_26.0.0/statistics_reference_project_ddita/spss/base/syn_transformation_expressions_domain_errors.html
>
>
>
> Kirill Orlov wrote
> > See DOMAIN ERRORS paragraph in Command Syntax Reference.
> >
> >
> > 15.11.2019 4:53, Stan Gorodenski пишет:
> >> compute z = (-1)**(1/3).
> >
> > =====================
> > To manage your subscription to SPSSX-L, send a message to
>
> > LISTSERV@.UGA
>
> >  (not to SPSSX-L), with no body text except the
> > command. To leave the list, send the command
> > SIGNOFF SPSSX-L
> > For a list of commands to manage subscriptions, send the command
> > INFO REFCARD
>
>
>
>
>
> -----
> --
> Bruce Weaver
> [hidden email]
> http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
> ===================== To manage your subscription to SPSSX-L, send a
> message to [hidden email]
> <mailto:[hidden email]> (not to SPSSX-L), with no body text
> except the command. To leave the list, send the command SIGNOFF
> SPSSX-L For a list of commands to manage subscriptions, send the
> command INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD


--
Jon K Peck
[hidden email]

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: SPSSX-L Digest - 14 Nov 2019 to 15 Nov 2019 (#2019-237)

Jon Peck
In reply to this post by Eugene Komaroff
SAS may prioritize - lower than **.  Try it as
x = (-1)**(1/3);

On Sat, Nov 16, 2019 at 7:15 AM Eugene Komaroff <[hidden email]> wrote:
SAS returned the correct answer:
x = -1**(1/3) = -1;

Eugene


On Sat, Nov 16, 2019 at 12:00 AM SPSSX-L automatic digest system <[hidden email]> wrote:
There are 7 messages totaling 551 lines in this issue.

Topics of the day:

  1. Roots (6)
  2. Map conversion utility problems

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

----------------------------------------------------------------------

Date:    Fri, 15 Nov 2019 12:12:20 +0300
From:    Kirill Orlov <[hidden email]>
Subject: Re: Roots

See DOMAIN ERRORS paragraph in Command Syntax Reference.


15.11.2019 4:53, Stan Gorodenski пишет:
> compute z = (-1)**(1/3).

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

------------------------------

Date:    Fri, 15 Nov 2019 08:27:29 -0700
From:    ChrisKeran <[hidden email]>
Subject: Map conversion utility problems

I'm trying to use the Map Conversion Utility, however it seems to take 10
minutes to refresh.
Also, when I select the "Delete individual elements" task, it doesn't show
the list of elements to delete, and doesn't seem to allow me to select the
element on the map preview. Thoughts?



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

------------------------------

Date:    Fri, 15 Nov 2019 08:36:17 -0700
From:    Stan Gorodenski <[hidden email]>
Subject: Re: Roots

Thanks. I did not know this paragraph existed. However, all it did was
tell me that SPSS cannot carry out the compute, which I already knew,
but not why. All the domain errors they list, I believe, except
(-1)**(1/3) and a number too large to be represented in the computer,
are not mathematically defined and so I would not expect SPSS to be able
to carry out a calculation. However, (-1)**(1/3) is mathematically
defined. I tried this on my HP 35s hand calculator and it came up with
an error. This did not seem unreasonable because this is an inexpensive
calculating machine. I then went to SPSS, a more advanced software, and
discovered SPSS cannot do it either. Does anyone know why? Is it not
possible with the language upon which SPSS is based? I wonder if SAS can
do it. Does anyone know?
Stan

On 11/15/2019 2:12 AM, Kirill Orlov wrote:
> See DOMAIN ERRORS paragraph in Command Syntax Reference.
>
>
> 15.11.2019 4:53, Stan Gorodenski пишет:
>> compute z = (-1)**(1/3).
>
>
>
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

------------------------------

Date:    Fri, 15 Nov 2019 09:35:01 -0700
From:    Bruce Weaver <[hidden email]>
Subject: Re: Roots

https://www.ibm.com/support/knowledgecenter/en/SSLVMB_26.0.0/statistics_reference_project_ddita/spss/base/syn_transformation_expressions_domain_errors.html



Kirill Orlov wrote
> See DOMAIN ERRORS paragraph in Command Syntax Reference.
>
>
> 15.11.2019 4:53, Stan Gorodenski пишет:
>> compute z = (-1)**(1/3).
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

------------------------------

Date:    Fri, 15 Nov 2019 17:05:05 +0000
From:    Rich Ulrich <[hidden email]>
Subject: Re: Roots

I wonder - Is there any demand for the exception-coding
that would be necessary?  How many people write code
where they want to take the fractional root of a negative
number, where the fraction is the reciprocal of an odd integer?
( Note, the fraction cannot be expressed EXACTLY on a binary
computer. How is that accommodated?)

The natural programming solution to non-integer roots is
to use logs.  I suppose if there is an area where the problem
comes up, specialized programs for that area might do it.
I suspect the efficient solution might use a special subroutine
call rather than an in-line expression.

--
Rich Ulrich

________________________________
From: SPSSX(r) Discussion <[hidden email]> on behalf of Bruce Weaver <[hidden email]>
Sent: Friday, November 15, 2019 11:35 AM
To: [hidden email] <[hidden email]>
Subject: Re: Roots

https://www.ibm.com/support/knowledgecenter/en/SSLVMB_26.0.0/statistics_reference_project_ddita/spss/base/syn_transformation_expressions_domain_errors.html



Kirill Orlov wrote
> See DOMAIN ERRORS paragraph in Command Syntax Reference.
>
>
> 15.11.2019 4:53, Stan Gorodenski пишет:
>> compute z = (-1)**(1/3).
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

------------------------------

Date:    Fri, 15 Nov 2019 12:15:09 -0500
From:    David Greenberg <[hidden email]>
Subject: Re: Roots

I tried it in Stata. the  command display (-.3333)^(1/3) produces an
error message. Removing the second set of parentheses yields -.3333.
David Greenberg, NYU Sociology Dept.

On Fri, Nov 15, 2019 at 10:37 AM Stan Gorodenski <[hidden email]> wrote:
>
> Thanks. I did not know this paragraph existed. However, all it did was
> tell me that SPSS cannot carry out the compute, which I already knew,
> but not why. All the domain errors they list, I believe, except
> (-1)**(1/3) and a number too large to be represented in the computer,
> are not mathematically defined and so I would not expect SPSS to be able
> to carry out a calculation. However, (-1)**(1/3) is mathematically
> defined. I tried this on my HP 35s hand calculator and it came up with
> an error. This did not seem unreasonable because this is an inexpensive
> calculating machine. I then went to SPSS, a more advanced software, and
> discovered SPSS cannot do it either. Does anyone know why? Is it not
> possible with the language upon which SPSS is based? I wonder if SAS can
> do it. Does anyone know?
> Stan
>
> On 11/15/2019 2:12 AM, Kirill Orlov wrote:
> > See DOMAIN ERRORS paragraph in Command Syntax Reference.
> >
> >
> > 15.11.2019 4:53, Stan Gorodenski пишет:
> >> compute z = (-1)**(1/3).
> >
> >
> >
> >
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

------------------------------

Date:    Fri, 15 Nov 2019 10:26:33 -0700
From:    Stan Gorodenski <[hidden email]>
Subject: Re: Roots

I don't know if there is any demand, but I think the square root of -1
is used in electronics. I'm not into this so I really don't know. I did
not pose this question because I have an application for it. I was just
curious since it seems that sophisticated software packages like SPSS
and SAS should be able to do it. I just sent an email to join the SAS
discussion group and will ask them if SAS can do it. I suppose one could
write a routine to return a -1 if the the denominator of the exponent is
an odd number.
Stan

On 11/15/2019 10:05 AM, Rich Ulrich wrote:
> I wonder - Is there any demand for the exception-coding
> that would be necessary?  How many people write code
> where they want to take the fractional root of a negative
> number, where the fraction is the reciprocal of an odd integer?
> ( Note, the fraction cannot be expressed EXACTLY on a binary
> computer. How is that accommodated?)
>
> The natural programming solution to non-integer roots is
> to use logs.  I suppose if there is an area where the problem
> comes up, specialized programs for that area might do it.
> I suspect the efficient solution might use a special subroutine
> call rather than an in-line expression.
>
> --
> Rich Ulrich
>
> ------------------------------------------------------------------------
> *From:* SPSSX(r) Discussion <[hidden email]> on behalf of
> Bruce Weaver <[hidden email]>
> *Sent:* Friday, November 15, 2019 11:35 AM
> *To:* [hidden email] <[hidden email]>
> *Subject:* Re: Roots
> https://www.ibm.com/support/knowledgecenter/en/SSLVMB_26.0.0/statistics_reference_project_ddita/spss/base/syn_transformation_expressions_domain_errors.html
>
>
>
> Kirill Orlov wrote
> > See DOMAIN ERRORS paragraph in Command Syntax Reference.
> >
> >
> > 15.11.2019 4:53, Stan Gorodenski пишет:
> >> compute z = (-1)**(1/3).
> >
> > =====================
> > To manage your subscription to SPSSX-L, send a message to
>
> > LISTSERV@.UGA
>
> >  (not to SPSSX-L), with no body text except the
> > command. To leave the list, send the command
> > SIGNOFF SPSSX-L
> > For a list of commands to manage subscriptions, send the command
> > INFO REFCARD
>
>
>
>
>
> -----
> --
> Bruce Weaver
> [hidden email]
> http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
> ===================== To manage your subscription to SPSSX-L, send a
> message to [hidden email]
> <mailto:[hidden email]> (not to SPSSX-L), with no body text
> except the command. To leave the list, send the command SIGNOFF
> SPSSX-L For a list of commands to manage subscriptions, send the
> command INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

------------------------------

End of SPSSX-L Digest - 14 Nov 2019 to 15 Nov 2019 (#2019-237)
**************************************************************
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD


--
Jon K Peck
[hidden email]

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: SPSSX-L Digest - 14 Nov 2019 to 15 Nov 2019 (#2019-237)

Jon Peck
I should have looked at the SAS operator precedence table first.  Sure enough, the minus would  be evaluated after the exponentiation if parentheses are not used.
Priority Order of Evaluation Symbols MnemonicEquivalent Definition Example
Group I right to left **  (table note 1)
exponentiation
y=a**2;
+ (table note 2)
positive prefix
y=+(a+b);
-
negative prefix
z=-(a+b);

On Sat, Nov 16, 2019 at 7:35 AM Jon Peck <[hidden email]> wrote:
SAS may prioritize - lower than **.  Try it as
x = (-1)**(1/3);

On Sat, Nov 16, 2019 at 7:15 AM Eugene Komaroff <[hidden email]> wrote:
SAS returned the correct answer:
x = -1**(1/3) = -1;

Eugene


On Sat, Nov 16, 2019 at 12:00 AM SPSSX-L automatic digest system <[hidden email]> wrote:
There are 7 messages totaling 551 lines in this issue.

Topics of the day:

  1. Roots (6)
  2. Map conversion utility problems

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

----------------------------------------------------------------------

Date:    Fri, 15 Nov 2019 12:12:20 +0300
From:    Kirill Orlov <[hidden email]>
Subject: Re: Roots

See DOMAIN ERRORS paragraph in Command Syntax Reference.


15.11.2019 4:53, Stan Gorodenski пишет:
> compute z = (-1)**(1/3).

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

------------------------------

Date:    Fri, 15 Nov 2019 08:27:29 -0700
From:    ChrisKeran <[hidden email]>
Subject: Map conversion utility problems

I'm trying to use the Map Conversion Utility, however it seems to take 10
minutes to refresh.
Also, when I select the "Delete individual elements" task, it doesn't show
the list of elements to delete, and doesn't seem to allow me to select the
element on the map preview. Thoughts?



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

------------------------------

Date:    Fri, 15 Nov 2019 08:36:17 -0700
From:    Stan Gorodenski <[hidden email]>
Subject: Re: Roots

Thanks. I did not know this paragraph existed. However, all it did was
tell me that SPSS cannot carry out the compute, which I already knew,
but not why. All the domain errors they list, I believe, except
(-1)**(1/3) and a number too large to be represented in the computer,
are not mathematically defined and so I would not expect SPSS to be able
to carry out a calculation. However, (-1)**(1/3) is mathematically
defined. I tried this on my HP 35s hand calculator and it came up with
an error. This did not seem unreasonable because this is an inexpensive
calculating machine. I then went to SPSS, a more advanced software, and
discovered SPSS cannot do it either. Does anyone know why? Is it not
possible with the language upon which SPSS is based? I wonder if SAS can
do it. Does anyone know?
Stan

On 11/15/2019 2:12 AM, Kirill Orlov wrote:
> See DOMAIN ERRORS paragraph in Command Syntax Reference.
>
>
> 15.11.2019 4:53, Stan Gorodenski пишет:
>> compute z = (-1)**(1/3).
>
>
>
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

------------------------------

Date:    Fri, 15 Nov 2019 09:35:01 -0700
From:    Bruce Weaver <[hidden email]>
Subject: Re: Roots

https://www.ibm.com/support/knowledgecenter/en/SSLVMB_26.0.0/statistics_reference_project_ddita/spss/base/syn_transformation_expressions_domain_errors.html



Kirill Orlov wrote
> See DOMAIN ERRORS paragraph in Command Syntax Reference.
>
>
> 15.11.2019 4:53, Stan Gorodenski пишет:
>> compute z = (-1)**(1/3).
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

------------------------------

Date:    Fri, 15 Nov 2019 17:05:05 +0000
From:    Rich Ulrich <[hidden email]>
Subject: Re: Roots

I wonder - Is there any demand for the exception-coding
that would be necessary?  How many people write code
where they want to take the fractional root of a negative
number, where the fraction is the reciprocal of an odd integer?
( Note, the fraction cannot be expressed EXACTLY on a binary
computer. How is that accommodated?)

The natural programming solution to non-integer roots is
to use logs.  I suppose if there is an area where the problem
comes up, specialized programs for that area might do it.
I suspect the efficient solution might use a special subroutine
call rather than an in-line expression.

--
Rich Ulrich

________________________________
From: SPSSX(r) Discussion <[hidden email]> on behalf of Bruce Weaver <[hidden email]>
Sent: Friday, November 15, 2019 11:35 AM
To: [hidden email] <[hidden email]>
Subject: Re: Roots

https://www.ibm.com/support/knowledgecenter/en/SSLVMB_26.0.0/statistics_reference_project_ddita/spss/base/syn_transformation_expressions_domain_errors.html



Kirill Orlov wrote
> See DOMAIN ERRORS paragraph in Command Syntax Reference.
>
>
> 15.11.2019 4:53, Stan Gorodenski пишет:
>> compute z = (-1)**(1/3).
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

------------------------------

Date:    Fri, 15 Nov 2019 12:15:09 -0500
From:    David Greenberg <[hidden email]>
Subject: Re: Roots

I tried it in Stata. the  command display (-.3333)^(1/3) produces an
error message. Removing the second set of parentheses yields -.3333.
David Greenberg, NYU Sociology Dept.

On Fri, Nov 15, 2019 at 10:37 AM Stan Gorodenski <[hidden email]> wrote:
>
> Thanks. I did not know this paragraph existed. However, all it did was
> tell me that SPSS cannot carry out the compute, which I already knew,
> but not why. All the domain errors they list, I believe, except
> (-1)**(1/3) and a number too large to be represented in the computer,
> are not mathematically defined and so I would not expect SPSS to be able
> to carry out a calculation. However, (-1)**(1/3) is mathematically
> defined. I tried this on my HP 35s hand calculator and it came up with
> an error. This did not seem unreasonable because this is an inexpensive
> calculating machine. I then went to SPSS, a more advanced software, and
> discovered SPSS cannot do it either. Does anyone know why? Is it not
> possible with the language upon which SPSS is based? I wonder if SAS can
> do it. Does anyone know?
> Stan
>
> On 11/15/2019 2:12 AM, Kirill Orlov wrote:
> > See DOMAIN ERRORS paragraph in Command Syntax Reference.
> >
> >
> > 15.11.2019 4:53, Stan Gorodenski пишет:
> >> compute z = (-1)**(1/3).
> >
> >
> >
> >
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

------------------------------

Date:    Fri, 15 Nov 2019 10:26:33 -0700
From:    Stan Gorodenski <[hidden email]>
Subject: Re: Roots

I don't know if there is any demand, but I think the square root of -1
is used in electronics. I'm not into this so I really don't know. I did
not pose this question because I have an application for it. I was just
curious since it seems that sophisticated software packages like SPSS
and SAS should be able to do it. I just sent an email to join the SAS
discussion group and will ask them if SAS can do it. I suppose one could
write a routine to return a -1 if the the denominator of the exponent is
an odd number.
Stan

On 11/15/2019 10:05 AM, Rich Ulrich wrote:
> I wonder - Is there any demand for the exception-coding
> that would be necessary?  How many people write code
> where they want to take the fractional root of a negative
> number, where the fraction is the reciprocal of an odd integer?
> ( Note, the fraction cannot be expressed EXACTLY on a binary
> computer. How is that accommodated?)
>
> The natural programming solution to non-integer roots is
> to use logs.  I suppose if there is an area where the problem
> comes up, specialized programs for that area might do it.
> I suspect the efficient solution might use a special subroutine
> call rather than an in-line expression.
>
> --
> Rich Ulrich
>
> ------------------------------------------------------------------------
> *From:* SPSSX(r) Discussion <[hidden email]> on behalf of
> Bruce Weaver <[hidden email]>
> *Sent:* Friday, November 15, 2019 11:35 AM
> *To:* [hidden email] <[hidden email]>
> *Subject:* Re: Roots
> https://www.ibm.com/support/knowledgecenter/en/SSLVMB_26.0.0/statistics_reference_project_ddita/spss/base/syn_transformation_expressions_domain_errors.html
>
>
>
> Kirill Orlov wrote
> > See DOMAIN ERRORS paragraph in Command Syntax Reference.
> >
> >
> > 15.11.2019 4:53, Stan Gorodenski пишет:
> >> compute z = (-1)**(1/3).
> >
> > =====================
> > To manage your subscription to SPSSX-L, send a message to
>
> > LISTSERV@.UGA
>
> >  (not to SPSSX-L), with no body text except the
> > command. To leave the list, send the command
> > SIGNOFF SPSSX-L
> > For a list of commands to manage subscriptions, send the command
> > INFO REFCARD
>
>
>
>
>
> -----
> --
> Bruce Weaver
> [hidden email]
> http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
> ===================== To manage your subscription to SPSSX-L, send a
> message to [hidden email]
> <mailto:[hidden email]> (not to SPSSX-L), with no body text
> except the command. To leave the list, send the command SIGNOFF
> SPSSX-L For a list of commands to manage subscriptions, send the
> command INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

------------------------------

End of SPSSX-L Digest - 14 Nov 2019 to 15 Nov 2019 (#2019-237)
**************************************************************
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD


--
Jon K Peck
[hidden email]



--
Jon K Peck
[hidden email]

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Roots

Stan Gorodenski
In reply to this post by Jon Peck
Jon,
Yesterday I joined the SAS (Statistical Analysis Software) discussion
group to ask the question (I used to program in SAS in my previous job
and that is how I know about it). SAS cannot do it either. This really
surprises me because SAS is even more expensive to use than SPSS. One
cannot own a package, like SPSS. It is leased annually. It is directed
toward large businesses, educational institutions, and large
organizations that can afford it. I am so surprised that SPSS, and
especially SAS, cannot do this computation, given the money they cost.
Someone in the SAS discussion group thought Mathematica might be able to
do it.
Stan

On 11/16/2019 7:32 AM, Jon Peck wrote:

> I thought it would  be interesting to explore negative numbers
> exponentiated to fractional powers in other systems.  Here is what I
> found.  (NaN is a value for not a number.  Equivalent to SYSMIS.)
>
>
> SPSS Statistics
> compute z = (-1)**(1/3).
> SYSMIS
> Warning # 523
> >During the execution of the indicated command, an attempt was made to
> raise a
> >non-positive number to a fractional power, e.g.  (-3)**2.5.
>
> golang
> output := math.Pow(-1, 1./3.)
> NaN
> No warning
>
> Python
> (-1)**(1./3.)
> no result - calculation is stopped
> ValueError: negative number cannot be raised to a fractional power
>
> R
>  (-1)^(1/3)
>  NaN
> No warning
>
> Although I have not seen the SPSS internal transformation code, I
> expect that it uses logs to calculate exponentiation with a fractional
> power, hence the error.
>
> The expression could be refactored to get a result in the case where
> the denominator of the exponent is odd but not as a general solution. 
> Since Statistics, as with most statistical packages, does not support
> complex numbers in expressions, that solution is not available.
>
> From Wikpedia...
>
> The powers of negative real numbers are not always defined and are
> discontinuous even where defined. In fact, they are only defined when
> the exponent is a rational number with the denominator being an odd
> integer.
>
> If the definition of exponentiation of real numbers is extended to
> allow negative results then the result is no longer well-behaved.
>
> Neither the logarithm method nor the rational exponent method can be
> used to define /b/^/r/  as a real number for a negative real number
> /b/ and an arbitrary real number /r/. Indeed, /e/^/r/  is positive for
> every real number /r/, so ln(/b/) is not defined as a real number for
> /b/ ≤ 0.
>
> The rational exponent method cannot be used for negative values of
> /b/ because it relies on continuity
> <https://en.wikipedia.org/wiki/Continuous_function>. The function
> /f/(/r/) = /b/^/r/  has a unique continuous extension^[15]
> <https://en.wikipedia.org/wiki/Exponentiation#cite_note-Denlinger-15>
>  from the rational numbers to the real numbers for each /b/ > 0. But
> when /b/ < 0, the function /f/ is not even continuous on the set of
> rational numbers /r/ for which it is defined.
>
> For example, consider /b/ = −1. The /n/th root of −1 is −1 for every
> odd natural number /n/. So if /n/ is an odd positive integer,
> (−1)^(/m///n/)  = −1 if /m/ is odd, and (−1)^(/m///n/)  = 1 if /m/ is
> even. Thus the set of rational numbers /q/ for which (−1)^/q/  = 1 is
> dense <https://en.wikipedia.org/wiki/Dense_set> in the rational
> numbers, as is the set of /q/ for which (−1)^/q/  = −1. This means
> that the function (−1)^/q/  is not continuous at any rational number
> /q/ where it is defined.
>
> On the other hand, arbitrary complex powers
> <https://en.wikipedia.org/wiki/Exponentiation#Powers_of_complex_numbers> of
> negative numbers /b/ can be defined by choosing a /complex/ logarithm
> <https://en.wikipedia.org/wiki/Complex_logarithm> of /b/.
>
>
>
>
> On Fri, Nov 15, 2019 at 10:26 AM Stan Gorodenski
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     I don't know if there is any demand, but I think the square root
>     of -1
>     is used in electronics. I'm not into this so I really don't know.
>     I did
>     not pose this question because I have an application for it. I was
>     just
>     curious since it seems that sophisticated software packages like SPSS
>     and SAS should be able to do it. I just sent an email to join the SAS
>     discussion group and will ask them if SAS can do it. I suppose one
>     could
>     write a routine to return a -1 if the the denominator of the
>     exponent is
>     an odd number.
>     Stan
>
>     On 11/15/2019 10:05 AM, Rich Ulrich wrote:
>     > I wonder - Is there any demand for the exception-coding
>     > that would be necessary?  How many people write code
>     > where they want to take the fractional root of a negative
>     > number, where the fraction is the reciprocal of an odd integer?
>     > ( Note, the fraction cannot be expressed EXACTLY on a binary
>     > computer. How is that accommodated?)
>     >
>     > The natural programming solution to non-integer roots is
>     > to use logs.  I suppose if there is an area where the problem
>     > comes up, specialized programs for that area might do it.
>     > I suspect the efficient solution might use a special subroutine
>     > call rather than an in-line expression.
>     >
>     > --
>     > Rich Ulrich
>     >
>     >
>     ------------------------------------------------------------------------
>     > *From:* SPSSX(r) Discussion <[hidden email]
>     <mailto:[hidden email]>> on behalf of
>     > Bruce Weaver <[hidden email]
>     <mailto:[hidden email]>>
>     > *Sent:* Friday, November 15, 2019 11:35 AM
>     > *To:* [hidden email] <mailto:[hidden email]>
>     <[hidden email] <mailto:[hidden email]>>
>     > *Subject:* Re: Roots
>     >
>     https://www.ibm.com/support/knowledgecenter/en/SSLVMB_26.0.0/statistics_reference_project_ddita/spss/base/syn_transformation_expressions_domain_errors.html
>     >
>     >
>     >
>     > Kirill Orlov wrote
>     > > See DOMAIN ERRORS paragraph in Command Syntax Reference.
>     > >
>     > >
>     > > 15.11.2019 4:53, Stan Gorodenski пишет:
>     > >> compute z = (-1)**(1/3).
>     > >
>     > > =====================
>     > > To manage your subscription to SPSSX-L, send a message to
>     >
>     > > LISTSERV@.UGA
>     >
>     > >  (not to SPSSX-L), with no body text except the
>     > > command. To leave the list, send the command
>     > > SIGNOFF SPSSX-L
>     > > For a list of commands to manage subscriptions, send the command
>     > > INFO REFCARD
>     >
>     >
>     >
>     >
>     >
>     > -----
>     > --
>     > Bruce Weaver
>     > [hidden email] <mailto:[hidden email]>
>     > http://sites.google.com/a/lakeheadu.ca/bweaver/
>     >
>     > "When all else fails, RTFM."
>     >
>     > NOTE: My Hotmail account is not monitored regularly.
>     > To send me an e-mail, please use the address shown above.
>     >
>     > --
>     > Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>     >
>     > =====================
>     > To manage your subscription to SPSSX-L, send a message to
>     > [hidden email] <mailto:[hidden email]>
>     (not to SPSSX-L), with no body text except the
>     > command. To leave the list, send the command
>     > SIGNOFF SPSSX-L
>     > For a list of commands to manage subscriptions, send the command
>     > INFO REFCARD
>     > ===================== To manage your subscription to SPSSX-L,
>     send a
>     > message to [hidden email]
>     <mailto:[hidden email]>
>     > <mailto:[hidden email]
>     <mailto:[hidden email]>> (not to SPSSX-L), with no body
>     text
>     > except the command. To leave the list, send the command SIGNOFF
>     > SPSSX-L For a list of commands to manage subscriptions, send the
>     > command INFO REFCARD
>
>     =====================
>     To manage your subscription to SPSSX-L, send a message to
>     [hidden email] <mailto:[hidden email]> (not
>     to SPSSX-L), with no body text except the
>     command. To leave the list, send the command
>     SIGNOFF SPSSX-L
>     For a list of commands to manage subscriptions, send the command
>     INFO REFCARD
>
>
>
> --
> Jon K Peck
> [hidden email] <mailto:[hidden email]>
>
> ===================== To manage your subscription to SPSSX-L, send a
> message to [hidden email]
> <mailto:[hidden email]> (not to SPSSX-L), with no body text
> except the command. To leave the list, send the command SIGNOFF
> SPSSX-L For a list of commands to manage subscriptions, send the
> command INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: SPSSX-L Digest - 14 Nov 2019 to 15 Nov 2019 (#2019-237)

Stan Gorodenski
In reply to this post by Eugene Komaroff
This is very interesting. In the SAS discussion group one of the members
who responded gave me a link
https://communities.sas.com/t5/SAS-Procedures/Does-SAS-have-a-function-to-calculate-1-1-3/td-p/42349
where this was discussed. In the link it says SAS cannot do this, yet
you were able to. How did this happen? I notice you do not have
parenthesis around -1. Is this why it worked?
Stan

On 11/16/2019 7:15 AM, Eugene Komaroff wrote:

> SAS returned the correct answer:
> x = -1**(1/3) = -1;
>
> Eugene
>
>
> On Sat, Nov 16, 2019 at 12:00 AM SPSSX-L automatic digest system
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     There are 7 messages totaling 551 lines in this issue.
>
>     Topics of the day:
>
>       1. Roots (6)
>       2. Map conversion utility problems
>
>     =====================
>     To manage your subscription to SPSSX-L, send a message to
>     [hidden email] <mailto:[hidden email]> (not
>     to SPSSX-L), with no body text except the
>     command. To leave the list, send the command
>     SIGNOFF SPSSX-L
>     For a list of commands to manage subscriptions, send the command
>     INFO REFCARD
>
>     ----------------------------------------------------------------------
>
>     Date:    Fri, 15 Nov 2019 12:12:20 +0300
>     From:    Kirill Orlov <[hidden email] <mailto:[hidden email]>>
>     Subject: Re: Roots
>
>     See DOMAIN ERRORS paragraph in Command Syntax Reference.
>
>
>     15.11.2019 4:53, Stan Gorodenski пишет:
>     > compute z = (-1)**(1/3).
>
>     =====================
>     To manage your subscription to SPSSX-L, send a message to
>     [hidden email] <mailto:[hidden email]> (not
>     to SPSSX-L), with no body text except the
>     command. To leave the list, send the command
>     SIGNOFF SPSSX-L
>     For a list of commands to manage subscriptions, send the command
>     INFO REFCARD
>
>     ------------------------------
>
>     Date:    Fri, 15 Nov 2019 08:27:29 -0700
>     From:    ChrisKeran <[hidden email] <mailto:[hidden email]>>
>     Subject: Map conversion utility problems
>
>     I'm trying to use the Map Conversion Utility, however it seems to
>     take 10
>     minutes to refresh.
>     Also, when I select the "Delete individual elements" task, it
>     doesn't show
>     the list of elements to delete, and doesn't seem to allow me to
>     select the
>     element on the map preview. Thoughts?
>
>
>
>     --
>     Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
>     =====================
>     To manage your subscription to SPSSX-L, send a message to
>     [hidden email] <mailto:[hidden email]> (not
>     to SPSSX-L), with no body text except the
>     command. To leave the list, send the command
>     SIGNOFF SPSSX-L
>     For a list of commands to manage subscriptions, send the command
>     INFO REFCARD
>
>     ------------------------------
>
>     Date:    Fri, 15 Nov 2019 08:36:17 -0700
>     From:    Stan Gorodenski <[hidden email]
>     <mailto:[hidden email]>>
>     Subject: Re: Roots
>
>     Thanks. I did not know this paragraph existed. However, all it did
>     was
>     tell me that SPSS cannot carry out the compute, which I already knew,
>     but not why. All the domain errors they list, I believe, except
>     (-1)**(1/3) and a number too large to be represented in the computer,
>     are not mathematically defined and so I would not expect SPSS to
>     be able
>     to carry out a calculation. However, (-1)**(1/3) is mathematically
>     defined. I tried this on my HP 35s hand calculator and it came up
>     with
>     an error. This did not seem unreasonable because this is an
>     inexpensive
>     calculating machine. I then went to SPSS, a more advanced
>     software, and
>     discovered SPSS cannot do it either. Does anyone know why? Is it not
>     possible with the language upon which SPSS is based? I wonder if
>     SAS can
>     do it. Does anyone know?
>     Stan
>
>     On 11/15/2019 2:12 AM, Kirill Orlov wrote:
>     > See DOMAIN ERRORS paragraph in Command Syntax Reference.
>     >
>     >
>     > 15.11.2019 4:53, Stan Gorodenski пишет:
>     >> compute z = (-1)**(1/3).
>     >
>     >
>     >
>     >
>
>     =====================
>     To manage your subscription to SPSSX-L, send a message to
>     [hidden email] <mailto:[hidden email]> (not
>     to SPSSX-L), with no body text except the
>     command. To leave the list, send the command
>     SIGNOFF SPSSX-L
>     For a list of commands to manage subscriptions, send the command
>     INFO REFCARD
>
>     ------------------------------
>
>     Date:    Fri, 15 Nov 2019 09:35:01 -0700
>     From:    Bruce Weaver <[hidden email]
>     <mailto:[hidden email]>>
>     Subject: Re: Roots
>
>     https://www.ibm.com/support/knowledgecenter/en/SSLVMB_26.0.0/statistics_reference_project_ddita/spss/base/syn_transformation_expressions_domain_errors.html
>
>
>
>     Kirill Orlov wrote
>     > See DOMAIN ERRORS paragraph in Command Syntax Reference.
>     >
>     >
>     > 15.11.2019 4:53, Stan Gorodenski пишет:
>     >> compute z = (-1)**(1/3).
>     >
>     > =====================
>     > To manage your subscription to SPSSX-L, send a message to
>
>     > LISTSERV@.UGA
>
>     >  (not to SPSSX-L), with no body text except the
>     > command. To leave the list, send the command
>     > SIGNOFF SPSSX-L
>     > For a list of commands to manage subscriptions, send the command
>     > INFO REFCARD
>
>
>
>
>
>     -----
>     --
>     Bruce Weaver
>     [hidden email] <mailto:[hidden email]>
>     http://sites.google.com/a/lakeheadu.ca/bweaver/
>
>     "When all else fails, RTFM."
>
>     NOTE: My Hotmail account is not monitored regularly.
>     To send me an e-mail, please use the address shown above.
>
>     --
>     Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
>     =====================
>     To manage your subscription to SPSSX-L, send a message to
>     [hidden email] <mailto:[hidden email]> (not
>     to SPSSX-L), with no body text except the
>     command. To leave the list, send the command
>     SIGNOFF SPSSX-L
>     For a list of commands to manage subscriptions, send the command
>     INFO REFCARD
>
>     ------------------------------
>
>     Date:    Fri, 15 Nov 2019 17:05:05 +0000
>     From:    Rich Ulrich <[hidden email]
>     <mailto:[hidden email]>>
>     Subject: Re: Roots
>
>     I wonder - Is there any demand for the exception-coding
>     that would be necessary?  How many people write code
>     where they want to take the fractional root of a negative
>     number, where the fraction is the reciprocal of an odd integer?
>     ( Note, the fraction cannot be expressed EXACTLY on a binary
>     computer. How is that accommodated?)
>
>     The natural programming solution to non-integer roots is
>     to use logs.  I suppose if there is an area where the problem
>     comes up, specialized programs for that area might do it.
>     I suspect the efficient solution might use a special subroutine
>     call rather than an in-line expression.
>
>     --
>     Rich Ulrich
>
>     ________________________________
>     From: SPSSX(r) Discussion <[hidden email]
>     <mailto:[hidden email]>> on behalf of Bruce Weaver
>     <[hidden email] <mailto:[hidden email]>>
>     Sent: Friday, November 15, 2019 11:35 AM
>     To: [hidden email] <mailto:[hidden email]>
>     <[hidden email] <mailto:[hidden email]>>
>     Subject: Re: Roots
>
>     https://www.ibm.com/support/knowledgecenter/en/SSLVMB_26.0.0/statistics_reference_project_ddita/spss/base/syn_transformation_expressions_domain_errors.html
>
>
>
>     Kirill Orlov wrote
>     > See DOMAIN ERRORS paragraph in Command Syntax Reference.
>     >
>     >
>     > 15.11.2019 4:53, Stan Gorodenski пишет:
>     >> compute z = (-1)**(1/3).
>     >
>     > =====================
>     > To manage your subscription to SPSSX-L, send a message to
>
>     > LISTSERV@.UGA
>
>     >  (not to SPSSX-L), with no body text except the
>     > command. To leave the list, send the command
>     > SIGNOFF SPSSX-L
>     > For a list of commands to manage subscriptions, send the command
>     > INFO REFCARD
>
>
>
>
>
>     -----
>     --
>     Bruce Weaver
>     [hidden email] <mailto:[hidden email]>
>     http://sites.google.com/a/lakeheadu.ca/bweaver/
>
>     "When all else fails, RTFM."
>
>     NOTE: My Hotmail account is not monitored regularly.
>     To send me an e-mail, please use the address shown above.
>
>     --
>     Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
>     =====================
>     To manage your subscription to SPSSX-L, send a message to
>     [hidden email] <mailto:[hidden email]> (not
>     to SPSSX-L), with no body text except the
>     command. To leave the list, send the command
>     SIGNOFF SPSSX-L
>     For a list of commands to manage subscriptions, send the command
>     INFO REFCARD
>
>     =====================
>     To manage your subscription to SPSSX-L, send a message to
>     [hidden email] <mailto:[hidden email]> (not
>     to SPSSX-L), with no body text except the
>     command. To leave the list, send the command
>     SIGNOFF SPSSX-L
>     For a list of commands to manage subscriptions, send the command
>     INFO REFCARD
>
>     ------------------------------
>
>     Date:    Fri, 15 Nov 2019 12:15:09 -0500
>     From:    David Greenberg <[hidden email] <mailto:[hidden email]>>
>     Subject: Re: Roots
>
>     I tried it in Stata. the  command display (-.3333)^(1/3) produces an
>     error message. Removing the second set of parentheses yields -.3333.
>     David Greenberg, NYU Sociology Dept.
>
>     On Fri, Nov 15, 2019 at 10:37 AM Stan Gorodenski
>     <[hidden email] <mailto:[hidden email]>> wrote:
>     >
>     > Thanks. I did not know this paragraph existed. However, all it
>     did was
>     > tell me that SPSS cannot carry out the compute, which I already
>     knew,
>     > but not why. All the domain errors they list, I believe, except
>     > (-1)**(1/3) and a number too large to be represented in the
>     computer,
>     > are not mathematically defined and so I would not expect SPSS to
>     be able
>     > to carry out a calculation. However, (-1)**(1/3) is mathematically
>     > defined. I tried this on my HP 35s hand calculator and it came
>     up with
>     > an error. This did not seem unreasonable because this is an
>     inexpensive
>     > calculating machine. I then went to SPSS, a more advanced
>     software, and
>     > discovered SPSS cannot do it either. Does anyone know why? Is it not
>     > possible with the language upon which SPSS is based? I wonder if
>     SAS can
>     > do it. Does anyone know?
>     > Stan
>     >
>     > On 11/15/2019 2:12 AM, Kirill Orlov wrote:
>     > > See DOMAIN ERRORS paragraph in Command Syntax Reference.
>     > >
>     > >
>     > > 15.11.2019 4:53, Stan Gorodenski пишет:
>     > >> compute z = (-1)**(1/3).
>     > >
>     > >
>     > >
>     > >
>     >
>     > =====================
>     > To manage your subscription to SPSSX-L, send a message to
>     > [hidden email] <mailto:[hidden email]>
>     (not to SPSSX-L), with no body text except the
>     > command. To leave the list, send the command
>     > SIGNOFF SPSSX-L
>     > For a list of commands to manage subscriptions, send the command
>     > INFO REFCARD
>
>     =====================
>     To manage your subscription to SPSSX-L, send a message to
>     [hidden email] <mailto:[hidden email]> (not
>     to SPSSX-L), with no body text except the
>     command. To leave the list, send the command
>     SIGNOFF SPSSX-L
>     For a list of commands to manage subscriptions, send the command
>     INFO REFCARD
>
>     ------------------------------
>
>     Date:    Fri, 15 Nov 2019 10:26:33 -0700
>     From:    Stan Gorodenski <[hidden email]
>     <mailto:[hidden email]>>
>     Subject: Re: Roots
>
>     I don't know if there is any demand, but I think the square root
>     of -1
>     is used in electronics. I'm not into this so I really don't know.
>     I did
>     not pose this question because I have an application for it. I was
>     just
>     curious since it seems that sophisticated software packages like SPSS
>     and SAS should be able to do it. I just sent an email to join the SAS
>     discussion group and will ask them if SAS can do it. I suppose one
>     could
>     write a routine to return a -1 if the the denominator of the
>     exponent is
>     an odd number.
>     Stan
>
>     On 11/15/2019 10:05 AM, Rich Ulrich wrote:
>     > I wonder - Is there any demand for the exception-coding
>     > that would be necessary?  How many people write code
>     > where they want to take the fractional root of a negative
>     > number, where the fraction is the reciprocal of an odd integer?
>     > ( Note, the fraction cannot be expressed EXACTLY on a binary
>     > computer. How is that accommodated?)
>     >
>     > The natural programming solution to non-integer roots is
>     > to use logs.  I suppose if there is an area where the problem
>     > comes up, specialized programs for that area might do it.
>     > I suspect the efficient solution might use a special subroutine
>     > call rather than an in-line expression.
>     >
>     > --
>     > Rich Ulrich
>     >
>     >
>     ------------------------------------------------------------------------
>     > *From:* SPSSX(r) Discussion <[hidden email]
>     <mailto:[hidden email]>> on behalf of
>     > Bruce Weaver <[hidden email]
>     <mailto:[hidden email]>>
>     > *Sent:* Friday, November 15, 2019 11:35 AM
>     > *To:* [hidden email] <mailto:[hidden email]>
>     <[hidden email] <mailto:[hidden email]>>
>     > *Subject:* Re: Roots
>     >
>     https://www.ibm.com/support/knowledgecenter/en/SSLVMB_26.0.0/statistics_reference_project_ddita/spss/base/syn_transformation_expressions_domain_errors.html
>     >
>     >
>     >
>     > Kirill Orlov wrote
>     > > See DOMAIN ERRORS paragraph in Command Syntax Reference.
>     > >
>     > >
>     > > 15.11.2019 4:53, Stan Gorodenski пишет:
>     > >> compute z = (-1)**(1/3).
>     > >
>     > > =====================
>     > > To manage your subscription to SPSSX-L, send a message to
>     >
>     > > LISTSERV@.UGA
>     >
>     > >  (not to SPSSX-L), with no body text except the
>     > > command. To leave the list, send the command
>     > > SIGNOFF SPSSX-L
>     > > For a list of commands to manage subscriptions, send the command
>     > > INFO REFCARD
>     >
>     >
>     >
>     >
>     >
>     > -----
>     > --
>     > Bruce Weaver
>     > [hidden email] <mailto:[hidden email]>
>     > http://sites.google.com/a/lakeheadu.ca/bweaver/
>     >
>     > "When all else fails, RTFM."
>     >
>     > NOTE: My Hotmail account is not monitored regularly.
>     > To send me an e-mail, please use the address shown above.
>     >
>     > --
>     > Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>     >
>     > =====================
>     > To manage your subscription to SPSSX-L, send a message to
>     > [hidden email] <mailto:[hidden email]>
>     (not to SPSSX-L), with no body text except the
>     > command. To leave the list, send the command
>     > SIGNOFF SPSSX-L
>     > For a list of commands to manage subscriptions, send the command
>     > INFO REFCARD
>     > ===================== To manage your subscription to SPSSX-L,
>     send a
>     > message to [hidden email]
>     <mailto:[hidden email]>
>     > <mailto:[hidden email]
>     <mailto:[hidden email]>> (not to SPSSX-L), with no body
>     text
>     > except the command. To leave the list, send the command SIGNOFF
>     > SPSSX-L For a list of commands to manage subscriptions, send the
>     > command INFO REFCARD
>
>     =====================
>     To manage your subscription to SPSSX-L, send a message to
>     [hidden email] <mailto:[hidden email]> (not
>     to SPSSX-L), with no body text except the
>     command. To leave the list, send the command
>     SIGNOFF SPSSX-L
>     For a list of commands to manage subscriptions, send the command
>     INFO REFCARD
>
>     ------------------------------
>
>     End of SPSSX-L Digest - 14 Nov 2019 to 15 Nov 2019 (#2019-237)
>     **************************************************************
>
> ===================== To manage your subscription to SPSSX-L, send a
> message to [hidden email]
> <mailto:[hidden email]> (not to SPSSX-L), with no body text
> except the command. To leave the list, send the command SIGNOFF
> SPSSX-L For a list of commands to manage subscriptions, send the
> command INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: SPSSX-L Digest - 14 Nov 2019 to 15 Nov 2019 (#2019-237)

Stan Gorodenski
p.s., Maybe what is happening is the expression does not recognize the
minus sign. SPSS, and I am sure SAS, can compute (1)**(1/3). Maybe SAS
ignored the minus sign and then added it to the result, the number 1,
after it computed 1**(1/3)?. Just a guess. Could you try putting -1 in
parenthesis and see what happens?
Stan

On 11/16/2019 10:25 AM, Stan Gorodenski wrote:

> This is very interesting. In the SAS discussion group one of the
> members who responded gave me a link
> https://communities.sas.com/t5/SAS-Procedures/Does-SAS-have-a-function-to-calculate-1-1-3/td-p/42349 
>
> where this was discussed. In the link it says SAS cannot do this, yet
> you were able to. How did this happen? I notice you do not have
> parenthesis around -1. Is this why it worked?
> Stan
>
> On 11/16/2019 7:15 AM, Eugene Komaroff wrote:
>> SAS returned the correct answer:
>> x = -1**(1/3) = -1;
>>
>> Eugene
>>
>>
>> On Sat, Nov 16, 2019 at 12:00 AM SPSSX-L automatic digest system
>> <[hidden email] <mailto:[hidden email]>> wrote:
>>
>>     There are 7 messages totaling 551 lines in this issue.
>>
>>     Topics of the day:
>>
>>       1. Roots (6)
>>       2. Map conversion utility problems
>>
>>     =====================
>>     To manage your subscription to SPSSX-L, send a message to
>>     [hidden email] <mailto:[hidden email]> (not
>>     to SPSSX-L), with no body text except the
>>     command. To leave the list, send the command
>>     SIGNOFF SPSSX-L
>>     For a list of commands to manage subscriptions, send the command
>>     INFO REFCARD
>>
>> ----------------------------------------------------------------------
>>
>>     Date:    Fri, 15 Nov 2019 12:12:20 +0300
>>     From:    Kirill Orlov <[hidden email] <mailto:[hidden email]>>
>>     Subject: Re: Roots
>>
>>     See DOMAIN ERRORS paragraph in Command Syntax Reference.
>>
>>
>>     15.11.2019 4:53, Stan Gorodenski пишет:
>>     > compute z = (-1)**(1/3).
>>
>>     =====================
>>     To manage your subscription to SPSSX-L, send a message to
>>     [hidden email] <mailto:[hidden email]> (not
>>     to SPSSX-L), with no body text except the
>>     command. To leave the list, send the command
>>     SIGNOFF SPSSX-L
>>     For a list of commands to manage subscriptions, send the command
>>     INFO REFCARD
>>
>>     ------------------------------
>>
>>     Date:    Fri, 15 Nov 2019 08:27:29 -0700
>>     From:    ChrisKeran <[hidden email] <mailto:[hidden email]>>
>>     Subject: Map conversion utility problems
>>
>>     I'm trying to use the Map Conversion Utility, however it seems to
>>     take 10
>>     minutes to refresh.
>>     Also, when I select the "Delete individual elements" task, it
>>     doesn't show
>>     the list of elements to delete, and doesn't seem to allow me to
>>     select the
>>     element on the map preview. Thoughts?
>>
>>
>>
>>     --
>>     Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>>
>>     =====================
>>     To manage your subscription to SPSSX-L, send a message to
>>     [hidden email] <mailto:[hidden email]> (not
>>     to SPSSX-L), with no body text except the
>>     command. To leave the list, send the command
>>     SIGNOFF SPSSX-L
>>     For a list of commands to manage subscriptions, send the command
>>     INFO REFCARD
>>
>>     ------------------------------
>>
>>     Date:    Fri, 15 Nov 2019 08:36:17 -0700
>>     From:    Stan Gorodenski <[hidden email]
>>     <mailto:[hidden email]>>
>>     Subject: Re: Roots
>>
>>     Thanks. I did not know this paragraph existed. However, all it did
>>     was
>>     tell me that SPSS cannot carry out the compute, which I already
>> knew,
>>     but not why. All the domain errors they list, I believe, except
>>     (-1)**(1/3) and a number too large to be represented in the
>> computer,
>>     are not mathematically defined and so I would not expect SPSS to
>>     be able
>>     to carry out a calculation. However, (-1)**(1/3) is mathematically
>>     defined. I tried this on my HP 35s hand calculator and it came up
>>     with
>>     an error. This did not seem unreasonable because this is an
>>     inexpensive
>>     calculating machine. I then went to SPSS, a more advanced
>>     software, and
>>     discovered SPSS cannot do it either. Does anyone know why? Is it not
>>     possible with the language upon which SPSS is based? I wonder if
>>     SAS can
>>     do it. Does anyone know?
>>     Stan
>>
>>     On 11/15/2019 2:12 AM, Kirill Orlov wrote:
>>     > See DOMAIN ERRORS paragraph in Command Syntax Reference.
>>     >
>>     >
>>     > 15.11.2019 4:53, Stan Gorodenski пишет:
>>     >> compute z = (-1)**(1/3).
>>     >
>>     >
>>     >
>>     >
>>
>>     =====================
>>     To manage your subscription to SPSSX-L, send a message to
>>     [hidden email] <mailto:[hidden email]> (not
>>     to SPSSX-L), with no body text except the
>>     command. To leave the list, send the command
>>     SIGNOFF SPSSX-L
>>     For a list of commands to manage subscriptions, send the command
>>     INFO REFCARD
>>
>>     ------------------------------
>>
>>     Date:    Fri, 15 Nov 2019 09:35:01 -0700
>>     From:    Bruce Weaver <[hidden email]
>>     <mailto:[hidden email]>>
>>     Subject: Re: Roots
>>
>> https://www.ibm.com/support/knowledgecenter/en/SSLVMB_26.0.0/statistics_reference_project_ddita/spss/base/syn_transformation_expressions_domain_errors.html
>>
>>
>>
>>     Kirill Orlov wrote
>>     > See DOMAIN ERRORS paragraph in Command Syntax Reference.
>>     >
>>     >
>>     > 15.11.2019 4:53, Stan Gorodenski пишет:
>>     >> compute z = (-1)**(1/3).
>>     >
>>     > =====================
>>     > To manage your subscription to SPSSX-L, send a message to
>>
>>     > LISTSERV@.UGA
>>
>>     >  (not to SPSSX-L), with no body text except the
>>     > command. To leave the list, send the command
>>     > SIGNOFF SPSSX-L
>>     > For a list of commands to manage subscriptions, send the command
>>     > INFO REFCARD
>>
>>
>>
>>
>>
>>     -----
>>     --
>>     Bruce Weaver
>>     [hidden email] <mailto:[hidden email]>
>>     http://sites.google.com/a/lakeheadu.ca/bweaver/
>>
>>     "When all else fails, RTFM."
>>
>>     NOTE: My Hotmail account is not monitored regularly.
>>     To send me an e-mail, please use the address shown above.
>>
>>     --
>>     Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>>
>>     =====================
>>     To manage your subscription to SPSSX-L, send a message to
>>     [hidden email] <mailto:[hidden email]> (not
>>     to SPSSX-L), with no body text except the
>>     command. To leave the list, send the command
>>     SIGNOFF SPSSX-L
>>     For a list of commands to manage subscriptions, send the command
>>     INFO REFCARD
>>
>>     ------------------------------
>>
>>     Date:    Fri, 15 Nov 2019 17:05:05 +0000
>>     From:    Rich Ulrich <[hidden email]
>>     <mailto:[hidden email]>>
>>     Subject: Re: Roots
>>
>>     I wonder - Is there any demand for the exception-coding
>>     that would be necessary?  How many people write code
>>     where they want to take the fractional root of a negative
>>     number, where the fraction is the reciprocal of an odd integer?
>>     ( Note, the fraction cannot be expressed EXACTLY on a binary
>>     computer. How is that accommodated?)
>>
>>     The natural programming solution to non-integer roots is
>>     to use logs.  I suppose if there is an area where the problem
>>     comes up, specialized programs for that area might do it.
>>     I suspect the efficient solution might use a special subroutine
>>     call rather than an in-line expression.
>>
>>     --
>>     Rich Ulrich
>>
>>     ________________________________
>>     From: SPSSX(r) Discussion <[hidden email]
>>     <mailto:[hidden email]>> on behalf of Bruce Weaver
>>     <[hidden email] <mailto:[hidden email]>>
>>     Sent: Friday, November 15, 2019 11:35 AM
>>     To: [hidden email] <mailto:[hidden email]>
>>     <[hidden email] <mailto:[hidden email]>>
>>     Subject: Re: Roots
>>
>> https://www.ibm.com/support/knowledgecenter/en/SSLVMB_26.0.0/statistics_reference_project_ddita/spss/base/syn_transformation_expressions_domain_errors.html
>>
>>
>>
>>     Kirill Orlov wrote
>>     > See DOMAIN ERRORS paragraph in Command Syntax Reference.
>>     >
>>     >
>>     > 15.11.2019 4:53, Stan Gorodenski пишет:
>>     >> compute z = (-1)**(1/3).
>>     >
>>     > =====================
>>     > To manage your subscription to SPSSX-L, send a message to
>>
>>     > LISTSERV@.UGA
>>
>>     >  (not to SPSSX-L), with no body text except the
>>     > command. To leave the list, send the command
>>     > SIGNOFF SPSSX-L
>>     > For a list of commands to manage subscriptions, send the command
>>     > INFO REFCARD
>>
>>
>>
>>
>>
>>     -----
>>     --
>>     Bruce Weaver
>>     [hidden email] <mailto:[hidden email]>
>>     http://sites.google.com/a/lakeheadu.ca/bweaver/
>>
>>     "When all else fails, RTFM."
>>
>>     NOTE: My Hotmail account is not monitored regularly.
>>     To send me an e-mail, please use the address shown above.
>>
>>     --
>>     Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>>
>>     =====================
>>     To manage your subscription to SPSSX-L, send a message to
>>     [hidden email] <mailto:[hidden email]> (not
>>     to SPSSX-L), with no body text except the
>>     command. To leave the list, send the command
>>     SIGNOFF SPSSX-L
>>     For a list of commands to manage subscriptions, send the command
>>     INFO REFCARD
>>
>>     =====================
>>     To manage your subscription to SPSSX-L, send a message to
>>     [hidden email] <mailto:[hidden email]> (not
>>     to SPSSX-L), with no body text except the
>>     command. To leave the list, send the command
>>     SIGNOFF SPSSX-L
>>     For a list of commands to manage subscriptions, send the command
>>     INFO REFCARD
>>
>>     ------------------------------
>>
>>     Date:    Fri, 15 Nov 2019 12:15:09 -0500
>>     From:    David Greenberg <[hidden email] <mailto:[hidden email]>>
>>     Subject: Re: Roots
>>
>>     I tried it in Stata. the  command display (-.3333)^(1/3) produces an
>>     error message. Removing the second set of parentheses yields -.3333.
>>     David Greenberg, NYU Sociology Dept.
>>
>>     On Fri, Nov 15, 2019 at 10:37 AM Stan Gorodenski
>>     <[hidden email] <mailto:[hidden email]>> wrote:
>>     >
>>     > Thanks. I did not know this paragraph existed. However, all it
>>     did was
>>     > tell me that SPSS cannot carry out the compute, which I already
>>     knew,
>>     > but not why. All the domain errors they list, I believe, except
>>     > (-1)**(1/3) and a number too large to be represented in the
>>     computer,
>>     > are not mathematically defined and so I would not expect SPSS to
>>     be able
>>     > to carry out a calculation. However, (-1)**(1/3) is mathematically
>>     > defined. I tried this on my HP 35s hand calculator and it came
>>     up with
>>     > an error. This did not seem unreasonable because this is an
>>     inexpensive
>>     > calculating machine. I then went to SPSS, a more advanced
>>     software, and
>>     > discovered SPSS cannot do it either. Does anyone know why? Is
>> it not
>>     > possible with the language upon which SPSS is based? I wonder if
>>     SAS can
>>     > do it. Does anyone know?
>>     > Stan
>>     >
>>     > On 11/15/2019 2:12 AM, Kirill Orlov wrote:
>>     > > See DOMAIN ERRORS paragraph in Command Syntax Reference.
>>     > >
>>     > >
>>     > > 15.11.2019 4:53, Stan Gorodenski пишет:
>>     > >> compute z = (-1)**(1/3).
>>     > >
>>     > >
>>     > >
>>     > >
>>     >
>>     > =====================
>>     > To manage your subscription to SPSSX-L, send a message to
>>     > [hidden email] <mailto:[hidden email]>
>>     (not to SPSSX-L), with no body text except the
>>     > command. To leave the list, send the command
>>     > SIGNOFF SPSSX-L
>>     > For a list of commands to manage subscriptions, send the command
>>     > INFO REFCARD
>>
>>     =====================
>>     To manage your subscription to SPSSX-L, send a message to
>>     [hidden email] <mailto:[hidden email]> (not
>>     to SPSSX-L), with no body text except the
>>     command. To leave the list, send the command
>>     SIGNOFF SPSSX-L
>>     For a list of commands to manage subscriptions, send the command
>>     INFO REFCARD
>>
>>     ------------------------------
>>
>>     Date:    Fri, 15 Nov 2019 10:26:33 -0700
>>     From:    Stan Gorodenski <[hidden email]
>>     <mailto:[hidden email]>>
>>     Subject: Re: Roots
>>
>>     I don't know if there is any demand, but I think the square root
>>     of -1
>>     is used in electronics. I'm not into this so I really don't know.
>>     I did
>>     not pose this question because I have an application for it. I was
>>     just
>>     curious since it seems that sophisticated software packages like
>> SPSS
>>     and SAS should be able to do it. I just sent an email to join the
>> SAS
>>     discussion group and will ask them if SAS can do it. I suppose one
>>     could
>>     write a routine to return a -1 if the the denominator of the
>>     exponent is
>>     an odd number.
>>     Stan
>>
>>     On 11/15/2019 10:05 AM, Rich Ulrich wrote:
>>     > I wonder - Is there any demand for the exception-coding
>>     > that would be necessary?  How many people write code
>>     > where they want to take the fractional root of a negative
>>     > number, where the fraction is the reciprocal of an odd integer?
>>     > ( Note, the fraction cannot be expressed EXACTLY on a binary
>>     > computer. How is that accommodated?)
>>     >
>>     > The natural programming solution to non-integer roots is
>>     > to use logs.  I suppose if there is an area where the problem
>>     > comes up, specialized programs for that area might do it.
>>     > I suspect the efficient solution might use a special subroutine
>>     > call rather than an in-line expression.
>>     >
>>     > --
>>     > Rich Ulrich
>>     >
>>     >
>> ------------------------------------------------------------------------
>>     > *From:* SPSSX(r) Discussion <[hidden email]
>>     <mailto:[hidden email]>> on behalf of
>>     > Bruce Weaver <[hidden email]
>>     <mailto:[hidden email]>>
>>     > *Sent:* Friday, November 15, 2019 11:35 AM
>>     > *To:* [hidden email] <mailto:[hidden email]>
>>     <[hidden email] <mailto:[hidden email]>>
>>     > *Subject:* Re: Roots
>>     >
>> https://www.ibm.com/support/knowledgecenter/en/SSLVMB_26.0.0/statistics_reference_project_ddita/spss/base/syn_transformation_expressions_domain_errors.html
>>     >
>>     >
>>     >
>>     > Kirill Orlov wrote
>>     > > See DOMAIN ERRORS paragraph in Command Syntax Reference.
>>     > >
>>     > >
>>     > > 15.11.2019 4:53, Stan Gorodenski пишет:
>>     > >> compute z = (-1)**(1/3).
>>     > >
>>     > > =====================
>>     > > To manage your subscription to SPSSX-L, send a message to
>>     >
>>     > > LISTSERV@.UGA
>>     >
>>     > >  (not to SPSSX-L), with no body text except the
>>     > > command. To leave the list, send the command
>>     > > SIGNOFF SPSSX-L
>>     > > For a list of commands to manage subscriptions, send the command
>>     > > INFO REFCARD
>>     >
>>     >
>>     >
>>     >
>>     >
>>     > -----
>>     > --
>>     > Bruce Weaver
>>     > [hidden email] <mailto:[hidden email]>
>>     > http://sites.google.com/a/lakeheadu.ca/bweaver/
>>     >
>>     > "When all else fails, RTFM."
>>     >
>>     > NOTE: My Hotmail account is not monitored regularly.
>>     > To send me an e-mail, please use the address shown above.
>>     >
>>     > --
>>     > Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>>     >
>>     > =====================
>>     > To manage your subscription to SPSSX-L, send a message to
>>     > [hidden email] <mailto:[hidden email]>
>>     (not to SPSSX-L), with no body text except the
>>     > command. To leave the list, send the command
>>     > SIGNOFF SPSSX-L
>>     > For a list of commands to manage subscriptions, send the command
>>     > INFO REFCARD
>>     > ===================== To manage your subscription to SPSSX-L,
>>     send a
>>     > message to [hidden email]
>>     <mailto:[hidden email]>
>>     > <mailto:[hidden email]
>>     <mailto:[hidden email]>> (not to SPSSX-L), with no body
>>     text
>>     > except the command. To leave the list, send the command SIGNOFF
>>     > SPSSX-L For a list of commands to manage subscriptions, send the
>>     > command INFO REFCARD
>>
>>     =====================
>>     To manage your subscription to SPSSX-L, send a message to
>>     [hidden email] <mailto:[hidden email]> (not
>>     to SPSSX-L), with no body text except the
>>     command. To leave the list, send the command
>>     SIGNOFF SPSSX-L
>>     For a list of commands to manage subscriptions, send the command
>>     INFO REFCARD
>>
>>     ------------------------------
>>
>>     End of SPSSX-L Digest - 14 Nov 2019 to 15 Nov 2019 (#2019-237)
>> **************************************************************
>>
>> ===================== To manage your subscription to SPSSX-L, send a
>> message to [hidden email]
>> <mailto:[hidden email]> (not to SPSSX-L), with no body
>> text except the command. To leave the list, send the command SIGNOFF
>> SPSSX-L For a list of commands to manage subscriptions, send the
>> command INFO REFCARD
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: SPSSX-L Digest - 14 Nov 2019 to 15 Nov 2019 (#2019-237)

Stan Gorodenski
In reply to this post by Jon Peck
Jon,
I just responded and suggested putting -1 in parenthesis but I see you
already had the idea and responded.
Stan

On 11/16/2019 7:41 AM, Jon Peck wrote:

> I should have looked at the SAS operator precedence table first.  Sure
> enough, the minus would  be evaluated after the exponentiation if
> parentheses are not used.
> Priority Order of Evaluation Symbols MnemonicEquivalent Definition Example
> Group I right to left **  (table note 1)
> exponentiation
> y=a**2;
> + (table note 2)
> positive prefix
> y=+(a+b);
> -
> negative prefix
> z=-(a+b);
>
> On Sat, Nov 16, 2019 at 7:35 AM Jon Peck <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     SAS may prioritize - lower than **.  Try it as
>     x = (-1)**(1/3);
>
>     On Sat, Nov 16, 2019 at 7:15 AM Eugene Komaroff
>     <[hidden email] <mailto:[hidden email]>> wrote:
>
>         SAS returned the correct answer:
>         x = -1**(1/3) = -1;
>
>         Eugene
>
>
>         On Sat, Nov 16, 2019 at 12:00 AM SPSSX-L automatic digest
>         system <[hidden email]
>         <mailto:[hidden email]>> wrote:
>
>             There are 7 messages totaling 551 lines in this issue.
>
>             Topics of the day:
>
>               1. Roots (6)
>               2. Map conversion utility problems
>
>             =====================
>             To manage your subscription to SPSSX-L, send a message to
>             [hidden email]
>             <mailto:[hidden email]> (not to SPSSX-L), with
>             no body text except the
>             command. To leave the list, send the command
>             SIGNOFF SPSSX-L
>             For a list of commands to manage subscriptions, send the
>             command
>             INFO REFCARD
>
>             ----------------------------------------------------------------------
>
>             Date:    Fri, 15 Nov 2019 12:12:20 +0300
>             From:    Kirill Orlov <[hidden email] <mailto:[hidden email]>>
>             Subject: Re: Roots
>
>             See DOMAIN ERRORS paragraph in Command Syntax Reference.
>
>
>             15.11.2019 4:53, Stan Gorodenski пишет:
>             > compute z = (-1)**(1/3).
>
>             =====================
>             To manage your subscription to SPSSX-L, send a message to
>             [hidden email]
>             <mailto:[hidden email]> (not to SPSSX-L), with
>             no body text except the
>             command. To leave the list, send the command
>             SIGNOFF SPSSX-L
>             For a list of commands to manage subscriptions, send the
>             command
>             INFO REFCARD
>
>             ------------------------------
>
>             Date:    Fri, 15 Nov 2019 08:27:29 -0700
>             From:    ChrisKeran <[hidden email] <mailto:[hidden email]>>
>             Subject: Map conversion utility problems
>
>             I'm trying to use the Map Conversion Utility, however it
>             seems to take 10
>             minutes to refresh.
>             Also, when I select the "Delete individual elements" task,
>             it doesn't show
>             the list of elements to delete, and doesn't seem to allow
>             me to select the
>             element on the map preview. Thoughts?
>
>
>
>             --
>             Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
>             =====================
>             To manage your subscription to SPSSX-L, send a message to
>             [hidden email]
>             <mailto:[hidden email]> (not to SPSSX-L), with
>             no body text except the
>             command. To leave the list, send the command
>             SIGNOFF SPSSX-L
>             For a list of commands to manage subscriptions, send the
>             command
>             INFO REFCARD
>
>             ------------------------------
>
>             Date:    Fri, 15 Nov 2019 08:36:17 -0700
>             From:    Stan Gorodenski <[hidden email]
>             <mailto:[hidden email]>>
>             Subject: Re: Roots
>
>             Thanks. I did not know this paragraph existed. However,
>             all it did was
>             tell me that SPSS cannot carry out the compute, which I
>             already knew,
>             but not why. All the domain errors they list, I believe,
>             except
>             (-1)**(1/3) and a number too large to be represented in
>             the computer,
>             are not mathematically defined and so I would not expect
>             SPSS to be able
>             to carry out a calculation. However, (-1)**(1/3) is
>             mathematically
>             defined. I tried this on my HP 35s hand calculator and it
>             came up with
>             an error. This did not seem unreasonable because this is
>             an inexpensive
>             calculating machine. I then went to SPSS, a more advanced
>             software, and
>             discovered SPSS cannot do it either. Does anyone know why?
>             Is it not
>             possible with the language upon which SPSS is based? I
>             wonder if SAS can
>             do it. Does anyone know?
>             Stan
>
>             On 11/15/2019 2:12 AM, Kirill Orlov wrote:
>             > See DOMAIN ERRORS paragraph in Command Syntax Reference.
>             >
>             >
>             > 15.11.2019 4:53, Stan Gorodenski пишет:
>             >> compute z = (-1)**(1/3).
>             >
>             >
>             >
>             >
>
>             =====================
>             To manage your subscription to SPSSX-L, send a message to
>             [hidden email]
>             <mailto:[hidden email]> (not to SPSSX-L), with
>             no body text except the
>             command. To leave the list, send the command
>             SIGNOFF SPSSX-L
>             For a list of commands to manage subscriptions, send the
>             command
>             INFO REFCARD
>
>             ------------------------------
>
>             Date:    Fri, 15 Nov 2019 09:35:01 -0700
>             From:    Bruce Weaver <[hidden email]
>             <mailto:[hidden email]>>
>             Subject: Re: Roots
>
>             https://www.ibm.com/support/knowledgecenter/en/SSLVMB_26.0.0/statistics_reference_project_ddita/spss/base/syn_transformation_expressions_domain_errors.html
>
>
>
>             Kirill Orlov wrote
>             > See DOMAIN ERRORS paragraph in Command Syntax Reference.
>             >
>             >
>             > 15.11.2019 4:53, Stan Gorodenski пишет:
>             >> compute z = (-1)**(1/3).
>             >
>             > =====================
>             > To manage your subscription to SPSSX-L, send a message to
>
>             > LISTSERV@.UGA
>
>             >  (not to SPSSX-L), with no body text except the
>             > command. To leave the list, send the command
>             > SIGNOFF SPSSX-L
>             > For a list of commands to manage subscriptions, send the
>             command
>             > INFO REFCARD
>
>
>
>
>
>             -----
>             --
>             Bruce Weaver
>             [hidden email] <mailto:[hidden email]>
>             http://sites.google.com/a/lakeheadu.ca/bweaver/
>
>             "When all else fails, RTFM."
>
>             NOTE: My Hotmail account is not monitored regularly.
>             To send me an e-mail, please use the address shown above.
>
>             --
>             Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
>             =====================
>             To manage your subscription to SPSSX-L, send a message to
>             [hidden email]
>             <mailto:[hidden email]> (not to SPSSX-L), with
>             no body text except the
>             command. To leave the list, send the command
>             SIGNOFF SPSSX-L
>             For a list of commands to manage subscriptions, send the
>             command
>             INFO REFCARD
>
>             ------------------------------
>
>             Date:    Fri, 15 Nov 2019 17:05:05 +0000
>             From:    Rich Ulrich <[hidden email]
>             <mailto:[hidden email]>>
>             Subject: Re: Roots
>
>             I wonder - Is there any demand for the exception-coding
>             that would be necessary?  How many people write code
>             where they want to take the fractional root of a negative
>             number, where the fraction is the reciprocal of an odd
>             integer?
>             ( Note, the fraction cannot be expressed EXACTLY on a binary
>             computer. How is that accommodated?)
>
>             The natural programming solution to non-integer roots is
>             to use logs.  I suppose if there is an area where the problem
>             comes up, specialized programs for that area might do it.
>             I suspect the efficient solution might use a special
>             subroutine
>             call rather than an in-line expression.
>
>             --
>             Rich Ulrich
>
>             ________________________________
>             From: SPSSX(r) Discussion <[hidden email]
>             <mailto:[hidden email]>> on behalf of Bruce
>             Weaver <[hidden email]
>             <mailto:[hidden email]>>
>             Sent: Friday, November 15, 2019 11:35 AM
>             To: [hidden email]
>             <mailto:[hidden email]>
>             <[hidden email] <mailto:[hidden email]>>
>             Subject: Re: Roots
>
>             https://www.ibm.com/support/knowledgecenter/en/SSLVMB_26.0.0/statistics_reference_project_ddita/spss/base/syn_transformation_expressions_domain_errors.html
>
>
>
>             Kirill Orlov wrote
>             > See DOMAIN ERRORS paragraph in Command Syntax Reference.
>             >
>             >
>             > 15.11.2019 4:53, Stan Gorodenski пишет:
>             >> compute z = (-1)**(1/3).
>             >
>             > =====================
>             > To manage your subscription to SPSSX-L, send a message to
>
>             > LISTSERV@.UGA
>
>             >  (not to SPSSX-L), with no body text except the
>             > command. To leave the list, send the command
>             > SIGNOFF SPSSX-L
>             > For a list of commands to manage subscriptions, send the
>             command
>             > INFO REFCARD
>
>
>
>
>
>             -----
>             --
>             Bruce Weaver
>             [hidden email] <mailto:[hidden email]>
>             http://sites.google.com/a/lakeheadu.ca/bweaver/
>
>             "When all else fails, RTFM."
>
>             NOTE: My Hotmail account is not monitored regularly.
>             To send me an e-mail, please use the address shown above.
>
>             --
>             Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
>             =====================
>             To manage your subscription to SPSSX-L, send a message to
>             [hidden email]
>             <mailto:[hidden email]> (not to SPSSX-L), with
>             no body text except the
>             command. To leave the list, send the command
>             SIGNOFF SPSSX-L
>             For a list of commands to manage subscriptions, send the
>             command
>             INFO REFCARD
>
>             =====================
>             To manage your subscription to SPSSX-L, send a message to
>             [hidden email]
>             <mailto:[hidden email]> (not to SPSSX-L), with
>             no body text except the
>             command. To leave the list, send the command
>             SIGNOFF SPSSX-L
>             For a list of commands to manage subscriptions, send the
>             command
>             INFO REFCARD
>
>             ------------------------------
>
>             Date:    Fri, 15 Nov 2019 12:15:09 -0500
>             From:    David Greenberg <[hidden email] <mailto:[hidden email]>>
>             Subject: Re: Roots
>
>             I tried it in Stata. the  command display (-.3333)^(1/3)
>             produces an
>             error message. Removing the second set of parentheses
>             yields -.3333.
>             David Greenberg, NYU Sociology Dept.
>
>             On Fri, Nov 15, 2019 at 10:37 AM Stan Gorodenski
>             <[hidden email] <mailto:[hidden email]>> wrote:
>             >
>             > Thanks. I did not know this paragraph existed. However,
>             all it did was
>             > tell me that SPSS cannot carry out the compute, which I
>             already knew,
>             > but not why. All the domain errors they list, I believe,
>             except
>             > (-1)**(1/3) and a number too large to be represented in
>             the computer,
>             > are not mathematically defined and so I would not expect
>             SPSS to be able
>             > to carry out a calculation. However, (-1)**(1/3) is
>             mathematically
>             > defined. I tried this on my HP 35s hand calculator and
>             it came up with
>             > an error. This did not seem unreasonable because this is
>             an inexpensive
>             > calculating machine. I then went to SPSS, a more
>             advanced software, and
>             > discovered SPSS cannot do it either. Does anyone know
>             why? Is it not
>             > possible with the language upon which SPSS is based? I
>             wonder if SAS can
>             > do it. Does anyone know?
>             > Stan
>             >
>             > On 11/15/2019 2:12 AM, Kirill Orlov wrote:
>             > > See DOMAIN ERRORS paragraph in Command Syntax Reference.
>             > >
>             > >
>             > > 15.11.2019 4:53, Stan Gorodenski пишет:
>             > >> compute z = (-1)**(1/3).
>             > >
>             > >
>             > >
>             > >
>             >
>             > =====================
>             > To manage your subscription to SPSSX-L, send a message to
>             > [hidden email]
>             <mailto:[hidden email]> (not to SPSSX-L), with
>             no body text except the
>             > command. To leave the list, send the command
>             > SIGNOFF SPSSX-L
>             > For a list of commands to manage subscriptions, send the
>             command
>             > INFO REFCARD
>
>             =====================
>             To manage your subscription to SPSSX-L, send a message to
>             [hidden email]
>             <mailto:[hidden email]> (not to SPSSX-L), with
>             no body text except the
>             command. To leave the list, send the command
>             SIGNOFF SPSSX-L
>             For a list of commands to manage subscriptions, send the
>             command
>             INFO REFCARD
>
>             ------------------------------
>
>             Date:    Fri, 15 Nov 2019 10:26:33 -0700
>             From:    Stan Gorodenski <[hidden email]
>             <mailto:[hidden email]>>
>             Subject: Re: Roots
>
>             I don't know if there is any demand, but I think the
>             square root of -1
>             is used in electronics. I'm not into this so I really
>             don't know. I did
>             not pose this question because I have an application for
>             it. I was just
>             curious since it seems that sophisticated software
>             packages like SPSS
>             and SAS should be able to do it. I just sent an email to
>             join the SAS
>             discussion group and will ask them if SAS can do it. I
>             suppose one could
>             write a routine to return a -1 if the the denominator of
>             the exponent is
>             an odd number.
>             Stan
>
>             On 11/15/2019 10:05 AM, Rich Ulrich wrote:
>             > I wonder - Is there any demand for the exception-coding
>             > that would be necessary?  How many people write code
>             > where they want to take the fractional root of a negative
>             > number, where the fraction is the reciprocal of an odd
>             integer?
>             > ( Note, the fraction cannot be expressed EXACTLY on a binary
>             > computer. How is that accommodated?)
>             >
>             > The natural programming solution to non-integer roots is
>             > to use logs.  I suppose if there is an area where the
>             problem
>             > comes up, specialized programs for that area might do it.
>             > I suspect the efficient solution might use a special
>             subroutine
>             > call rather than an in-line expression.
>             >
>             > --
>             > Rich Ulrich
>             >
>             >
>             ------------------------------------------------------------------------
>             > *From:* SPSSX(r) Discussion <[hidden email]
>             <mailto:[hidden email]>> on behalf of
>             > Bruce Weaver <[hidden email]
>             <mailto:[hidden email]>>
>             > *Sent:* Friday, November 15, 2019 11:35 AM
>             > *To:* [hidden email]
>             <mailto:[hidden email]>
>             <[hidden email] <mailto:[hidden email]>>
>             > *Subject:* Re: Roots
>             >
>             https://www.ibm.com/support/knowledgecenter/en/SSLVMB_26.0.0/statistics_reference_project_ddita/spss/base/syn_transformation_expressions_domain_errors.html
>             >
>             >
>             >
>             > Kirill Orlov wrote
>             > > See DOMAIN ERRORS paragraph in Command Syntax Reference.
>             > >
>             > >
>             > > 15.11.2019 4:53, Stan Gorodenski пишет:
>             > >> compute z = (-1)**(1/3).
>             > >
>             > > =====================
>             > > To manage your subscription to SPSSX-L, send a message to
>             >
>             > > LISTSERV@.UGA
>             >
>             > >  (not to SPSSX-L), with no body text except the
>             > > command. To leave the list, send the command
>             > > SIGNOFF SPSSX-L
>             > > For a list of commands to manage subscriptions, send
>             the command
>             > > INFO REFCARD
>             >
>             >
>             >
>             >
>             >
>             > -----
>             > --
>             > Bruce Weaver
>             > [hidden email] <mailto:[hidden email]>
>             > http://sites.google.com/a/lakeheadu.ca/bweaver/
>             >
>             > "When all else fails, RTFM."
>             >
>             > NOTE: My Hotmail account is not monitored regularly.
>             > To send me an e-mail, please use the address shown above.
>             >
>             > --
>             > Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>             >
>             > =====================
>             > To manage your subscription to SPSSX-L, send a message to
>             > [hidden email]
>             <mailto:[hidden email]> (not to SPSSX-L), with
>             no body text except the
>             > command. To leave the list, send the command
>             > SIGNOFF SPSSX-L
>             > For a list of commands to manage subscriptions, send the
>             command
>             > INFO REFCARD
>             > ===================== To manage your subscription to
>             SPSSX-L, send a
>             > message to [hidden email]
>             <mailto:[hidden email]>
>             > <mailto:[hidden email]
>             <mailto:[hidden email]>> (not to SPSSX-L), with
>             no body text
>             > except the command. To leave the list, send the command
>             SIGNOFF
>             > SPSSX-L For a list of commands to manage subscriptions,
>             send the
>             > command INFO REFCARD
>
>             =====================
>             To manage your subscription to SPSSX-L, send a message to
>             [hidden email]
>             <mailto:[hidden email]> (not to SPSSX-L), with
>             no body text except the
>             command. To leave the list, send the command
>             SIGNOFF SPSSX-L
>             For a list of commands to manage subscriptions, send the
>             command
>             INFO REFCARD
>
>             ------------------------------
>
>             End of SPSSX-L Digest - 14 Nov 2019 to 15 Nov 2019 (#2019-237)
>             **************************************************************
>
>         ===================== To manage your subscription to SPSSX-L,
>         send a message to [hidden email]
>         <mailto:[hidden email]> (not to SPSSX-L), with no
>         body text except the command. To leave the list, send the
>         command SIGNOFF SPSSX-L For a list of commands to manage
>         subscriptions, send the command INFO REFCARD
>
>
>
>     --
>     Jon K Peck
>     [hidden email] <mailto:[hidden email]>
>
>
>
> --
> Jon K Peck
> [hidden email] <mailto:[hidden email]>
>
> ===================== To manage your subscription to SPSSX-L, send a
> message to [hidden email]
> <mailto:[hidden email]> (not to SPSSX-L), with no body text
> except the command. To leave the list, send the command SIGNOFF
> SPSSX-L For a list of commands to manage subscriptions, send the
> command INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Roots

Jon Peck
In reply to this post by Stan Gorodenski
As I said earlier, if the exponent is a rational number, you (the user or the software) can in some cases rewrite the expression in order to do this calculation.
E.g.,
x**(b/c) = (x**b)**(1/c)
but this only works for even c if x is negative if you are staying away from complex numbers, which are not generally supported in statistical software.
But if the expression is
x**y
you would have to find the b/c form to do this, and in general this is mathematically impossible (irrational number) or very difficult, and even if you find it, that only works sometimes.

So this is a complex (pun intended) problem, and the behavior would be very confusing to most users.  That means a lot of work for a small and not very useful improvement in functionality.

Even statistical packages can't do everything, so IMO there are much better uses for scarce resources.



On Sat, Nov 16, 2019 at 10:09 AM Stan Gorodenski <[hidden email]> wrote:
Jon,
Yesterday I joined the SAS (Statistical Analysis Software) discussion
group to ask the question (I used to program in SAS in my previous job
and that is how I know about it). SAS cannot do it either. This really
surprises me because SAS is even more expensive to use than SPSS. One
cannot own a package, like SPSS. It is leased annually. It is directed
toward large businesses, educational institutions, and large
organizations that can afford it. I am so surprised that SPSS, and
especially SAS, cannot do this computation, given the money they cost.
Someone in the SAS discussion group thought Mathematica might be able to
do it.
Stan

On 11/16/2019 7:32 AM, Jon Peck wrote:
> I thought it would  be interesting to explore negative numbers
> exponentiated to fractional powers in other systems.  Here is what I
> found.  (NaN is a value for not a number.  Equivalent to SYSMIS.)
>
>
> SPSS Statistics
> compute z = (-1)**(1/3).
> SYSMIS
> Warning # 523
> >During the execution of the indicated command, an attempt was made to
> raise a
> >non-positive number to a fractional power, e.g.  (-3)**2.5.
>
> golang
> output := math.Pow(-1, 1./3.)
> NaN
> No warning
>
> Python
> (-1)**(1./3.)
> no result - calculation is stopped
> ValueError: negative number cannot be raised to a fractional power
>
> R
>  (-1)^(1/3)
>  NaN
> No warning
>
> Although I have not seen the SPSS internal transformation code, I
> expect that it uses logs to calculate exponentiation with a fractional
> power, hence the error.
>
> The expression could be refactored to get a result in the case where
> the denominator of the exponent is odd but not as a general solution. 
> Since Statistics, as with most statistical packages, does not support
> complex numbers in expressions, that solution is not available.
>
> From Wikpedia...
>
> The powers of negative real numbers are not always defined and are
> discontinuous even where defined. In fact, they are only defined when
> the exponent is a rational number with the denominator being an odd
> integer.
>
> If the definition of exponentiation of real numbers is extended to
> allow negative results then the result is no longer well-behaved.
>
> Neither the logarithm method nor the rational exponent method can be
> used to define /b/^/r/  as a real number for a negative real number
> /b/ and an arbitrary real number /r/. Indeed, /e/^/r/  is positive for
> every real number /r/, so ln(/b/) is not defined as a real number for
> /b/ ≤ 0.
>
> The rational exponent method cannot be used for negative values of
> /b/ because it relies on continuity
> <https://en.wikipedia.org/wiki/Continuous_function>. The function
> /f/(/r/) = /b/^/r/  has a unique continuous extension^[15]
> <https://en.wikipedia.org/wiki/Exponentiation#cite_note-Denlinger-15>
>  from the rational numbers to the real numbers for each /b/ > 0. But
> when /b/ < 0, the function /f/ is not even continuous on the set of
> rational numbers /r/ for which it is defined.
>
> For example, consider /b/ = −1. The /n/th root of −1 is −1 for every
> odd natural number /n/. So if /n/ is an odd positive integer,
> (−1)^(/m///n/)  = −1 if /m/ is odd, and (−1)^(/m///n/)  = 1 if /m/ is
> even. Thus the set of rational numbers /q/ for which (−1)^/q/  = 1 is
> dense <https://en.wikipedia.org/wiki/Dense_set> in the rational
> numbers, as is the set of /q/ for which (−1)^/q/  = −1. This means
> that the function (−1)^/q/  is not continuous at any rational number
> /q/ where it is defined.
>
> On the other hand, arbitrary complex powers
> <https://en.wikipedia.org/wiki/Exponentiation#Powers_of_complex_numbers> of
> negative numbers /b/ can be defined by choosing a /complex/ logarithm
> <https://en.wikipedia.org/wiki/Complex_logarithm> of /b/.
>
>
>
>
> On Fri, Nov 15, 2019 at 10:26 AM Stan Gorodenski
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     I don't know if there is any demand, but I think the square root
>     of -1
>     is used in electronics. I'm not into this so I really don't know.
>     I did
>     not pose this question because I have an application for it. I was
>     just
>     curious since it seems that sophisticated software packages like SPSS
>     and SAS should be able to do it. I just sent an email to join the SAS
>     discussion group and will ask them if SAS can do it. I suppose one
>     could
>     write a routine to return a -1 if the the denominator of the
>     exponent is
>     an odd number.
>     Stan
>
>     On 11/15/2019 10:05 AM, Rich Ulrich wrote:
>     > I wonder - Is there any demand for the exception-coding
>     > that would be necessary?  How many people write code
>     > where they want to take the fractional root of a negative
>     > number, where the fraction is the reciprocal of an odd integer?
>     > ( Note, the fraction cannot be expressed EXACTLY on a binary
>     > computer. How is that accommodated?)
>     >
>     > The natural programming solution to non-integer roots is
>     > to use logs.  I suppose if there is an area where the problem
>     > comes up, specialized programs for that area might do it.
>     > I suspect the efficient solution might use a special subroutine
>     > call rather than an in-line expression.
>     >
>     > --
>     > Rich Ulrich
>     >
>     >
>     ------------------------------------------------------------------------
>     > *From:* SPSSX(r) Discussion <[hidden email]
>     <mailto:[hidden email]>> on behalf of
>     > Bruce Weaver <[hidden email]
>     <mailto:[hidden email]>>
>     > *Sent:* Friday, November 15, 2019 11:35 AM
>     > *To:* [hidden email] <mailto:[hidden email]>
>     <[hidden email] <mailto:[hidden email]>>
>     > *Subject:* Re: Roots
>     >
>     https://www.ibm.com/support/knowledgecenter/en/SSLVMB_26.0.0/statistics_reference_project_ddita/spss/base/syn_transformation_expressions_domain_errors.html
>     >
>     >
>     >
>     > Kirill Orlov wrote
>     > > See DOMAIN ERRORS paragraph in Command Syntax Reference.
>     > >
>     > >
>     > > 15.11.2019 4:53, Stan Gorodenski пишет:
>     > >> compute z = (-1)**(1/3).
>     > >
>     > > =====================
>     > > To manage your subscription to SPSSX-L, send a message to
>     >
>     > > LISTSERV@.UGA
>     >
>     > >  (not to SPSSX-L), with no body text except the
>     > > command. To leave the list, send the command
>     > > SIGNOFF SPSSX-L
>     > > For a list of commands to manage subscriptions, send the command
>     > > INFO REFCARD
>     >
>     >
>     >
>     >
>     >
>     > -----
>     > --
>     > Bruce Weaver
>     > [hidden email] <mailto:[hidden email]>
>     > http://sites.google.com/a/lakeheadu.ca/bweaver/
>     >
>     > "When all else fails, RTFM."
>     >
>     > NOTE: My Hotmail account is not monitored regularly.
>     > To send me an e-mail, please use the address shown above.
>     >
>     > --
>     > Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>     >
>     > =====================
>     > To manage your subscription to SPSSX-L, send a message to
>     > [hidden email] <mailto:[hidden email]>
>     (not to SPSSX-L), with no body text except the
>     > command. To leave the list, send the command
>     > SIGNOFF SPSSX-L
>     > For a list of commands to manage subscriptions, send the command
>     > INFO REFCARD
>     > ===================== To manage your subscription to SPSSX-L,
>     send a
>     > message to [hidden email]
>     <mailto:[hidden email]>
>     > <mailto:[hidden email]
>     <mailto:[hidden email]>> (not to SPSSX-L), with no body
>     text
>     > except the command. To leave the list, send the command SIGNOFF
>     > SPSSX-L For a list of commands to manage subscriptions, send the
>     > command INFO REFCARD
>
>     =====================
>     To manage your subscription to SPSSX-L, send a message to
>     [hidden email] <mailto:[hidden email]> (not
>     to SPSSX-L), with no body text except the
>     command. To leave the list, send the command
>     SIGNOFF SPSSX-L
>     For a list of commands to manage subscriptions, send the command
>     INFO REFCARD
>
>
>
> --
> Jon K Peck
> [hidden email] <mailto:[hidden email]>
>
> ===================== To manage your subscription to SPSSX-L, send a
> message to [hidden email]
> <mailto:[hidden email]> (not to SPSSX-L), with no body text
> except the command. To leave the list, send the command SIGNOFF
> SPSSX-L For a list of commands to manage subscriptions, send the
> command INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD


--
Jon K Peck
[hidden email]

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Roots

Raimundas Vaitkevičius
In reply to this post by Stan Gorodenski
Hello, Stan and others,

it seems Excel can calculate this. I'm using newest Office 365.

Raimundas Vaitkevičius

On Sat, Nov 16, 2019 at 7:09 PM Stan Gorodenski <[hidden email]> wrote:
Jon,
Yesterday I joined the SAS (Statistical Analysis Software) discussion
group to ask the question (I used to program in SAS in my previous job
and that is how I know about it). SAS cannot do it either. This really
surprises me because SAS is even more expensive to use than SPSS. One
cannot own a package, like SPSS. It is leased annually. It is directed
toward large businesses, educational institutions, and large
organizations that can afford it. I am so surprised that SPSS, and
especially SAS, cannot do this computation, given the money they cost.
Someone in the SAS discussion group thought Mathematica might be able to
do it.
Stan

On 11/16/2019 7:32 AM, Jon Peck wrote:
> I thought it would  be interesting to explore negative numbers
> exponentiated to fractional powers in other systems.  Here is what I
> found.  (NaN is a value for not a number.  Equivalent to SYSMIS.)
>
>
> SPSS Statistics
> compute z = (-1)**(1/3).
> SYSMIS
> Warning # 523
> >During the execution of the indicated command, an attempt was made to
> raise a
> >non-positive number to a fractional power, e.g.  (-3)**2.5.
>
> golang
> output := math.Pow(-1, 1./3.)
> NaN
> No warning
>
> Python
> (-1)**(1./3.)
> no result - calculation is stopped
> ValueError: negative number cannot be raised to a fractional power
>
> R
>  (-1)^(1/3)
>  NaN
> No warning
>
> Although I have not seen the SPSS internal transformation code, I
> expect that it uses logs to calculate exponentiation with a fractional
> power, hence the error.
>
> The expression could be refactored to get a result in the case where
> the denominator of the exponent is odd but not as a general solution. 
> Since Statistics, as with most statistical packages, does not support
> complex numbers in expressions, that solution is not available.
>
> From Wikpedia...
>
> The powers of negative real numbers are not always defined and are
> discontinuous even where defined. In fact, they are only defined when
> the exponent is a rational number with the denominator being an odd
> integer.
>
> If the definition of exponentiation of real numbers is extended to
> allow negative results then the result is no longer well-behaved.
>
> Neither the logarithm method nor the rational exponent method can be
> used to define /b/^/r/  as a real number for a negative real number
> /b/ and an arbitrary real number /r/. Indeed, /e/^/r/  is positive for
> every real number /r/, so ln(/b/) is not defined as a real number for
> /b/ ≤ 0.
>
> The rational exponent method cannot be used for negative values of
> /b/ because it relies on continuity
> <https://en.wikipedia.org/wiki/Continuous_function>. The function
> /f/(/r/) = /b/^/r/  has a unique continuous extension^[15]
> <https://en.wikipedia.org/wiki/Exponentiation#cite_note-Denlinger-15>
>  from the rational numbers to the real numbers for each /b/ > 0. But
> when /b/ < 0, the function /f/ is not even continuous on the set of
> rational numbers /r/ for which it is defined.
>
> For example, consider /b/ = −1. The /n/th root of −1 is −1 for every
> odd natural number /n/. So if /n/ is an odd positive integer,
> (−1)^(/m///n/)  = −1 if /m/ is odd, and (−1)^(/m///n/)  = 1 if /m/ is
> even. Thus the set of rational numbers /q/ for which (−1)^/q/  = 1 is
> dense <https://en.wikipedia.org/wiki/Dense_set> in the rational
> numbers, as is the set of /q/ for which (−1)^/q/  = −1. This means
> that the function (−1)^/q/  is not continuous at any rational number
> /q/ where it is defined.
>
> On the other hand, arbitrary complex powers
> <https://en.wikipedia.org/wiki/Exponentiation#Powers_of_complex_numbers> of
> negative numbers /b/ can be defined by choosing a /complex/ logarithm
> <https://en.wikipedia.org/wiki/Complex_logarithm> of /b/.
>
>
>
>
> On Fri, Nov 15, 2019 at 10:26 AM Stan Gorodenski
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     I don't know if there is any demand, but I think the square root
>     of -1
>     is used in electronics. I'm not into this so I really don't know.
>     I did
>     not pose this question because I have an application for it. I was
>     just
>     curious since it seems that sophisticated software packages like SPSS
>     and SAS should be able to do it. I just sent an email to join the SAS
>     discussion group and will ask them if SAS can do it. I suppose one
>     could
>     write a routine to return a -1 if the the denominator of the
>     exponent is
>     an odd number.
>     Stan
>
>     On 11/15/2019 10:05 AM, Rich Ulrich wrote:
>     > I wonder - Is there any demand for the exception-coding
>     > that would be necessary?  How many people write code
>     > where they want to take the fractional root of a negative
>     > number, where the fraction is the reciprocal of an odd integer?
>     > ( Note, the fraction cannot be expressed EXACTLY on a binary
>     > computer. How is that accommodated?)
>     >
>     > The natural programming solution to non-integer roots is
>     > to use logs.  I suppose if there is an area where the problem
>     > comes up, specialized programs for that area might do it.
>     > I suspect the efficient solution might use a special subroutine
>     > call rather than an in-line expression.
>     >
>     > --
>     > Rich Ulrich
>     >
>     >
>     ------------------------------------------------------------------------
>     > *From:* SPSSX(r) Discussion <[hidden email]
>     <mailto:[hidden email]>> on behalf of
>     > Bruce Weaver <[hidden email]
>     <mailto:[hidden email]>>
>     > *Sent:* Friday, November 15, 2019 11:35 AM
>     > *To:* [hidden email] <mailto:[hidden email]>
>     <[hidden email] <mailto:[hidden email]>>
>     > *Subject:* Re: Roots
>     >
>     https://www.ibm.com/support/knowledgecenter/en/SSLVMB_26.0.0/statistics_reference_project_ddita/spss/base/syn_transformation_expressions_domain_errors.html
>     >
>     >
>     >
>     > Kirill Orlov wrote
>     > > See DOMAIN ERRORS paragraph in Command Syntax Reference.
>     > >
>     > >
>     > > 15.11.2019 4:53, Stan Gorodenski пишет:
>     > >> compute z = (-1)**(1/3).
>     > >
>     > > =====================
>     > > To manage your subscription to SPSSX-L, send a message to
>     >
>     > > LISTSERV@.UGA
>     >
>     > >  (not to SPSSX-L), with no body text except the
>     > > command. To leave the list, send the command
>     > > SIGNOFF SPSSX-L
>     > > For a list of commands to manage subscriptions, send the command
>     > > INFO REFCARD
>     >
>     >
>     >
>     >
>     >
>     > -----
>     > --
>     > Bruce Weaver
>     > [hidden email] <mailto:[hidden email]>
>     > http://sites.google.com/a/lakeheadu.ca/bweaver/
>     >
>     > "When all else fails, RTFM."
>     >
>     > NOTE: My Hotmail account is not monitored regularly.
>     > To send me an e-mail, please use the address shown above.
>     >
>     > --
>     > Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>     >
>     > =====================
>     > To manage your subscription to SPSSX-L, send a message to
>     > [hidden email] <mailto:[hidden email]>
>     (not to SPSSX-L), with no body text except the
>     > command. To leave the list, send the command
>     > SIGNOFF SPSSX-L
>     > For a list of commands to manage subscriptions, send the command
>     > INFO REFCARD
>     > ===================== To manage your subscription to SPSSX-L,
>     send a
>     > message to [hidden email]
>     <mailto:[hidden email]>
>     > <mailto:[hidden email]
>     <mailto:[hidden email]>> (not to SPSSX-L), with no body
>     text
>     > except the command. To leave the list, send the command SIGNOFF
>     > SPSSX-L For a list of commands to manage subscriptions, send the
>     > command INFO REFCARD
>
>     =====================
>     To manage your subscription to SPSSX-L, send a message to
>     [hidden email] <mailto:[hidden email]> (not
>     to SPSSX-L), with no body text except the
>     command. To leave the list, send the command
>     SIGNOFF SPSSX-L
>     For a list of commands to manage subscriptions, send the command
>     INFO REFCARD
>
>
>
> --
> Jon K Peck
> [hidden email] <mailto:[hidden email]>
>
> ===================== To manage your subscription to SPSSX-L, send a
> message to [hidden email]
> <mailto:[hidden email]> (not to SPSSX-L), with no body text
> except the command. To leave the list, send the command SIGNOFF
> SPSSX-L For a list of commands to manage subscriptions, send the
> command INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Roots

Jon Peck
But Excel gives #NUM! for
=(-1)^(2/3)
and it appears that you get #NUM! for any exponent numerator >= 2 unless the ratio is an integer.  I suspect that they coded the 1/n exponent as a special case.

On Sat, Nov 16, 2019 at 11:52 AM Raimundas Vaitkevičius <[hidden email]> wrote:
Hello, Stan and others,

it seems Excel can calculate this. I'm using newest Office 365.

Raimundas Vaitkevičius

On Sat, Nov 16, 2019 at 7:09 PM Stan Gorodenski <[hidden email]> wrote:
Jon,
Yesterday I joined the SAS (Statistical Analysis Software) discussion
group to ask the question (I used to program in SAS in my previous job
and that is how I know about it). SAS cannot do it either. This really
surprises me because SAS is even more expensive to use than SPSS. One
cannot own a package, like SPSS. It is leased annually. It is directed
toward large businesses, educational institutions, and large
organizations that can afford it. I am so surprised that SPSS, and
especially SAS, cannot do this computation, given the money they cost.
Someone in the SAS discussion group thought Mathematica might be able to
do it.
Stan

On 11/16/2019 7:32 AM, Jon Peck wrote:
> I thought it would  be interesting to explore negative numbers
> exponentiated to fractional powers in other systems.  Here is what I
> found.  (NaN is a value for not a number.  Equivalent to SYSMIS.)
>
>
> SPSS Statistics
> compute z = (-1)**(1/3).
> SYSMIS
> Warning # 523
> >During the execution of the indicated command, an attempt was made to
> raise a
> >non-positive number to a fractional power, e.g.  (-3)**2.5.
>
> golang
> output := math.Pow(-1, 1./3.)
> NaN
> No warning
>
> Python
> (-1)**(1./3.)
> no result - calculation is stopped
> ValueError: negative number cannot be raised to a fractional power
>
> R
>  (-1)^(1/3)
>  NaN
> No warning
>
> Although I have not seen the SPSS internal transformation code, I
> expect that it uses logs to calculate exponentiation with a fractional
> power, hence the error.
>
> The expression could be refactored to get a result in the case where
> the denominator of the exponent is odd but not as a general solution. 
> Since Statistics, as with most statistical packages, does not support
> complex numbers in expressions, that solution is not available.
>
> From Wikpedia...
>
> The powers of negative real numbers are not always defined and are
> discontinuous even where defined. In fact, they are only defined when
> the exponent is a rational number with the denominator being an odd
> integer.
>
> If the definition of exponentiation of real numbers is extended to
> allow negative results then the result is no longer well-behaved.
>
> Neither the logarithm method nor the rational exponent method can be
> used to define /b/^/r/  as a real number for a negative real number
> /b/ and an arbitrary real number /r/. Indeed, /e/^/r/  is positive for
> every real number /r/, so ln(/b/) is not defined as a real number for
> /b/ ≤ 0.
>
> The rational exponent method cannot be used for negative values of
> /b/ because it relies on continuity
> <https://en.wikipedia.org/wiki/Continuous_function>. The function
> /f/(/r/) = /b/^/r/  has a unique continuous extension^[15]
> <https://en.wikipedia.org/wiki/Exponentiation#cite_note-Denlinger-15>
>  from the rational numbers to the real numbers for each /b/ > 0. But
> when /b/ < 0, the function /f/ is not even continuous on the set of
> rational numbers /r/ for which it is defined.
>
> For example, consider /b/ = −1. The /n/th root of −1 is −1 for every
> odd natural number /n/. So if /n/ is an odd positive integer,
> (−1)^(/m///n/)  = −1 if /m/ is odd, and (−1)^(/m///n/)  = 1 if /m/ is
> even. Thus the set of rational numbers /q/ for which (−1)^/q/  = 1 is
> dense <https://en.wikipedia.org/wiki/Dense_set> in the rational
> numbers, as is the set of /q/ for which (−1)^/q/  = −1. This means
> that the function (−1)^/q/  is not continuous at any rational number
> /q/ where it is defined.
>
> On the other hand, arbitrary complex powers
> <https://en.wikipedia.org/wiki/Exponentiation#Powers_of_complex_numbers> of
> negative numbers /b/ can be defined by choosing a /complex/ logarithm
> <https://en.wikipedia.org/wiki/Complex_logarithm> of /b/.
>
>
>
>
> On Fri, Nov 15, 2019 at 10:26 AM Stan Gorodenski
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     I don't know if there is any demand, but I think the square root
>     of -1
>     is used in electronics. I'm not into this so I really don't know.
>     I did
>     not pose this question because I have an application for it. I was
>     just
>     curious since it seems that sophisticated software packages like SPSS
>     and SAS should be able to do it. I just sent an email to join the SAS
>     discussion group and will ask them if SAS can do it. I suppose one
>     could
>     write a routine to return a -1 if the the denominator of the
>     exponent is
>     an odd number.
>     Stan
>
>     On 11/15/2019 10:05 AM, Rich Ulrich wrote:
>     > I wonder - Is there any demand for the exception-coding
>     > that would be necessary?  How many people write code
>     > where they want to take the fractional root of a negative
>     > number, where the fraction is the reciprocal of an odd integer?
>     > ( Note, the fraction cannot be expressed EXACTLY on a binary
>     > computer. How is that accommodated?)
>     >
>     > The natural programming solution to non-integer roots is
>     > to use logs.  I suppose if there is an area where the problem
>     > comes up, specialized programs for that area might do it.
>     > I suspect the efficient solution might use a special subroutine
>     > call rather than an in-line expression.
>     >
>     > --
>     > Rich Ulrich
>     >
>     >
>     ------------------------------------------------------------------------
>     > *From:* SPSSX(r) Discussion <[hidden email]
>     <mailto:[hidden email]>> on behalf of
>     > Bruce Weaver <[hidden email]
>     <mailto:[hidden email]>>
>     > *Sent:* Friday, November 15, 2019 11:35 AM
>     > *To:* [hidden email] <mailto:[hidden email]>
>     <[hidden email] <mailto:[hidden email]>>
>     > *Subject:* Re: Roots
>     >
>     https://www.ibm.com/support/knowledgecenter/en/SSLVMB_26.0.0/statistics_reference_project_ddita/spss/base/syn_transformation_expressions_domain_errors.html
>     >
>     >
>     >
>     > Kirill Orlov wrote
>     > > See DOMAIN ERRORS paragraph in Command Syntax Reference.
>     > >
>     > >
>     > > 15.11.2019 4:53, Stan Gorodenski пишет:
>     > >> compute z = (-1)**(1/3).
>     > >
>     > > =====================
>     > > To manage your subscription to SPSSX-L, send a message to
>     >
>     > > LISTSERV@.UGA
>     >
>     > >  (not to SPSSX-L), with no body text except the
>     > > command. To leave the list, send the command
>     > > SIGNOFF SPSSX-L
>     > > For a list of commands to manage subscriptions, send the command
>     > > INFO REFCARD
>     >
>     >
>     >
>     >
>     >
>     > -----
>     > --
>     > Bruce Weaver
>     > [hidden email] <mailto:[hidden email]>
>     > http://sites.google.com/a/lakeheadu.ca/bweaver/
>     >
>     > "When all else fails, RTFM."
>     >
>     > NOTE: My Hotmail account is not monitored regularly.
>     > To send me an e-mail, please use the address shown above.
>     >
>     > --
>     > Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>     >
>     > =====================
>     > To manage your subscription to SPSSX-L, send a message to
>     > [hidden email] <mailto:[hidden email]>
>     (not to SPSSX-L), with no body text except the
>     > command. To leave the list, send the command
>     > SIGNOFF SPSSX-L
>     > For a list of commands to manage subscriptions, send the command
>     > INFO REFCARD
>     > ===================== To manage your subscription to SPSSX-L,
>     send a
>     > message to [hidden email]
>     <mailto:[hidden email]>
>     > <mailto:[hidden email]
>     <mailto:[hidden email]>> (not to SPSSX-L), with no body
>     text
>     > except the command. To leave the list, send the command SIGNOFF
>     > SPSSX-L For a list of commands to manage subscriptions, send the
>     > command INFO REFCARD
>
>     =====================
>     To manage your subscription to SPSSX-L, send a message to
>     [hidden email] <mailto:[hidden email]> (not
>     to SPSSX-L), with no body text except the
>     command. To leave the list, send the command
>     SIGNOFF SPSSX-L
>     For a list of commands to manage subscriptions, send the command
>     INFO REFCARD
>
>
>
> --
> Jon K Peck
> [hidden email] <mailto:[hidden email]>
>
> ===================== To manage your subscription to SPSSX-L, send a
> message to [hidden email]
> <mailto:[hidden email]> (not to SPSSX-L), with no body text
> except the command. To leave the list, send the command SIGNOFF
> SPSSX-L For a list of commands to manage subscriptions, send the
> command INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD


--
Jon K Peck
[hidden email]

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Roots

Stan Gorodenski
In reply to this post by Jon Peck
Jon,
Here is someone in the SAS discussion group how appears to have done it
with Python. I don't know anything about Python, yet. Would you agree
with his solution?
Stan

%let x=-1;

%utl_submit_py64("
from sympy import *;
import pyperclip;
x = symbols('x');
x=&x;
r=x^(1/3);
pyperclip.copy(r);
print r;
",return=fromPy);

%put Cube root of -1 is &=frompy;

LOG

Cube root of -1 is FROMPY=-1





On 11/16/2019 7:32 AM, Jon Peck wrote:

> I thought it would  be interesting to explore negative numbers
> exponentiated to fractional powers in other systems.  Here is what I
> found.  (NaN is a value for not a number.  Equivalent to SYSMIS.)
>
>
> SPSS Statistics
> compute z = (-1)**(1/3).
> SYSMIS
> Warning # 523
> >During the execution of the indicated command, an attempt was made to
> raise a
> >non-positive number to a fractional power, e.g.  (-3)**2.5.
>
> golang
> output := math.Pow(-1, 1./3.)
> NaN
> No warning
>
> Python
> (-1)**(1./3.)
> no result - calculation is stopped
> ValueError: negative number cannot be raised to a fractional power
>
> R
>  (-1)^(1/3)
>  NaN
> No warning
>
> Although I have not seen the SPSS internal transformation code, I
> expect that it uses logs to calculate exponentiation with a fractional
> power, hence the error.
>
> The expression could be refactored to get a result in the case where
> the denominator of the exponent is odd but not as a general solution. 
> Since Statistics, as with most statistical packages, does not support
> complex numbers in expressions, that solution is not available.
>
> From Wikpedia...
>
> The powers of negative real numbers are not always defined and are
> discontinuous even where defined. In fact, they are only defined when
> the exponent is a rational number with the denominator being an odd
> integer.
>
> If the definition of exponentiation of real numbers is extended to
> allow negative results then the result is no longer well-behaved.
>
> Neither the logarithm method nor the rational exponent method can be
> used to define /b/^/r/  as a real number for a negative real number
> /b/ and an arbitrary real number /r/. Indeed, /e/^/r/  is positive for
> every real number /r/, so ln(/b/) is not defined as a real number for
> /b/ ≤ 0.
>
> The rational exponent method cannot be used for negative values of
> /b/ because it relies on continuity
> <https://en.wikipedia.org/wiki/Continuous_function>. The function
> /f/(/r/) = /b/^/r/  has a unique continuous extension^[15]
> <https://en.wikipedia.org/wiki/Exponentiation#cite_note-Denlinger-15>
>  from the rational numbers to the real numbers for each /b/ > 0. But
> when /b/ < 0, the function /f/ is not even continuous on the set of
> rational numbers /r/ for which it is defined.
>
> For example, consider /b/ = −1. The /n/th root of −1 is −1 for every
> odd natural number /n/. So if /n/ is an odd positive integer,
> (−1)^(/m///n/)  = −1 if /m/ is odd, and (−1)^(/m///n/)  = 1 if /m/ is
> even. Thus the set of rational numbers /q/ for which (−1)^/q/  = 1 is
> dense <https://en.wikipedia.org/wiki/Dense_set> in the rational
> numbers, as is the set of /q/ for which (−1)^/q/  = −1. This means
> that the function (−1)^/q/  is not continuous at any rational number
> /q/ where it is defined.
>
> On the other hand, arbitrary complex powers
> <https://en.wikipedia.org/wiki/Exponentiation#Powers_of_complex_numbers> of
> negative numbers /b/ can be defined by choosing a /complex/ logarithm
> <https://en.wikipedia.org/wiki/Complex_logarithm> of /b/.
>
>
>
>
> On Fri, Nov 15, 2019 at 10:26 AM Stan Gorodenski
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     I don't know if there is any demand, but I think the square root
>     of -1
>     is used in electronics. I'm not into this so I really don't know.
>     I did
>     not pose this question because I have an application for it. I was
>     just
>     curious since it seems that sophisticated software packages like SPSS
>     and SAS should be able to do it. I just sent an email to join the SAS
>     discussion group and will ask them if SAS can do it. I suppose one
>     could
>     write a routine to return a -1 if the the denominator of the
>     exponent is
>     an odd number.
>     Stan
>
>     On 11/15/2019 10:05 AM, Rich Ulrich wrote:
>     > I wonder - Is there any demand for the exception-coding
>     > that would be necessary?  How many people write code
>     > where they want to take the fractional root of a negative
>     > number, where the fraction is the reciprocal of an odd integer?
>     > ( Note, the fraction cannot be expressed EXACTLY on a binary
>     > computer. How is that accommodated?)
>     >
>     > The natural programming solution to non-integer roots is
>     > to use logs.  I suppose if there is an area where the problem
>     > comes up, specialized programs for that area might do it.
>     > I suspect the efficient solution might use a special subroutine
>     > call rather than an in-line expression.
>     >
>     > --
>     > Rich Ulrich
>     >
>     >
>     ------------------------------------------------------------------------
>     > *From:* SPSSX(r) Discussion <[hidden email]
>     <mailto:[hidden email]>> on behalf of
>     > Bruce Weaver <[hidden email]
>     <mailto:[hidden email]>>
>     > *Sent:* Friday, November 15, 2019 11:35 AM
>     > *To:* [hidden email] <mailto:[hidden email]>
>     <[hidden email] <mailto:[hidden email]>>
>     > *Subject:* Re: Roots
>     >
>     https://www.ibm.com/support/knowledgecenter/en/SSLVMB_26.0.0/statistics_reference_project_ddita/spss/base/syn_transformation_expressions_domain_errors.html
>     >
>     >
>     >
>     > Kirill Orlov wrote
>     > > See DOMAIN ERRORS paragraph in Command Syntax Reference.
>     > >
>     > >
>     > > 15.11.2019 4:53, Stan Gorodenski пишет:
>     > >> compute z = (-1)**(1/3).
>     > >
>     > > =====================
>     > > To manage your subscription to SPSSX-L, send a message to
>     >
>     > > LISTSERV@.UGA
>     >
>     > >  (not to SPSSX-L), with no body text except the
>     > > command. To leave the list, send the command
>     > > SIGNOFF SPSSX-L
>     > > For a list of commands to manage subscriptions, send the command
>     > > INFO REFCARD
>     >
>     >
>     >
>     >
>     >
>     > -----
>     > --
>     > Bruce Weaver
>     > [hidden email] <mailto:[hidden email]>
>     > http://sites.google.com/a/lakeheadu.ca/bweaver/
>     >
>     > "When all else fails, RTFM."
>     >
>     > NOTE: My Hotmail account is not monitored regularly.
>     > To send me an e-mail, please use the address shown above.
>     >
>     > --
>     > Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>     >
>     > =====================
>     > To manage your subscription to SPSSX-L, send a message to
>     > [hidden email] <mailto:[hidden email]>
>     (not to SPSSX-L), with no body text except the
>     > command. To leave the list, send the command
>     > SIGNOFF SPSSX-L
>     > For a list of commands to manage subscriptions, send the command
>     > INFO REFCARD
>     > ===================== To manage your subscription to SPSSX-L,
>     send a
>     > message to [hidden email]
>     <mailto:[hidden email]>
>     > <mailto:[hidden email]
>     <mailto:[hidden email]>> (not to SPSSX-L), with no body
>     text
>     > except the command. To leave the list, send the command SIGNOFF
>     > SPSSX-L For a list of commands to manage subscriptions, send the
>     > command INFO REFCARD
>
>     =====================
>     To manage your subscription to SPSSX-L, send a message to
>     [hidden email] <mailto:[hidden email]> (not
>     to SPSSX-L), with no body text except the
>     command. To leave the list, send the command
>     SIGNOFF SPSSX-L
>     For a list of commands to manage subscriptions, send the command
>     INFO REFCARD
>
>
>
> --
> Jon K Peck
> [hidden email] <mailto:[hidden email]>
>
> ===================== To manage your subscription to SPSSX-L, send a
> message to [hidden email]
> <mailto:[hidden email]> (not to SPSSX-L), with no body text
> except the command. To leave the list, send the command SIGNOFF
> SPSSX-L For a list of commands to manage subscriptions, send the
> command INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Roots

Stan Gorodenski
Here is another solution someone in the SAS discussion group came up
with. Again, I know nothing about Python and so do not know if it is
doing what it is supposed to.
Stan

%utl_submit_py64("
from sympy import *;
x, y, z = symbols('x y z', real=True);
z=-1;
sol = solve((x+I*y)**3 + 1, (x, y));
print(sol);
");
                                                                             
Three roots of (-1)**3
                                                                             
[(-1, 0), (1/2, -sqrt(3)/2), (1/2, sqrt(3)/2)]
                                                                             
  Lets check root (1/2, -sqrt(3)/2)
                                                                             
  In the complex plane the vector length for (1/2, -sqrt(3)/2)
                                                                             
    1/2 * y, -sqr(3)/2 * i = (1/2)**2 + (-sqr(3)/2)**2 = .25 + .75 = 1



On 11/17/2019 8:46 AM, Stan Gorodenski wrote:

> Jon,
> Here is someone in the SAS discussion group how appears to have done
> it with Python. I don't know anything about Python, yet. Would you
> agree with his solution?
> Stan
>
> %let x=-1;
>
> %utl_submit_py64("
> from sympy import *;
> import pyperclip;
> x = symbols('x');
> x=&x;
> r=x^(1/3);
> pyperclip.copy(r);
> print r;
> ",return=fromPy);
>
> %put Cube root of -1 is &=frompy;
>
> LOG
>
> Cube root of -1 is FROMPY=-1
>
>
>
>
>
> On 11/16/2019 7:32 AM, Jon Peck wrote:
>> I thought it would  be interesting to explore negative numbers
>> exponentiated to fractional powers in other systems.  Here is what I
>> found.  (NaN is a value for not a number.  Equivalent to SYSMIS.)
>>
>>
>> SPSS Statistics
>> compute z = (-1)**(1/3).
>> SYSMIS
>> Warning # 523
>> >During the execution of the indicated command, an attempt was made
>> to raise a
>> >non-positive number to a fractional power, e.g.  (-3)**2.5.
>>
>> golang
>> output := math.Pow(-1, 1./3.)
>> NaN
>> No warning
>>
>> Python
>> (-1)**(1./3.)
>> no result - calculation is stopped
>> ValueError: negative number cannot be raised to a fractional power
>>
>> R
>>  (-1)^(1/3)
>>  NaN
>> No warning
>>
>> Although I have not seen the SPSS internal transformation code, I
>> expect that it uses logs to calculate exponentiation with a
>> fractional power, hence the error.
>>
>> The expression could be refactored to get a result in the case where
>> the denominator of the exponent is odd but not as a general
>> solution.  Since Statistics, as with most statistical packages, does
>> not support complex numbers in expressions, that solution is not
>> available.
>>
>> From Wikpedia...
>>
>> The powers of negative real numbers are not always defined and are
>> discontinuous even where defined. In fact, they are only defined when
>> the exponent is a rational number with the denominator being an odd
>> integer.
>>
>> If the definition of exponentiation of real numbers is extended to
>> allow negative results then the result is no longer well-behaved.
>>
>> Neither the logarithm method nor the rational exponent method can be
>> used to define /b/^/r/  as a real number for a negative real number
>> /b/ and an arbitrary real number /r/. Indeed, /e/^/r/  is positive
>> for every real number /r/, so ln(/b/) is not defined as a real number
>> for /b/ ≤ 0.
>>
>> The rational exponent method cannot be used for negative values of
>> /b/ because it relies on continuity
>> <https://en.wikipedia.org/wiki/Continuous_function>. The function
>> /f/(/r/) = /b/^/r/  has a unique continuous extension^[15]
>> <https://en.wikipedia.org/wiki/Exponentiation#cite_note-Denlinger-15>
>>  from the rational numbers to the real numbers for each /b/ > 0. But
>> when /b/ < 0, the function /f/ is not even continuous on the set of
>> rational numbers /r/ for which it is defined.
>>
>> For example, consider /b/ = −1. The /n/th root of −1 is −1 for every
>> odd natural number /n/. So if /n/ is an odd positive integer,
>> (−1)^(/m///n/)  = −1 if /m/ is odd, and (−1)^(/m///n/)  = 1 if /m/ is
>> even. Thus the set of rational numbers /q/ for which (−1)^/q/  = 1 is
>> dense <https://en.wikipedia.org/wiki/Dense_set> in the rational
>> numbers, as is the set of /q/ for which (−1)^/q/  = −1. This means
>> that the function (−1)^/q/  is not continuous at any rational number
>> /q/ where it is defined.
>>
>> On the other hand, arbitrary complex powers
>> <https://en.wikipedia.org/wiki/Exponentiation#Powers_of_complex_numbers> of
>> negative numbers /b/ can be defined by choosing a /complex/ logarithm
>> <https://en.wikipedia.org/wiki/Complex_logarithm> of /b/.
>>
>>
>>
>>
>> On Fri, Nov 15, 2019 at 10:26 AM Stan Gorodenski
>> <[hidden email] <mailto:[hidden email]>> wrote:
>>
>>     I don't know if there is any demand, but I think the square root
>>     of -1
>>     is used in electronics. I'm not into this so I really don't know.
>>     I did
>>     not pose this question because I have an application for it. I was
>>     just
>>     curious since it seems that sophisticated software packages like
>> SPSS
>>     and SAS should be able to do it. I just sent an email to join the
>> SAS
>>     discussion group and will ask them if SAS can do it. I suppose one
>>     could
>>     write a routine to return a -1 if the the denominator of the
>>     exponent is
>>     an odd number.
>>     Stan
>>
>>     On 11/15/2019 10:05 AM, Rich Ulrich wrote:
>>     > I wonder - Is there any demand for the exception-coding
>>     > that would be necessary?  How many people write code
>>     > where they want to take the fractional root of a negative
>>     > number, where the fraction is the reciprocal of an odd integer?
>>     > ( Note, the fraction cannot be expressed EXACTLY on a binary
>>     > computer. How is that accommodated?)
>>     >
>>     > The natural programming solution to non-integer roots is
>>     > to use logs.  I suppose if there is an area where the problem
>>     > comes up, specialized programs for that area might do it.
>>     > I suspect the efficient solution might use a special subroutine
>>     > call rather than an in-line expression.
>>     >
>>     > --
>>     > Rich Ulrich
>>     >
>>     >
>> ------------------------------------------------------------------------
>>     > *From:* SPSSX(r) Discussion <[hidden email]
>>     <mailto:[hidden email]>> on behalf of
>>     > Bruce Weaver <[hidden email]
>>     <mailto:[hidden email]>>
>>     > *Sent:* Friday, November 15, 2019 11:35 AM
>>     > *To:* [hidden email] <mailto:[hidden email]>
>>     <[hidden email] <mailto:[hidden email]>>
>>     > *Subject:* Re: Roots
>>     >
>> https://www.ibm.com/support/knowledgecenter/en/SSLVMB_26.0.0/statistics_reference_project_ddita/spss/base/syn_transformation_expressions_domain_errors.html
>>     >
>>     >
>>     >
>>     > Kirill Orlov wrote
>>     > > See DOMAIN ERRORS paragraph in Command Syntax Reference.
>>     > >
>>     > >
>>     > > 15.11.2019 4:53, Stan Gorodenski пишет:
>>     > >> compute z = (-1)**(1/3).
>>     > >
>>     > > =====================
>>     > > To manage your subscription to SPSSX-L, send a message to
>>     >
>>     > > LISTSERV@.UGA
>>     >
>>     > >  (not to SPSSX-L), with no body text except the
>>     > > command. To leave the list, send the command
>>     > > SIGNOFF SPSSX-L
>>     > > For a list of commands to manage subscriptions, send the command
>>     > > INFO REFCARD
>>     >
>>     >
>>     >
>>     >
>>     >
>>     > -----
>>     > --
>>     > Bruce Weaver
>>     > [hidden email] <mailto:[hidden email]>
>>     > http://sites.google.com/a/lakeheadu.ca/bweaver/
>>     >
>>     > "When all else fails, RTFM."
>>     >
>>     > NOTE: My Hotmail account is not monitored regularly.
>>     > To send me an e-mail, please use the address shown above.
>>     >
>>     > --
>>     > Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>>     >
>>     > =====================
>>     > To manage your subscription to SPSSX-L, send a message to
>>     > [hidden email] <mailto:[hidden email]>
>>     (not to SPSSX-L), with no body text except the
>>     > command. To leave the list, send the command
>>     > SIGNOFF SPSSX-L
>>     > For a list of commands to manage subscriptions, send the command
>>     > INFO REFCARD
>>     > ===================== To manage your subscription to SPSSX-L,
>>     send a
>>     > message to [hidden email]
>>     <mailto:[hidden email]>
>>     > <mailto:[hidden email]
>>     <mailto:[hidden email]>> (not to SPSSX-L), with no body
>>     text
>>     > except the command. To leave the list, send the command SIGNOFF
>>     > SPSSX-L For a list of commands to manage subscriptions, send the
>>     > command INFO REFCARD
>>
>>     =====================
>>     To manage your subscription to SPSSX-L, send a message to
>>     [hidden email] <mailto:[hidden email]> (not
>>     to SPSSX-L), with no body text except the
>>     command. To leave the list, send the command
>>     SIGNOFF SPSSX-L
>>     For a list of commands to manage subscriptions, send the command
>>     INFO REFCARD
>>
>>
>>
>> --
>> Jon K Peck
>> [hidden email] <mailto:[hidden email]>
>>
>> ===================== To manage your subscription to SPSSX-L, send a
>> message to [hidden email]
>> <mailto:[hidden email]> (not to SPSSX-L), with no body
>> text except the command. To leave the list, send the command SIGNOFF
>> SPSSX-L For a list of commands to manage subscriptions, send the
>> command INFO REFCARD
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
12