16
$\begingroup$

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?

$\endgroup$
2
  • $\begingroup$ I suggest you show some of your attempt in Mathematica (especially how you call the IsotopeData function), as of right now it's not clear what you're working with in Mathematica $\endgroup$
    – David Robinson
    Aug 22, 2012 at 20:21
  • $\begingroup$ The DaughterNuclide parameter of the IsotopeData function is called by the equivalent IsotopeData[{z,a},"DaughterNuclide"] where DaughterNuclide(z,a) is called in the python script above. $\endgroup$
    – Acebulf
    Aug 22, 2012 at 20:25

1 Answer 1

18
$\begingroup$

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

$\endgroup$
12
  • $\begingroup$ @R.M I think because you are not getting the whole decay chain. See update $\endgroup$ Aug 23, 2012 at 13:20
  • $\begingroup$ Oh, the code and the images don't quite match up. I get this this under win 7 mma 8.0.1 $\endgroup$
    – Ajasja
    Aug 23, 2012 at 13:56
  • 1
    $\begingroup$ @Ajasja g1 = Union[Flatten[VertexComponent[g, #] & /@ #], #] &@{"Iridium191", "Iridium193"}; g2 = HighlightGraph[ Subgraph[g, g1, GraphLayout -> "LayeredDrawing", VertexLabels -> "Name", ImagePadding -> 20], {"Iridium193", "Iridium191"}] $\endgroup$ Aug 23, 2012 at 13:58
  • 1
    $\begingroup$ @Verde Naah, no need to apologize... lol. When did Argentinians become Canadians? :P I was just pointing out something that might not have occurred to most people – that mathjax might slow down the page loading on mobile devices :) $\endgroup$
    – rm -rf
    Aug 26, 2012 at 4:36
  • 1
    $\begingroup$ Well, I just learnt that they suck at mocking ;) $\endgroup$
    – rm -rf
    Aug 26, 2012 at 4:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.