#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Options

# Feynman Diagrams and UML Sequence Diagrams

John Baez and Jacob Biamonte have mentioned Feynman diagrams several times in their Network Theory series. Part 7 includes a model of interactions between amoebas, using a stochastic Petri net and a Feynman diagram. I've implemented a version of the model as a simple online app.

While running, the app generates the instructions for a Unified Modeling Language (UML) sequence diagram. UML is used by software analysts and developers. UML sequence diagrams specify and capture sequences of runtime interactions between objects over time, also known as histories. The instructions can be fed to the web sequence diagrams online tool which will generate the diagram. My goal in generating these sequence diagrams is to test my sense that Feynman diagrams and UML sequence diagrams have a lot in common, based on my reading of the Network Theory posts.

I'd like to ask this group a few questions:

(1) To those of you who are more familiar with Feynman diagrams, does this UML sequence diagram fill essentially the same function as a Feynman diagram? Does it look similar? What are the similarities and differences?

(2) I know of at least four tools, each with its own syntax, that I could use in place of websequencediagrams.com to draw a sequence diagram. Are there similar tools in the world of Feynman diagrams?

To get a better sense of how similar and different these two diagram types are, I would like to write out two streams of text while the Amoeba app is running. One stream of text would contain instructions to build a sequence diagram - this is what I'm doing now. The other stream would contain instructions to build a Feynman diagram. In both cases the instructions would be in the syntax of a tool that knows how to display that type of diagram. As much as possible, the two streams of instructions should both be written out from the same parts of the code in the Amoeba app. The semantics should be the same, but the syntax would be radically different.

The following is a representative set of instructions, generated by the Amoeba app, that can be fed to the online tool to generate a UML sequence diagram:

title Amoebas
Amoeba_2->Amoeba_3: fission
Amoeba_2->Amoeba_3: compete
Amoeba_2->Amoeba_3: compete
destroy Amoeba_3
Amoeba_2->Amoeba_4: fission
Amoeba_4->Amoeba_2: compete
Amoeba_2->Amoeba_4: compete
Amoeba_4->Amoeba_5: fission
Amoeba_4->Amoeba_2: compete
Amoeba_4->Amoeba_5: compete
Amoeba_2->Amoeba_4: compete
Amoeba_2->Amoeba_5: compete
Amoeba_4->Amoeba_2: compete
Amoeba_4->Amoeba_5: compete
Amoeba_5->Amoeba_2: compete
Amoeba_5->Amoeba_4: compete
Amoeba_2->Amoeba_4: compete
Amoeba_2->Amoeba_5: compete
Amoeba_4->Amoeba_2: compete
Amoeba_4->Amoeba_5: compete
destroy Amoeba_5
Amoeba_2->Amoeba_4: compete
Amoeba_4->Amoeba_2: compete


The diagram generated by the online tool looks like this:

• Options
1.
edited June 2012

Hi Ken -- this is a nice observation, that you can model similar things using a UML sequence diagram as you can with Feynman diagrams. I'm not one of the Feynman diagram experts here, but I'd like to ask if you have much experience with UML statecharts also? I've noticed that they have been picked up a bit by the bioinformatics crowd, eg this paper.

What I like about statecharts is you can choose to interpret them in different concurrency semantics, which I feel might be complementary to the sequential viewpoint you have illustrated with the Amoeba app.

I like Luca Cardelli's work when it comes to this sort of thing. I especially enjoyed this paper which emphasizes how important it is sometimes to look at a complex system from a computational point of view.

