How can I plot b[a]/b[0.0001] vs. a using Mathematica?

In summary, the paper states that they numerically integrated an equation. They give a boundary condition and the equation to be integrated. They show two graphs of the result. The first graph is on a log scale and the second is on a linear scale. There is still an error in the program for values of c (alpha).
  • #1
kptsilva
33
0
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?
 
Physics news on Phys.org
  • #2
2/3 a^2 b''[a] + (1 - w[a]) a b'[a] - (1 + w[a]) (1 - 3 c w[a]) b[a] == ?
 
  • #3
?==0
 
  • #4
See the attached notebook. The second plot on a log scale is probably more instructive.
 

Attachments

  • DiffEq.nb
    37.6 KB · Views: 414
  • #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?
 
  • #6
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
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.
 

Attachments

  • DiffEq.nb
    19.9 KB · Views: 354
  • #9
phyzguy thanks 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}]
 
  • #10
There are still some problems, i think there is abit of an error for some values of c(=alpha)
 
  • #11
for c=1 the graph is perfect
 
  • #12
Any news to my problem?
 

Related to How can I plot b[a]/b[0.0001] vs. a using Mathematica?

1. How do I create a plot in Mathematica?

To create a plot in Mathematica, use the Plot function and specify the function or data points you want to plot. For example, Plot[Sin[x], {x, 0, 2Pi}] will create a plot of the sine function from x = 0 to x = 2π.

2. Can I customize the appearance of my plot in Mathematica?

Yes, you can customize the appearance of your plot by using various options in the Plot function, such as changing the color, style, and thickness of the line, adding labels and legends, and adjusting the axes and plot range.

3. How do I add multiple plots to the same graph in Mathematica?

To add multiple plots to the same graph in Mathematica, use the Show function and specify the plots you want to combine. For example, Show[Plot[Sin[x], {x, 0, 2Pi}], Plot[Cos[x], {x, 0, 2Pi}]] will combine the plots of the sine and cosine functions into one graph.

4. How can I export my plot from Mathematica?

You can export your plot from Mathematica by using the Export function. Specify the file format you want to export to, such as PNG, PDF, or JPEG, and the file name. For example, Export["myplot.png", Plot[Sin[x], {x, 0, 2Pi}]] will export the plot as a PNG file named "myplot" in your current directory.

5. Is it possible to add interactive elements to my plot in Mathematica?

Yes, you can add interactive elements to your plot in Mathematica by using the Manipulate function. This allows you to manipulate the parameters of your plot and see the changes in real-time. You can also use the Dynamic function to add dynamic elements, such as sliders and buttons, to your plot.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
385
  • Advanced Physics Homework Help
Replies
3
Views
1K
  • Advanced Physics Homework Help
Replies
2
Views
1K
  • Advanced Physics Homework Help
Replies
7
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • Programming and Computer Science
Replies
1
Views
1K
  • Advanced Physics Homework Help
Replies
4
Views
2K
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
4K
  • Advanced Physics Homework Help
Replies
6
Views
2K
Back
Top