Group Abstract Group Abstract

Message Boards Message Boards

1
|
7.3K Views
|
2 Replies
|
6 Total Likes
View groups...
Share
Share this post:

Why N is not affecting the rest of Power, but not NHoldRest is set?

Posted 6 years ago

Dear all,

I'm surprised why "N" is not affecting all parameters of "Power", even "Power" has not the attribute "NHoldRest"? Is this feature documented somewhere, or is it a bug?

Input:

Attributes[Power]
SetAttributes[myPower, Attributes[Power]]
Power[x, 2] //N //FullForm
Power[2, y] //N //FullForm
myPower[x, 2] //N //FullForm
myPower[2, y] //N //FullForm

Result:

{Listable, NumericFunction, OneIdentity, Protected}
Power[x, 2]
Power[2.`, y]
myPower[x, 2.`]
myPower[2.`, y]

Mathematica 10.0.2 (x64), Windows 7

POSTED BY: Martin Guttmann
2 Replies

I'm not sure if this is documented, But I guess you have to interpet x^2 as x*x indeed. If you want to force it you could do:

x^(5/2)
MapAt[N, %, -1]

giving:

x^2.5

Also: I think that N tries to evaluate the entire expression to an approximate number, not necessarily all the subexpressions.

POSTED BY: Sander Huisman
POSTED BY: Szabolcs Horvát
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard