# Manipulating and using result of DSolve

I have an unsightly looking equation that nonetheless has an analytical solution. The solution is ugly as hell, but exists; I use the following code with the DSolve function to generate it;

a = 5*10^-7;
po = 100;
omega = 3.0318*10^7;
ro = 5*10^-6;
Do2 = 2*10^-9;
ko = 1;

A = (a*omega)/(2*Do2);

k = ((rc - r)^2)*(ko/po);

sol = DSolve[{y'[
r] == (A)*(r  - (rc^2)/
r - (k/r)*(Log[((rc - r)^2 + k)/k]) + ((2*rc*Sqrt[k])/
r)*(ArcTan[(r - rc)/Sqrt[k]])), y[rc] == 0}, y[r], r]


This gives me a solution in terms of the variable $r$ and an as yet unknown constant $r_{c}$ - However, I know that $y(r_{o}) = p_{o} = 100$. I would like to take the result from DSolve, set it equal to $p_{o}$ for $r = r_{o}$ and then use this information (perhaps with FindRoot) to estimate $r_{c}$, and then graph the function between $r_{o}$ and $r_{c}$ but I keep running into difficulty doing this. Anyone have any idea how I'd set about doing this? I'd be grateful for any help with the syntax!

-

## 1 Answer

fr = FindRoot[(y[r] /. sol /. r -> ro) == po, {rc, 1}]
Plot[y[r] /. sol /. fr, {r, ro, rc /. fr[[1]]}]


-
Absolutely brilliant - thank you! –  DRG Oct 23 '13 at 15:41