Using R to solve the equations

How can I solve for the roots of an equation of the following form numerically in R:

f(r)=r*c+1-B*c-exp(-M(Br)) 

Where M, B, and c are known constants.

Thanks in advance.

+4
source share
1 answer

Since R cannot perform this function, you can use a supernet package such as Sage. Sage includes R and many other packages and can do what you want using the web browser interface. Website http://www.sagemath.org/

Examples are located at: http://www.sagemath.org/doc/reference/sage/symbolic/relation.html

You can try the following: http://www.sagenb.org/

 var('r', 'c', 'B', 'M') f = r*c+1-B*c-exp(-M(Br)) print solve(f, r) 

The results of this:

r == (B * c + e ^ (- B + r) - 1) / c

+3
source

All Articles