Help, help!
I am trying to work with an ODE in 3 space, so I want my dependent
variable to be a column 3-vector x, a function of t. I'm not trying
to solve the ODE, but I am building xprime, which is a moderately
complicated expression.
First question: should I declare x somehow to be a vector, or does
the next line do so by using x[1], x[2], x[3]?
P1:matrix([(-sigma) * x[1]+sigma * x[2]],[rho * x[1]-x[2]],[(-beta) *
x[3]]);
P2:matrix([0],[(-x[1]) * x[3]],[x[1] * x[2]]);
SQ: matrix([x[1]],[x[2]],[x[3]]) . matrix([sigma * x[1]],[x[2]],[beta
* x[3]]) - (rho+sigma) * x[1] * x[2];
RR:matrix([x[1]],[x[2]],[x[3]]) . matrix([x[1]],[x[2]],[x[3]]);
xprime:(1+RR) * (1-RR) . P1 + (1+RR) . P2 + 2 * (1-RR) * SQ . matrix
([x[1]],[x[2]],[x[3]]);
mm: xprime . xprime;
Next question: the last output comes back expt(the expression for
xprime,2), which is obviously correct, but how do I get the actual
dot product to be computed? mm is a scalar, but I can't get it
simplified. If I say expand(mm); it just expands the RRs that appear.
Thank you in advance!
Dan Solomon