Mathematica plot question, dsolve

In summary, the conversation is about using Mathematica to plot a graph of b[a]/b[0.0001] vs. a. The equation and boundary conditions are provided, and a code is written but with errors. The solution involves changing b to b[a] and editing the log-lin plot command. The issue of imaginary parts and the use of only one boundary condition is also mentioned.
  • #1
kptsilva
33
0
Hey guys,

I'm using Mathematica to plot some graphs and I'm having a bit of a hard time.

First I have to solve 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]

Boundary condition 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

I've so far written a simple code but it is with errors.

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]
F[a_] = DSolve[{fun == 0, b'[10^(-4)] == 0}, b, a]
L = LogLinearPlot[Evaluate[F[a]/F[0.0001]], {a, 10^-4, 10},
PlotRange -> All];

Please can anyone help me
 
Physics news on Phys.org
  • #2
Two things: In your DSolve[] command, change b to b[a]. Second, if it's not plotting properly, it's for two reasons. You're using a lin-log plot to plot the answer, and the answer has imaginary components. Also, you have a second order equation with only one boundary condition. I assume that the other involves the function decaying at infinity, which Mathematica doesn't really like
 
  • #3
I've changed b to b[a] and it works fine editing the log-lin plot command. I don't need two boundary conditions since I'm plotting b[a]/b[0.0001] so the constant cancels off. It's true, i have imaginary parts in my solution, i wonder if mathematica takes them into account for the plot
 

1. How can I plot a function in Mathematica?

To plot a function in Mathematica, use the Plot function. For example, to plot the function f(x) = x^2, you would enter Plot[x^2, {x, -5, 5}]. This will create a plot of the function from x = -5 to x = 5.

2. Can I plot multiple functions on the same graph in Mathematica?

Yes, you can plot multiple functions on the same graph by using the Plot function with a list of functions. For example, to plot f(x) = x^2 and g(x) = 2x, you would enter Plot[{x^2, 2x}, {x, -5, 5}]. This will create a graph with both functions plotted.

3. How can I customize the appearance of my Mathematica plot?

You can use various options with the Plot function to customize the appearance of your plot. For example, you can change the color, style, and thickness of the plot lines, add labels and titles, and change the axes limits. For more information, you can refer to the Mathematica documentation on the Plot function.

4. What is dsolve in Mathematica?

dsolve is a built-in function in Mathematica that is used to solve differential equations. It takes in a differential equation and returns a symbolic solution in terms of the variables in the equation. For example, dsolve[y''[x] + y[x] == 0, y[x], x] will return the solution y[x] = c1 Cos[x] + c2 Sin[x].

5. Can I use dsolve to solve any type of differential equation?

No, dsolve can only solve certain types of differential equations. It can solve ordinary differential equations (ODEs) with constant coefficients, initial value problems, and some partial differential equations (PDEs). However, there are many types of differential equations that dsolve cannot solve, such as non-linear equations or equations with variable coefficients. It is always best to check the Mathematica documentation to see if your equation is solvable with dsolve.

Similar threads

  • Calculus and Beyond Homework Help
Replies
21
Views
834
  • Calculus and Beyond Homework Help
Replies
18
Views
1K
Replies
11
Views
1K
  • Calculus and Beyond Homework Help
Replies
8
Views
615
  • Calculus and Beyond Homework Help
Replies
2
Views
376
  • Calculus and Beyond Homework Help
Replies
3
Views
566
  • Calculus and Beyond Homework Help
Replies
3
Views
947
  • Calculus and Beyond Homework Help
Replies
12
Views
981
  • Calculus and Beyond Homework Help
Replies
1
Views
454
  • Calculus and Beyond Homework Help
Replies
1
Views
636
Back
Top