Comment Source:Hi Ken -- this is a nice observation, that you can model similar things using a UML sequence diagram as you can with Feynman diagrams. I'm not one of the Feynman diagram experts here, but I'd like to ask if you have much experience with UML statecharts also? I've noticed that they have been picked up a bit by the bioinformatics crowd, eg [this paper](http://www.biomedcentral.com/1471-2105/13/S4/S20). What I like about statecharts is you can choose to interpret them in different concurrency semantics, which I feel might be complementary to the sequential viewpoint you have illustrated with the Amoeba app. I like [Luca Cardelli](http://lucacardelli.name/)'s work when it comes to this sort of thing. I especially enjoyed [this paper](http://lucacardelli.name/Papers/Can%20a%20Systems%20Biologist%20Fix%20a%20Tamagotchi.pdf) which emphasizes how important it is sometimes to look at a complex system from a computational point of view.
• Options
2.

Hi Allan,

Yes. I do have experience with statecharts. I used to work for a company called ObjecTime that made a visual-modeling tool for realtime and concurrent software development, based on state machines, on sequence diagrams, and on what became UML composite structure diagrams. The company was bought by Rational Software (the originators of UML) and IBM, and a lot of the ideas found their way into the UML 2 specification. The ObjecTime state machines/diagrams were based on Harel's statechart paper Statecharts: a visual formalism for complex systems.

I see that David Harel's work is referenced in the bioinformatics paper you mention. Harel's papers have had a big influence on me and I recommend them highly - his work on visual formalisms including statecharts, and his work on building biological models using his company's tools. Their products were one of the main competitors to the ObjecTime tools. I co-authored a few papers suggesting that the UML and ObjecTime approaches could be used in modeling biological cells and such, and I'm interested now in how they can be used with climate modeling.

I recall that Statecharts had concurrency built-in to the statechart diagrams, while ObjecTime had concurrent objects each of which had a state machine. The various state machines would send messages to each other, that could optionally be captured as sequence diagrams. The two approaches are functionally very similar. UML state diagrams have optional concurrent states (orthogonal regions) that capture the statechart concept, while UML composite structure diagrams capture the ObjecTime concept of concurrent objects. States and objects can be thought of as the same things.

The very simple Amoeba app I built is ultimately based on the concurrent Object-Oriented approach I learned at ObjecTime, and it does use a simple state machine embedded in the code. That page is an informal workbook that contains all the structure and code for the app, and the app can be run inside the page.

I looked at Luca Cardelli's work some years ago and was impressed. I'll take a closer look at the paper you referred to. Thanks for mentioning it and the bioinformatics paper.

My basic approach to understanding things is to try to build some software, hence the Amoeba app. And I'm always interested in how something like a Feynman diagram connects with something I do know like a UML sequence diagram. Having started reading John and Jacob's posts about Network Theory and stochastic Petri nets, I'm also very interested in how Petri nets are similar and different from state machines and composite structure. I've never explored Petri nets in detail before, and I'm seeing some interesting things in them. Petri nets have been used in the same telecommunications domain that the ObjecTime and Statecharts tools were marketing to.

Now I'm going to take a closer look at the papers you mentioned, and hopefully someone will have some ideas on how Feynman diagrams fit in! Thanks for your comments.

Comment Source:Hi Allan, Yes. I do have experience with statecharts. I used to work for a company called ObjecTime that made a visual-modeling tool for realtime and concurrent software development, based on state machines, on sequence diagrams, and on what became UML composite structure diagrams. The company was bought by Rational Software (the originators of UML) and IBM, and a lot of the ideas found their way into the UML 2 specification. The ObjecTime state machines/diagrams were based on Harel's statechart paper [Statecharts: a visual formalism for complex systems](http://www.wisdom.weizmann.ac.il/~harel/SCANNED.PAPERS/Statecharts.pdf). I see that [David Harel's work](http://www.wisdom.weizmann.ac.il/~harel/) is referenced in the bioinformatics paper you mention. Harel's papers have had a big influence on me and I recommend them highly - his work on visual formalisms including statecharts, and his work on building biological models using his company's tools. Their products were one of the main competitors to the ObjecTime tools. I co-authored a [few papers](http://www.primordion.com/pub/kenWebbPubs.html) suggesting that the UML and ObjecTime approaches could be used in modeling biological cells and such, and I'm interested now in how they can be used with climate modeling. I recall that Statecharts had concurrency built-in to the statechart diagrams, while ObjecTime had concurrent objects each of which had a state machine. The various state machines would send messages to each other, that could optionally be captured as sequence diagrams. The two approaches are functionally very similar. UML state diagrams have optional concurrent states (orthogonal regions) that capture the statechart concept, while UML composite structure diagrams capture the ObjecTime concept of concurrent objects. States and objects can be thought of as the same things. The very simple [Amoeba app](http://www.primordion.com/Xholon/wb/openwb.php?q=2917927&f=gist.github.com/raw/) I built is ultimately based on the concurrent Object-Oriented approach I learned at ObjecTime, and it does use a simple state machine embedded in the code. That page is an informal workbook that contains all the structure and code for the app, and the app can be run inside the page. I looked at Luca Cardelli's work some years ago and was impressed. I'll take a closer look at the paper you referred to. Thanks for mentioning it and the bioinformatics paper. My basic approach to understanding things is to try to build some software, hence the Amoeba app. And I'm always interested in how something like a Feynman diagram connects with something I do know like a UML sequence diagram. Having started reading John and Jacob's posts about Network Theory and stochastic Petri nets, I'm also very interested in how Petri nets are similar and different from state machines and composite structure. I've never explored Petri nets in detail before, and I'm seeing some interesting things in them. Petri nets have been used in the same telecommunications domain that the ObjecTime and Statecharts tools were marketing to. Now I'm going to take a closer look at the papers you mentioned, and hopefully someone will have some ideas on how Feynman diagrams fit in! Thanks for your comments.
• Options
3.

Ken -- that's great! You have more experience than most with statecharts then, given your time at ObjecTime. I've checked out some of your papers too -- very cool, you are right up on this stuff!

Are you familiar with Howard T. Odum's work, eg Environment, Power, and Society for the Twenty-First Century (which I found out about through the Azimuth projects Recommended reading page)? With the (big) caveat that I have just skimmed over this material, my impression is that you could find many sources here if you were interested in applying your visual modeling expertise to climate science.

Also (I'm sure someone will correct me if I'm wrong) I have seen posts here suggesting that Nathan Urban is also versed in visual formalisms and has been seeking ways to apply them to climate science.

Comment Source:Ken -- that's great! You have more experience than most with statecharts then, given your time at ObjecTime. I've checked out some of your papers too -- very cool, you are right up on this stuff! Are you familiar with Howard T. Odum's work, eg [Environment, Power, and Society for the Twenty-First Century](http://www.azimuthproject.org/azimuth/show/Recommended+reading#environment_power_and_society_for_the_twentyfirst_century_the_hierarchy_of_energy_29) (which I found out about through the Azimuth projects [[Recommended reading]] page)? With the (big) caveat that I have just skimmed over this material, my impression is that you could find many sources here if you were interested in applying your visual modeling expertise to climate science. Also (I'm sure someone will correct me if I'm wrong) I have seen posts here suggesting that Nathan Urban is also versed in visual formalisms and has been seeking ways to apply them to climate science.
• Options
4.

Hi Allan,

I agree that Howard Odum's writings are worth having a close look at. I haven't read the book in the Azimuth reading list. But I was excited by his 1976 book Energy Basis for Man and Nature because (1) it connects a lot of things like energy, ecology, economics, and a bit about climate, (2) it's qualitative rather than quantitative, (3) it includes a huge wealth of diagrams, many using his Energy Systems Language that John Baez mentions as "Energese" in his first Network Theory post. Odum's more recent book looks like it builds on the same base. The wikipedia article on Howard T. Odum has the intriguing suggestion that "Odum's language appears to be similar in approach to the Systems Modeling Language" (SysML) which is an interesting extension of a subset of the Unified Modeling Language (UML) and which John also mentions in his Network Theory post.

The open access bioinformatics paper you mentioned in your first reply is excellent, as are other papers that it references including Executable cell biology. This second paper compares Petri nets, Interacting state machines (Statecharts), and other executable biology modeling approaches.

I'll take a closer look at what Nathan Urban is up to.

Comment Source:Hi Allan, I agree that Howard Odum's writings are worth having a close look at. I haven't read the book in the Azimuth reading list. But I was excited by his 1976 book Energy Basis for Man and Nature because (1) it connects a lot of things like energy, ecology, economics, and a bit about climate, (2) it's qualitative rather than quantitative, (3) it includes a huge wealth of diagrams, many using his [Energy Systems Language](http://en.wikipedia.org/wiki/Energy_Systems_Language) that John Baez mentions as "Energese" in his first [Network Theory](http://johncarlosbaez.wordpress.com/2011/03/04/network-theory-part-1/) post. Odum's more recent book looks like it builds on the same base. The wikipedia article on [Howard T. Odum](http://en.wikipedia.org/wiki/Howard_T._Odum) has the intriguing suggestion that "Odum's language appears to be similar in approach to the Systems Modeling Language" (SysML) which is an interesting extension of a subset of the Unified Modeling Language (UML) and which John also mentions in his Network Theory post. The open access bioinformatics paper you mentioned in your first reply is excellent, as are other papers that it references including [Executable cell biology](http://lcw.lehman.edu/academics/cmacs/documents/executable_cell_biology.pdf). This second paper compares Petri nets, Interacting state machines (Statecharts), and other executable biology modeling approaches. I'll take a closer look at what Nathan Urban is up to.
• Options
5.

Sorry to bombard you with papers Ken, but I've just found this paper on mapping Petri nets to statecharts which presumably also applies to stochastic petri nets. I'll refrain from mentioning all the exciting papers I found searching for 'stochastic statecharts' since I haven't read any of them! I'm blown away that all this stuff exists though.. and also by that Executable cell biology paper you mentioned: this whole area seems to be really booming.

So, back (almost) to the topic you brought up: I think it would be very interesting to look at the mapping between statecharts and Petri nets in more detail. Petri nets have no analogue for statechart hierarchies, so it could be interesting to come up with situations where this extra expressive power would allow you to model something not (easily) accessible to Petri nets.

(Good to see the Harel paper again too -- I studied this as an undergrad!)

Comment Source:Sorry to bombard you with papers Ken, but I've just found [this paper on mapping Petri nets to statecharts](http://is.tm.tue.nl/staff/heshuis/pntosc-tr.pdf) which presumably also applies to stochastic petri nets. I'll refrain from mentioning all the exciting papers I found searching for 'stochastic statecharts' since I haven't read any of them! I'm blown away that all this stuff exists though.. and also by that [Executable cell biology](http://lcw.lehman.edu/academics/cmacs/documents/executable_cell_biology.pdf) paper you mentioned: this whole area seems to be really booming. So, back (almost) to the topic you brought up: I think it would be very interesting to look at the mapping between statecharts and Petri nets in more detail. Petri nets have no analogue for statechart hierarchies, so it could be interesting to come up with situations where this extra expressive power would allow you to model something not (easily) accessible to Petri nets. (Good to see the Harel paper again too -- I studied this as an undergrad!)
• Options
6.

I like the idea of looking at Statecharts and Petri nets in more detail, especially the role of hierarchy and how that differentiates the two approaches. I have created a new discussion topic called Petri nets and Statecharts, and will leave this existing discussion for any comments on Feynman diagrams and UML sequence diagrams.

Comment Source:I like the idea of looking at Statecharts and Petri nets in more detail, especially the role of hierarchy and how that differentiates the two approaches. I have created a new discussion topic called [Petri nets and Statecharts](http://forum.azimuthproject.org/discussion/1008/petri-nets-and-statecharts/), and will leave this existing discussion for any comments on Feynman diagrams and UML sequence diagrams.
• Options
7.

Great -- good idea! Sorry to switch topics on you :-)

Hopefully an expert on Feynman diagrams will chime in, or at least ask the right questions about UML sequence diagrams to help you decide the degree to which they are related.

Comment Source:Great -- good idea! Sorry to switch topics on you :-) Hopefully an expert on Feynman diagrams will chime in, or at least ask the right questions about UML sequence diagrams to help you decide the degree to which they are related.
• Options
8.

Sorry to take so long to tune in, Ken! I was completely focused on the Barcelona biodiversity conference for a while. I am back in action now...

Yes, that UML sequence diagram could probably be translated into a Feynman diagram. To know for sure, I need to know the answer to this question. What rule is being used to decide when an amoeba is destroyed here?

Comment Source:Sorry to take so long to tune in, Ken! I was completely focused on the Barcelona biodiversity conference for a while. I am back in action now... Yes, that UML sequence diagram could probably be translated into a Feynman diagram. To know for sure, I need to know the answer to this question. **What rule is being used to decide when an amoeba is destroyed here?** <img src = "http://www.primordion.com/Xholon/wb/images/Amoeba_SequenceDiagram.png" alt = ""/>
• Options
9.

John, I've checked my code, and here's the rule.

Each time step, each Amoeba competes one-on-one with each other Amoeba that existed at the start of the previous time step. The targeted Amoeba generates a random number between 0.0 and 1.0. If the random number is less than 0.05, then the targeted Amoeba destroys itself.

In the diagram, Amoeba_2 targets Amoeba_3 for a competition. Amoeba_3 gets a low random number and dies. The same thing happens later between Amoeba_4 and Amoeba_5.

The diagram only shows some of the activity, to keep it short.

Comment Source:John, I've checked my code, and here's the rule. Each time step, each Amoeba competes one-on-one with each other Amoeba that existed at the start of the previous time step. The targeted Amoeba generates a random number between 0.0 and 1.0. If the random number is less than 0.05, then the targeted Amoeba destroys itself. In the diagram, Amoeba_2 targets Amoeba_3 for a competition. Amoeba_3 gets a low random number and dies. The same thing happens later between Amoeba_4 and Amoeba_5. The diagram only shows some of the activity, to keep it short.
• Options
10.
edited July 2012

Thanks, Ken. Then yes, this looks like exactly the sort of system a stochastic Petri net describes... and there's a general theory, which I've rapidly sketched on my blog, for using Feynman diagrams to compute what happens over the passage of time for any system described by a stochastic Petri net.

On the blog I'm mainly talking about systems where time is continuous rather than coming in discrete steps. But this theory can be adapted to deal with discrete time steps. For computer simulations discrete time steps are easier, of course.

By coincidence, there's a stochastic Petri net model of amoebas in Part 7 of the network theory notes... including a Feynman diagram!

So it seems here you are dealing with a kind of mathematical model I like, because I have it nicely formalized and I can throw some theorems at it. So, how about something a bit more 'hierarchical'?

Comment Source:Thanks, Ken. Then yes, this looks like exactly the sort of system a stochastic Petri net describes... and there's a general theory, which I've rapidly sketched on my blog, for using Feynman diagrams to compute what happens over the passage of time for any system described by a stochastic Petri net. On the blog I'm mainly talking about systems where time is continuous rather than coming in discrete steps. But this theory can be adapted to deal with discrete time steps. For computer simulations discrete time steps are easier, of course. By coincidence, there's a stochastic Petri net model of amoebas in [Part 7](http://math.ucr.edu/home/baez/networks/networks_7.html) of the network theory notes... including a Feynman diagram! So it seems here you are dealing with a kind of mathematical model I like, because I have it nicely formalized and I can throw some theorems at it. So, how about something a bit more 'hierarchical'?
• Options
11.

John - I'm not sure exactly what you'd like to see in response to your request for something a bit more 'hierarchical'. Let me try this.

This comment links to two screen prints from an elevator simulation that contains over 1000 hierarchically-organized objects, and that also generates Unified Modeling Language (UML) Sequence Diagrams. The system includes 44 different state machines (UML Harel-like Statecharts) all running concurrently, embedded in doors, hoists, buttons, and other assorted elevator things. The graphics are too big to include on this page, so I'm including links to them.

The first graphic shows part of the tree structure, including portions of several state machines, and some of the nodes in the Java Swing-based GUI. The GUI, showing buttons on 8 floors in a building, two elevator shafts, and two elevator panels, is superimposed on the graphic. Note that the state machines contain internal hierarchy (OR states; only one of Selected or NotSelected can be active at a given time), and are themselves embedded in a larger hierarchy (AND states; all nodes exist at the same time). The GUI itself is a hierarchy of nodes, with a Java JFrame as its root.

The second graphic is a UML Sequence Diagram generated while the simulation runs. I use Quick Sequence Diagram Editor to display it, rather than the functionally similar websequencediagrams.com that I used for the Amoeba model. Some of the same objects from the first graphic appear across the top. Time is from top to bottom. Horizontal lines are messages between objects that contain state machines. Messages include the name of the event, and optional data. The current state is shown as a labeled rectangle.

The elevator simulation uses deterministic logic internally, but the order and timing of button presses (events) is stochastic. I used the MagicDraw UML modeling tool to create the model (except for the Java Swing GUI), and then generated Java code from the model, which I then executed.

One of the nice things about hierarchy is: I could add Amoebas and Amoeba behaviors from the other model to this elevator simulation. For example, I could add an Amoeba as a child of bClose:doorControlButton_567, give it a way to move around, and watch it gradually replicate across the entire elevator system. I could also add some hierarchical cell structure inside each Amoeba, and let that influence their ability to replicate and compete with each other.

Comment Source:John - I'm not sure exactly what you'd like to see in response to your request for something a bit more 'hierarchical'. Let me try this. This comment links to two screen prints from an elevator simulation that contains over 1000 hierarchically-organized objects, and that also generates Unified Modeling Language (UML) Sequence Diagrams. The system includes 44 different state machines (UML Harel-like Statecharts) all running concurrently, embedded in doors, hoists, buttons, and other assorted elevator things. The graphics are too big to include on this page, so I'm including links to them. [The first graphic](http://www.primordion.com/Xholon/wb/images/Elevator_Gui01_July2012.png) shows part of the tree structure, including portions of several state machines, and some of the nodes in the Java Swing-based GUI. The GUI, showing buttons on 8 floors in a building, two elevator shafts, and two elevator panels, is superimposed on the graphic. Note that the state machines contain internal hierarchy (OR states; only one of Selected or NotSelected can be active at a given time), and are themselves embedded in a larger hierarchy (AND states; all nodes exist at the same time). The GUI itself is a hierarchy of nodes, with a Java JFrame as its root. [The second graphic](http://www.primordion.com/Xholon/wb/images/Elevator_SequnceDiagram01_July2012.png) is a UML Sequence Diagram generated while the simulation runs. I use [Quick Sequence Diagram Editor](http://sdedit.sourceforge.net/) to display it, rather than the functionally similar websequencediagrams.com that I used for the Amoeba model. Some of the same objects from the first graphic appear across the top. Time is from top to bottom. Horizontal lines are messages between objects that contain state machines. Messages include the name of the event, and optional data. The current state is shown as a labeled rectangle. The elevator simulation uses deterministic logic internally, but the order and timing of button presses (events) is stochastic. I used the MagicDraw UML modeling tool to create the model (except for the Java Swing GUI), and then generated Java code from the model, which I then executed. One of the nice things about hierarchy is: I could add Amoebas and Amoeba behaviors from the other model to this elevator simulation. For example, I could add an Amoeba as a child of bClose:doorControlButton_567, give it a way to move around, and watch it gradually replicate across the entire elevator system. I could also add some hierarchical cell structure inside each Amoeba, and let that influence their ability to replicate and compete with each other.