[R] Solving equations
Spencer Graves
spencer.graves at pdf.com
Wed Mar 26 16:24:25 CET 2003
What do you mean "solve"? Do you want to solve for "t" in f(t) =
A*exp(B*t), where A and B are given square matrices? Is "t" a scalar or
also a square matrix or something else, and does "*" refer to
element-wise multiplication (as in R) or matrix multiplication (written
"%*%" in R)?
Suppose we want to solve
F = A %*% exp(B%*%t)
where A, B, and F are given square matrices. I might approach it as
follows:
Ainv.F <- solve(A, F) # compute inverse(A)%*%F
AiF.eig <- eigen(Ainv.F)
# Then check to make sure there are no repeated eigenvalues,
# or if there are that a Jordon canonical form is still diagonal.
# This will give Ainv.F in a form
# Evec %*% diag(Lam) %*% inverse(Evec)
# The natural log of this is just
# Evec %*% diag(log(Lam)) %*% inverse(Evec)
From this point, you can solve for "t"
Does this help?
Sorry this is a bit cryptic, but I don't have time to write and debug
code for this myself right now.
Hope this helps,
Spencer Graves
schlegel at cs.uni-duesseldorf.de wrote:
> Hello,
>
> Does somebody knows if there exists a function which solves a set of
> equation, say f(vars),
> for the variables vars (similar to Solve in mathematica).
> The functions I am considering are of the form f(t) ~ A*exp(B*t), where
> A and B are matrices.
>
> Thanks Thomas
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
More information about the R-help
mailing list