Re: Problems with Solve

• To: mathgroup at smc.vnet.net
• Subject: [mg132468] Re: Problems with Solve
• From: totarefugium <mtaktikos at t-online.de>
• Date: Sun, 23 Mar 2014 05:00:38 -0400 (EDT)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• Delivered-to: l-mathgroup@wolfram.com
• Delivered-to: mathgroup-outx@smc.vnet.net
• Delivered-to: mathgroup-newsendx@smc.vnet.net
• References: <lgj2cs\$lcg\$1@smc.vnet.net>

```Hello,

In[1]:= N[Solve[z + 5 (z^2 - 1) + 1 z^3 == 1, z]]
Out[1]= {{z -> 0.925423 + 0. I}, {z -> -4.47735 + 2.22045*10^-16 I}, {z
-> -1.44807 - 4.44089*10^-16 I}}

In[2]:=[N[Solve[z + 5 (z^2 - 1) + 1 z^3 == 1, z] ] /.
Complex[re_, im_ /; Abs[im] < 0.001] :> re
Out[2] = {{z -> 0.925423}, {z -> -4.47735}, {z -> -1.44807}}

HTH,

Michael Taktikos
Hamburg/Germany

On 22.03.2014 05:09, Samuel Mark Young wrote:
> I'm trying to use the solutions of Solve from solving a cubic equation - however, it keeps returning complex answers when there are real solutions. For example:
>
> Solve[z + 5 (z^2 - 1) + 1 z^3 == 1, z]
>
> This equation has 3 real solutions. However, the answers returned when I ask mathematica for a decimal answer are complex (which I need to do later on when an integration needs solving numerically):
> {{z -> 0.925423 + 0. I}, {z -> -4.47735 +
>      2.22045*10^-16 I}, {z -> -1.44807 - 4.44089*10^-16 I}}
>
> I'm guessing this is to do with the finite precision that is used in the calculations as the imaginary components are very small, but am unsure how to deal with them and they shouldn't be there. Any suggestions?
>

```

• Prev by Date: Re: Mapping tag-value lists to a third
• Next by Date: Re: Do we need a When function?
• Previous by thread: Re: Problems with Solve
• Next by thread: Re: Problems with Solve