- #1
Hypatio
- 151
- 1
I have the differential equation
[itex]\frac{dM}{dt}=4\pi \rho(r,t)r(t)^2\frac{dr}{dt}
[/itex]
which is the first term from
[itex]M(t)=4\pi\int_0^{r(t)}C(r,t)r(t)^2dr[/itex]
This describes the change in mass (M) of a sphere from a change in radius (r) given a density (rho) that depends on radius and time (t).
My problem is somewhat simple. I tried to convert this equation into a finite difference formula as follows:
[itex]M_1-M_0=4\pi \rho(r,t)r^2(r_1-r_0)[/itex]
where subscript 1 indicates the value at a new timestep.
I must be doing something wrong because the volume of a sphere requires a 1/3 to come from somewhere on the right hand side..
[itex]\frac{dM}{dt}=4\pi \rho(r,t)r(t)^2\frac{dr}{dt}
[/itex]
which is the first term from
[itex]M(t)=4\pi\int_0^{r(t)}C(r,t)r(t)^2dr[/itex]
This describes the change in mass (M) of a sphere from a change in radius (r) given a density (rho) that depends on radius and time (t).
My problem is somewhat simple. I tried to convert this equation into a finite difference formula as follows:
[itex]M_1-M_0=4\pi \rho(r,t)r^2(r_1-r_0)[/itex]
where subscript 1 indicates the value at a new timestep.
I must be doing something wrong because the volume of a sphere requires a 1/3 to come from somewhere on the right hand side..