Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

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

Mathematica graphics

share|improve this answer
Absolutely brilliant - thank you! – DRG Oct 23 '13 at 15:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.