Mathematica plot question, dsolve

  • Thread starter Thread starter kptsilva
  • Start date Start date
  • Tags Tags
    Mathematica Plot
Click For Summary
SUMMARY

The discussion focuses on solving a second-order differential equation using Mathematica, specifically the equation 2/3 a^2 b''[a] + (1 - w[a]) a b'[a] - (1 + w[a]) (1 - 3 c w[a]) b[a] with boundary condition b'[0.0001]=0. The user encounters issues with plotting the solution due to imaginary components and the need for proper boundary conditions. Key solutions include changing 'b' to 'b[a]' in the DSolve command and addressing the plotting method to ensure accurate representation of the results.

PREREQUISITES
  • Familiarity with Mathematica syntax and functions
  • Understanding of differential equations and boundary conditions
  • Knowledge of plotting techniques in Mathematica, specifically LogLinearPlot
  • Basic grasp of complex numbers and their implications in mathematical solutions
NEXT STEPS
  • Explore the use of DSolve in Mathematica for solving differential equations
  • Learn about boundary value problems and their significance in differential equations
  • Investigate the handling of complex solutions in Mathematica plots
  • Study advanced plotting techniques in Mathematica, including LogLinearPlot adjustments
USEFUL FOR

Mathematica users, mathematicians, and researchers dealing with differential equations and their graphical representations.

kptsilva
Messages
33
Reaction score
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
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
 
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
 

Similar threads

  • · Replies 21 ·
Replies
21
Views
2K
Replies
11
Views
3K
  • · Replies 18 ·
Replies
18
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
3
Views
2K
Replies
8
Views
2K
  • · Replies 15 ·
Replies
15
Views
2K
Replies
12
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 4 ·
Replies
4
Views
2K