Skip to main content

curated data - Find elements in a decay chain using IsotopeData


I am trying to write a program using the Mathematica function IsotopeData, but am finding the code troublesome. Due to my (relative) familiarity with Python, I am puzzled as to how Mathematica works, as they are very different. $\require{mhchem}$


What I am trying to do, is to find the elements in a decay chain which end with either $\ce{^{191}_{77}Ir}$ or $\ce{^{193}_{77}Ir}$.


In Python syntax, what I'm trying to do would look a bit like this:


#A would be the Atomic Mass and Z the Atomic Number
#DaughterNuclide(Z,A) would return the Daughter Nuclides of the isotope

def IsoCheck(z,a):
try:

x = DaughterNuclide(z,a)
if x in Isotopes:
return [z,a]
else:
return [0,0]
except:
return [0,0]

L=[]
Isotopes = [[76,191],[78,191]]

for a in xrange(1,295):
for z in xrange(1,119):
if IsoCheck(z,a) != [0,0]:
L.append(IsoCheck(z,a))

repeat = 1
#Then, repeat until all chains are over
while repeat == 1:
repeat = 0
for x in L:

if IsoCheck(x) != [0,0] #Lets just pretend it isn't a list
L.append(x)
repeat = 1

Now, my question is this: what would the equivalent code to perform this task in Mathematica look like?



Answer



It is a nice application for the Graph[] features in Mma.
We can calculate quickly all possible decays for all known isotopes, and then let VertexComponent[] look for the chains ending in {"Iridium191", "Iridium193"}.


