# Replacing functions in a equation

I want to be able to replace a function within a equation. I find a solution for the function R in the given example, and I want to replace R in the equation, hence R=Rsol, where Rsol is a specific function. But it does not seem to replace the function in de2 at all, what am I doing wrong?

```
var('Rq,k,K')
M=function('M')(x)
R=function('R')(x)
de2=diff(R)==-K(R-Rq)
de1 = diff(M) == -k(M - R)
Rsol=desolve(de2(k=1,K=2,Rq=20),R,ics=[0,15])
Msol=desolve(de1(k=1,K=2,Rq=20, R=Rsol),M)
```