Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #9364 > unrolled thread

recursively solve equation and save the values only

Started bywyn smjy <wsmjy2012@gmail.com>
First post2012-04-02 08:30 +0000
Last post2012-04-03 08:49 +0000
Articles 3 — 3 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  recursively solve equation and save the values only wyn smjy <wsmjy2012@gmail.com> - 2012-04-02 08:30 +0000
    Re: recursively solve equation and save the values only markholtuk <markholtuk@googlemail.com> - 2012-04-03 08:47 +0000
    Re: recursively solve equation and save the values only nanobio9 <kuokan.liang@gmail.com> - 2012-04-03 08:49 +0000

#9364 — recursively solve equation and save the values only

Fromwyn smjy <wsmjy2012@gmail.com>
Date2012-04-02 08:30 +0000
Subjectrecursively solve equation and save the values only
Message-ID<jlbo31$47o$1@smc.vnet.net>
Dear All,

I am new to Mathematica. I am trying to recursively solve equation and
saving the values into Table. Since I need the real solutions only so
I use Reduce.

The following is my code:

f = 5.68672 T + 6.46776 T^3

t = Table[i, {i, 0.2, 3, 0.2}]

sols = Table[Reduce[f == t[[i]], T, Reals], {i, Length[t]}] {T ==
0.0351204, T == 0.06995, T == 0.104221, T == 0.137708, T == 0.170237,
T == 0.201687, T == 0.231988, T == 0.26111, T == 0.289058, T ==
0.315857, T == 0.34155, T == 0.366188, T == 0.389828, T == 0.412529, T
== 0.434347}

The solution is OK as I compared it to other software as well. The
only thing that matters me is how to remove the T== , i.e. I just need
the solution and then to copy this into another table, say sols2 that
contains

sols2 = {0.0351204, 0.06995, 0.104221, T == 0.137708,.., 0.434347}

I tried the following: sols2 = T/.sols but produce the following
error:

sols2 = ReplaceAll::reps: ... is neither a list of replacement rules
nor a valid dispatch table, and so cannot be used for replacing. >>

Does anyone know how to remove the T==?

Thank you,

Wayan

[toc] | [next] | [standalone]


#9369

Frommarkholtuk <markholtuk@googlemail.com>
Date2012-04-03 08:47 +0000
Message-ID<jledfq$gv0$1@smc.vnet.net>
In reply to#9364
sols[[All,2]] will do what you want.

On Apr 2, 9:30 am, wyn smjy <wsmjy2...@gmail.com> wrote:
> Dear All,
>
> I am new to Mathematica. I am trying to recursively solve equation and
> saving the values into Table. Since I need the real solutions only so
> I use Reduce.
>
> The following is my code:
>
> f = 5.68672 T + 6.46776 T^3
>
> t = Table[i, {i, 0.2, 3, 0.2}]
>
> sols = Table[Reduce[f == t[[i]], T, Reals], {i, Length[t]}] {T ==
> 0.0351204, T == 0.06995, T == 0.104221, T == 0.137708, T == 0.170237,
> T == 0.201687, T == 0.231988, T == 0.26111, T == 0.289058, T ==
> 0.315857, T == 0.34155, T == 0.366188, T == 0.389828, T == 0.412529, T
> == 0.434347}
>
> The solution is OK as I compared it to other software as well. The
> only thing that matters me is how to remove the T== , i.e. I just need
> the solution and then to copy this into another table, say sols2 that
> contains
>
> sols2 = {0.0351204, 0.06995, 0.104221, T == 0.137708,.., 0.434347}
>
> I tried the following: sols2 = T/.sols but produce the following
> error:
>
> sols2 = ReplaceAll::reps: ... is neither a list of replacement rules
> nor a valid dispatch table, and so cannot be used for replacing. >>
>
> Does anyone know how to remove the T==?
>
> Thank you,
>
> Wayan

[toc] | [prev] | [next] | [standalone]


#9377

Fromnanobio9 <kuokan.liang@gmail.com>
Date2012-04-03 08:49 +0000
Message-ID<jledin$h08$1@smc.vnet.net>
In reply to#9364
Hi,

My solution to your example would be:

solstab = (T/.#&)/@(sols/.{Equal->Rule})

Best regards,
Kuo Kan Liang

> I am new to Mathematica. I am trying to recursively solve equation and
> saving the values into Table. Since I need the real solutions only so
> I use Reduce.
>
> The following is my code:
>
> f = 5.68672 T + 6.46776 T^3
>
> t = Table[i, {i, 0.2, 3, 0.2}]
>
> sols = Table[Reduce[f == t[[i]], T, Reals], {i, Length[t]}] {T ==
> 0.0351204, T == 0.06995, T == 0.104221, T == 0.137708, T == 0.170237,
> T == 0.201687, T == 0.231988, T == 0.26111, T == 0.289058, T ==
> 0.315857, T == 0.34155, T == 0.366188, T == 0.389828, T == 0.412529, T
> == 0.434347}
>
> The solution is OK as I compared it to other software as well. The
> only thing that matters me is how to remove the T== , i.e. I just need
> the solution and then to copy this into another table, say sols2 that
> contains
>
> sols2 = {0.0351204, 0.06995, 0.104221, T == 0.137708,.., 0.434347}
>
> I tried the following: sols2 = T/.sols but produce the following
> error:
>
> sols2 = ReplaceAll::reps: ... is neither a list of replacement rules
> nor a valid dispatch table, and so cannot be used for replacing. >>
>
> Does anyone know how to remove the T==?
>
> Thank you,
>
> Wayan

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web