g = Graph@Union@Flatten[Thread[DirectedEdge @@ ##] & /@ 
Select[{#, IsotopeData[#, "DaughterNuclides"]} & /@ IsotopeData[], #[[2]] != {} &]];


Union@Flatten[VertexComponent[g, #] & /@ {"Iridium191", "Iridium193"}]

$\begin{array}{l} Actinium207&Actinium209&Astatine195\\ Astatine197&Astatine199&Astatine201 \\ Bismuth191&Bismuth193&Bismuth195 \\ Bismuth197&Francium199&Francium201 \\ Francium203&Francium205&Gold191 \\ Gold193&Iridium191&Iridium193 \\ Lead191&Lead193&Mercury191 \\ Mercury193&Osmium191&Osmium193 \\ Platinum191&Platinum193&Polonium191 \\ Polonium193&Polonium195&Polonium197 \\ Protactinium213&Radium203&Radium205 \\ Radon195&Radon197&Radon199 \\ Radon201&Rhenium191&Rhenium193 \\ Thallium191&Thallium193&Thorium209 \\ \end{array}$


Edit


The possible decay chains are:


g1 = Union[Flatten[VertexComponent[g, #] & /@ #], #] &@{"Iridium191", "Iridium193"}
g2 = Subgraph[g, g1, VertexShapeFunction -> "Name", GraphLayout -> "LayeredDrawing"]

Mathematica graphics



Edit 2


Another application.


(*All possible decays of all Isotopes *)
decays = Select[{#, IsotopeData[#, "DaughterNuclides"]} & /@ IsotopeData[], #[[2]] != {} &];
(*Identify the Isotope with more ways to decay *)
mostModes = SortBy[decays, -Length@#[[2]] &][[1, 1]];
(*Get its decay characteristics*)
mMdecays = IsotopeData[mostModes, #] & /@ {"DaughterNuclides", "DecayModeSymbols", "BranchingRatios"};
(*Aux Function*)
pos[mostModes] = Above; Table[pos[i] = Below, {i, mMdecays[[1]]}];

(*Draw a scheme of its decays modes and percentages*)
g = Framed@Graph[Labeled[#, Placed[{Text@Style[#, 14, FontFamily -> "Helvetica"]},
{pos[#]}]] & /@ Join[{mostModes}, mMdecays[[1]]],
Labeled[DirectedEdge[mostModes, #[[1]]], Placed[{ToString@StandardForm@#[[2]] <> "\n" <>
ToString[100 #[[3]]] <> "%"}, {"Middle"}]] & /@ (Transpose@ mMdecays),
ImagePadding -> 30]

Mathematica graphics


Comments

Popular posts from this blog

front end - keyboard shortcut to invoke Insert new matrix

I frequently need to type in some matrices, and the menu command Insert > Table/Matrix > New... allows matrices with lines drawn between columns and rows, which is very helpful. I would like to make a keyboard shortcut for it, but cannot find the relevant frontend token command (4209405) for it. Since the FullForm[] and InputForm[] of matrices with lines drawn between rows and columns is the same as those without lines, it's hard to do this via 3rd party system-wide text expanders (e.g. autohotkey or atext on mac). How does one assign a keyboard shortcut for the menu item Insert > Table/Matrix > New... , preferably using only mathematica? Thanks! Answer In the MenuSetup.tr (for linux located in the $InstallationDirectory/SystemFiles/FrontEnd/TextResources/X/ directory), I changed the line MenuItem["&New...", "CreateGridBoxDialog"] to read MenuItem["&New...", "CreateGridBoxDialog", MenuKey["m", Modifiers-...

How to thread a list

I have data in format data = {{a1, a2}, {b1, b2}, {c1, c2}, {d1, d2}} Tableform: I want to thread it to : tdata = {{{a1, b1}, {a2, b2}}, {{a1, c1}, {a2, c2}}, {{a1, d1}, {a2, d2}}} Tableform: And I would like to do better then pseudofunction[n_] := Transpose[{data2[[1]], data2[[n]]}]; SetAttributes[pseudofunction, Listable]; Range[2, 4] // pseudofunction Here is my benchmark data, where data3 is normal sample of real data. data3 = Drop[ExcelWorkBook[[Column1 ;; Column4]], None, 1]; data2 = {a #, b #, c #, d #} & /@ Range[1, 10^5]; data = RandomReal[{0, 1}, {10^6, 4}]; Here is my benchmark code kptnw[list_] := Transpose[{Table[First@#, {Length@# - 1}], Rest@#}, {3, 1, 2}] &@list kptnw2[list_] := Transpose[{ConstantArray[First@#, Length@# - 1], Rest@#}, {3, 1, 2}] &@list OleksandrR[list_] := Flatten[Outer[List, List@First[list], Rest[list], 1], {{2}, {1, 4}}] paradox2[list_] := Partition[Riffle[list[[1]], #], 2] & /@ Drop[list, 1] RM[list_] := FoldList[Transpose[{First@li...

plotting - How to draw lines between specified dots on ListPlot?

I would like to create a plot where I have unconnected dots and some connected. So far, I have figured out how to draw the dots. My code is the following: ListPlot[{{1, 1}, {2, 2}, {3, 3}, {4, 4}, {1, 4}, {2, 5}, {3, 6}, {4, 7}, {1, 7}, {2, 8}, {3, 9}, {4, 10}, {1, 10}, {2, 11}, {3, 12}, {4,13}, {2.5, 7}}, Ticks -> {{1, 2, 3, 4}, None}, AxesStyle -> Thin, TicksStyle -> Directive[Black, Bold, 12], Mesh -> Full] I have thought using ListLinePlot command, but I don't know how to specify to the command to draw only selected lines between the dots. Do have any suggestions/hints on how to do that? Thank you. Answer One possibility would be to use Epilog with Line : ListPlot[ {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {1, 4}, {2, 5}, {3, 6}, {4, 7}, {1, 7}, {2, 8}, {3, 9}, {4, 10}, {1, 10}, {2, 11}, {3, 12}, {4, 13}, {2.5, 7}}, Ticks -> {{1, 2, 3, 4}, None}, AxesStyle -> Thin, TicksStyle -> Directive[Black, Bold, 12], Mesh -> Full, Epilog -> { Line[ ...