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


Groups > comp.soft-sys.math.mathematica > #2194

Re: Iterative process using IsotopeData.

From DrMajorBob <btreat1@austin.rr.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Iterative process using IsotopeData.
Date 2011-05-08 11:34 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <iq5v4a$ph9$1@smc.vnet.net> (permalink)

Show all headers | View raw


Clear[f]
f[{}] = {};
f[s_String] := Module[{next = IsotopeData[s, "DaughterNuclides"]},
   If[next == {}, next, First@next]
   ]
Drop[FixedPointList[f, "U238"], -2]

{"U238", "Thorium234", "Protactinium234", "Uranium234", "Thorium230", \
"Radium226", "Radon222", "Polonium218", "Lead214", "Bismuth214", \
"Polonium214", "Lead210", "Bismuth210", "Polonium210", "Lead206"}

or

Clear[f]
f[{}] = {};
f[s_String] :=
  If[# == {}, #, First@#] &@IsotopeData[s, "DaughterNuclides"]
Drop[FixedPointList[f, "U238"], -2]

{"U238", "Thorium234", "Protactinium234", "Uranium234", "Thorium230", \
"Radium226", "Radon222", "Polonium218", "Lead214", "Bismuth214", \
"Polonium214", "Lead210", "Bismuth210", "Polonium210", "Lead206"}

Bobby

On Sat, 07 May 2011 06:32:15 -0500, Guillermo Sanchez  
<guillermo.sanchez@hotmail.com> wrote:

> Dear group
>
> I would like a eleghant solution of this iterative process (perhaps
> using NestList or FoldList}:
>
> In[1]: First[IsotopeData["U238", "DaughterNuclides"]]
> Out[1]: "Thorium234"
> In[2]: First[IsotopeData[%, "DaughterNuclides"]]
> Out[2]:"Protactinium234"
> In[3]: First[IsotopeData[%, "DaughterNuclides"]]
> Out[3]: "Uranium234"
>
> and so on n times (the best solution would be if the process stop when
> find that there not more isotopes,  that is when Out[n] = { })
>
> and them
>
> {"U238", "Protactinium234",  "Uranium234", ...}
>
> Any help?
>
> Guillermo
>


-- 
DrMajorBob@yahoo.com

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Iterative process using IsotopeData. DrMajorBob <btreat1@austin.rr.com> - 2011-05-08 11:34 +0000

csiph-web