Skip to content

Preferring real outputs #2790

Discussion options

You must be logged in to vote

Well, yes, in general pow(z, a) is defined as exp(a ln(z)), as usual in mathematics, which helps keep everything consistent, but that does does yield one of the complex cube roots of -8. I at the moment am not having any clever ideas of a consistent alternative in which you would generally get real values for multivalued expressions that potentially have a real value, so I guess I would have to recommend that for your application you write a "realpow" function that looks for the special cases where you want to display something different and behaves accordingly. Depending on your application, you might then face the problem of getting the expression parser to execute realpow instead of po…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@ChristopherChudzicki
Comment options

@gwhitney
Comment options

Answer selected by ChristopherChudzicki
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants