Message Boards Message Boards

Cubed Root of x squared at x = -1

Posted 3 years ago

Hi;

When I solve the function f[x] = 3x^(2/3)-2x at the x values of [-1,0,1], the independent value of -1 gives a complex number and I cannot understand why - see attached.

When I treat the statement of x^(2/3) as the cubed root of x squared and solve the function, I get an answer of 5, which is the same answer that I get on my TI-89.

Obviously I am not understanding what Mathematica is doing in performing this calculation so I would certainly appreciate any clarification.

Thanks,

Mitch Sandlin

Attachments:
POSTED BY: Mitchell Sandlin
4 Replies

x^(2/3) is the same as (x^(1/3))^2 which is not the same as (x^2)^(1/3). This treatment of rational powers is standard.

POSTED BY: Daniel Lichtblau
Posted 3 years ago

Mitch,

This is something that often creates confusion.

In Mathematica x^(1/3) returns the principal root, which is complex. But CubeRoot[x] returns the real root.

f[x_] := 3 CubeRoot[x]^2 - 2 x

f[-1]
(* 5 *)
POSTED BY: Hans Milton
Posted 3 years ago

Mitchell:

Great question. I'm not sure if this is your issue, but it is something to keep in mind.

When I first started using Wolfram I assumed that order of precedence would be what I think I learned many years ago in school. But, either I am remembering wrong or Wolfram is a bit different.

For example:

-1^2

returns -1.

But,

(-1)^2 

returns 1.

POSTED BY: Mike Besso

It's not a question of precedence but one of parsing. WL does follow the traditional rules for order of operations in arithmetic. The FrontEnd parses the input and gives it to the Kernel for evaluation. To see how the FrontEnd interprets your input, wrap your expression in Hold and then in FullForm, then evaluate it:

In[172]:= FullForm[Hold[-1^2]]
Out[172]//FullForm= Hold[Times[-1,Power[1,2]]]

Use parentheses to coerce the interpretation into the form you want:

In[173]:= FullForm[Hold[(-1)^2]]
Out[173]//FullForm= Hold[Power[-1,2]]
POSTED BY: Robert Nachbar
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract