Skip to content

Q&A Monday Afternoon

Daniel R. Grayson edited this page Jun 4, 2018 · 7 revisions

This space is to post questions about M2 programming that have come up during the project sessions.

Q1. What is the best way to use a temporary ring inside a function and then return back to the ring you were using before you called the function? (by Orlando)

Q2. The ReactionNetworks Package uses indexed variables. How do they work? Consider the following code:

needsPackage("ReactionNetworks")
N=oneSiteModificationA()
R=createRing N
k=N.ReactionRates

At this point, k_0 should be recognized as a variable in the ring R. It has the same name after all. How do I get the variable in R? How do I get the index {0,1} of the variable k_{0,1}?

Q3. Can one work with generating function in M2? For example the moment generating function of the Gaussian distribution is M(t) = exp(mt + (1/2)st^2) and to compute the truncation up to order three we can do

R=QQ[m,s][t]/(t^4)
exp(m*t + (1/2)*s*t^2)

Is there a more systematic way that can deal with more general generating functions?

answers

See Q and A Monday log.

Clone this wiki locally