How can I solve equations for a variable

e.g.

100+315/(1+r)=3.5/(1+r)+442/(1+r)^2

How can I solve this equation for r

Is there a specific function in R for this?

How can I solve equations for a variable

e.g.

100+315/(1+r)=3.5/(1+r)+442/(1+r)^2

How can I solve this equation for r

Is there a specific function in R for this?

Problems benefit from a preliminary assessment before landing on a function

```
suppressPackageStartupMessages({
library(ggplot2)
})
find_result <- function(r, w, x, y, z) {
lhe <- w+x/(1+r)
pt1 <- y/(1+r)
pt2 <- z/(1+r)^2
rhe <- pt1 + pt2
equation <- lhe + rhe
}
x <- data.frame(test = c(1e6,1e7,1e8,1e9,1e10))
ggplot(x,(aes(test,find_result(test,100,315,3.5,442)))) +
geom_line() +
theme_minimal()
```

^{Created on 2021-01-01 by the reprex package (v0.3.0.9001)}

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.