1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica plot question

  1. Jun 12, 2012 #1
    hey guys,
    I came across a research paper stating to numerically integrate the following equation.

    2/3 a^2 b''[a] + (1 - w[a]) a b'[a] - (1 + w[a]) (1 - 3 c w[a]) b[a]

    A Boundary condition is given b'[0.0001]=0
    Where;

    w[a_] := 2*a^(3*(1 + c))/(1 + 2*a^(3*(1 + c)));

    (c=1) (c is a variable but let's consider a particular instance c=1)

    'a' goes from 10^-4 to 1000 in a log scale.

    I want to plot b[a]/b[0.0001] vs. a

    how can i plot this using mathematica?
     
  2. jcsd
  3. Jun 16, 2012 #2
    2/3 a^2 b''[a] + (1 - w[a]) a b'[a] - (1 + w[a]) (1 - 3 c w[a]) b[a] == ?
     
  4. Jun 17, 2012 #3
    ?==0
     
  5. Jun 17, 2012 #4

    phyzguy

    User Avatar
    Science Advisor

    See the attached notebook. The second plot on a log scale is probably more instructive.
     

    Attached Files:

  6. Jun 17, 2012 #5
    the paper says that they have numerically integrated that equation.I can't understand that statement. The program should be written with NIntegrate rather than NDSolve right?
     
  7. Jun 17, 2012 #6

    phyzguy

    User Avatar
    Science Advisor

    Since it's a second order equation, you would need to integrate it twice. Integrating along step-by-step is really what NDSolve is doing. I don't see a simple way to write a solution using the NIntegarate command. Does it matter?
     
  8. Jun 17, 2012 #7
  9. Jun 17, 2012 #8

    phyzguy

    User Avatar
    Science Advisor

    Figures 2 and 3 are the same graph, just plotted on different scales. They've numerically solved the differential equation just like I did. Also, in your original post, you forgot the minus sign in w[a]. This makes a big difference! Now it looks like the paper. See attached.
     

    Attached Files:

  10. Jun 17, 2012 #9
    phyzguy thanx alot, in my program i have forgotten the negative sign it gives me the graphs perfectly.
    thhis is the code i wrote,
    c = 1;
    w[a_] := (2*a^(3*(1 + c)))/(1 + (2*a^(3*(1 + c))));
    fun = (2/3)*(a^2)*b''[a] + (1 - w[a])*a*
    b'[a] - (1 + w[a])*(1 - 3*c*w[a])*b[a]; sol =
    DSolve [{fun == 0, b'[10^-4] == 0}, b, a];
    A = LogLinearPlot[Evaluate[b[a]/b[10^-4] /. sol], {a, 10^-4, 10^3},
    PlotRange -> {-500, 12000}]
     
  11. Jun 17, 2012 #10
    There are still some problems, i think there is abit of an error for some values of c(=alpha)
     
  12. Jun 17, 2012 #11
    for c=1 the graph is perfect
     
  13. Jun 22, 2012 #12
    Any news to my problem???
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook