Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Matlab wrong cubic root
Replies: 3   Last Post: Dec 15, 2012 9:05 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 40
Registered: 12/11/12
Re: Matlab wrong cubic root
Posted: Dec 15, 2012 9:05 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

W dniu 2012-12-15 19:19, sergio_r@mail.com pisze:
> Hello all,
> Is there a way of telling matlab to return first a real root
> instead of a complex one?
> For some strange reason matlab seems not to handle cubic roots
> properly. Apparently the default behaviour is to first
> report a complex root. Let's see two examples:

>>> (-1/2)^(1/3)
> ans =
> 0.3969 + 0.6874i


>>> (-1/2)^(2/3)
> ans =
> -0.3150 + 0.5456i


I'm afraid this is the simplest way, but I'm not sure.


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum 1994-2015. All Rights Reserved.