Solving differential equation with a constant

Click For Summary

Discussion Overview

The discussion revolves around solving a specific second-order differential equation using Mathematica, particularly focusing on the equation y''[t] + k^2y[t] + (1/t^2)y[t] = 0, where k is a constant within the range 1 < k < 20. Participants explore methods for solving this equation and plotting the solution in relation to the constant k.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Homework-related

Main Points Raised

  • One participant presents the differential equation and seeks guidance on solving and plotting it in Mathematica.
  • Another participant suggests using DSolve to find the solution in terms of Bessel functions and emphasizes the need for initial conditions to plot the solution.
  • A follow-up comment notes that choosing initial conditions y(0) = 0 and y'(0) = 0 leads to a trivial solution y(t) = 0, recommending different initial conditions instead.
  • A later participant mentions a similar equation that cannot be solved with DSolve and requests guidance on using NDSolve for plotting the solution in terms of the constant k.

Areas of Agreement / Disagreement

Participants generally agree on the use of DSolve for the given equation but express differing views on the choice of initial conditions. The discussion regarding the use of NDSolve introduces a new perspective, indicating that multiple approaches may be necessary for different equations.

Contextual Notes

There are limitations regarding the choice of initial conditions, as certain conditions lead to trivial solutions. The discussion does not resolve the specifics of how to plot solutions obtained from NDSolve.

zarei
Messages
8
Reaction score
0
Hi,
I am working with mathematica. I have a simple differential equation as follows:
y''[t]+k^2y[t]+(1/t^2)y[t]=0
where k is a constant between 1<k<20.
How can solve this equation and then plot y in terms of k?
thanks
 
Physics news on Phys.org
You can solve it using

Code:
DSolve[y''[t] + k^2 y[t] + (1/t^2) y[t] == 0, y[t], t]

which gives the answer in terms of Bessel functions. To plot it though, you will need to choose some initial conditions, which you would insert like

Code:
DSolve[{y''[t] + k^2 y[t] + (1/t^2) y[t] == 0,y[0]==0,y'[0]==0}, y[t], t]

and to plot with k on the horizontal axis you will need to choose t (or just make a three-dimensional plot). The plot may be done like


Code:
sol=DSolve[{y''[t] + k^2 y[t] + (1/t^2) y[t] == 0,y[0]==0,y'[0]==0}, y[t], t]
Plot[y[t]/.sol/.t->t0 , {k,1,20}]

where t0 is the t you are choosing.
 
16180339887 said:
Code:
sol=DSolve[{y''[t] + k^2 y[t] + (1/t^2) y[t] == 0,y[0]==0,y'[0]==0}, y[t], t]
Plot[y[t]/.sol/.t->t0 , {k,1,20}]

Just a note: if you choose y(0), y'(0) = 0, the unique solution for this initial condition is y(t) = 0, so I suggest choosing something different for the initial conditions!
 
Thanks for reply,
I have a similar equation where cannot be solved with DSolve. It can be solved just by NDSolve. Could you please guide me how the final solution can be plotted in terms of constant k when we use the NDSolve?
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 6 ·
Replies
6
Views
2K