Runge-Kutta Numerical Integration

In summary, the conversation discusses a stellar model and the equations used to solve it. The equations are transformed into logarithmic variables and the Runge-Kutta method is used for numerical integration. The logarithm is used to simplify the equations, but the same methods can be used to solve for the variables.
  • #1
iamalexalright
164
0

Homework Statement


In brief, I am working on a stellar model.

We started with these four equations:
[tex]\delta q/\delta x = px^{2}/t[/tex]
[tex]\delta p /\delta x = -pq/tx^{2}[/tex]
[tex]\delta t /\deltax = -Cp^{1.75} / x^{2}t^{8325}[/tex]
[tex]\delta t /\delta x = -2q/5x^{2}[/tex]

In the model you switch to the 4th equation instead of the 3rd when the ratio of the 3rd to the 4th is less than 1.

Because the variables p and t vary over orders of magnitude we switch to logarithmetic variables.

[tex]g_{1}=log(p)[/tex]
[tex]g_{2}=log(q)[/tex]
[tex]g_{3}=log(t)[/tex]
[tex]y=log(x)[/tex]

The 4 equations transform to:
[tex]log[-\delta g_{1}/\delta y] = g_{2} - g_{3} - y[/tex]
[tex]log[\delta g_{2}/\delta y] = g_{1} + 3y - g_{2} - g_{3}[/tex]
[tex]log[-\delta g_{3}/\delta y] = log(C) + 1.75g_{1} - y - 9.25g_{3}[/tex]
[tex]log[-\delta g_{3}/\delta y] = log(2/5) + g_{2} - g_{3} - y[/tex]

log(C) = -5.51674

The initial conditions are:
x = 1, q = 1, t = 0, p = 0

Since we encounter problems we use:

[tex]p^{1.75} = 1.75t^{8.25}/8.25C[/tex]
[tex]t = 1.75/8.25(1/x - 1)[/tex]

to find these initial values.

We then work on way inward (from x = 1 to x = 0)

2. The attempt at a solution
I worked out
g1 = -8.37512874
g2 = 1
g3 = -2.36361205
y = -0.00877392431

to be initial values.

Now I am having troubles doing the actual numerical integration...for instance if I try to find g1 at a point x-h(where h I have .02) i do this:

[tex]g_{1 at x-h} = g_{1 at x} + (1/6)(k_{1} + 2k_{2} + 2k_{3} + k_{4})}[/tex]

Now [tex]k_{1}[/tex] is simply the derivative of [tex]g_{1}[/tex] at x.
For [tex]k_{2}[/tex] I use [tex]x + .5hk_{1}[/tex] instead of x in the derivative equation(and the same method for k3 and k4).

Is this correct? Also I don't know what to do about that log outside(meaning, do I raise 10 by the right-hand side to get the actual derivative and not the log of it?).

Thanks in advance
 
Physics news on Phys.org
  • #2



Hello, thank you for sharing your work on your stellar model. It seems like you have a good understanding of the equations and have made some progress in finding initial values.

In terms of your numerical integration, it is important to first understand the equations you are working with. In this case, you have a system of differential equations, which means you need to use numerical methods specifically designed for that type of problem.

One commonly used method is the Runge-Kutta method, which uses a series of approximations to calculate the next value in the solution. The equation you have written for g_{1 at x-h} is a variation of the fourth-order Runge-Kutta method, which is a good choice for this problem.

However, it is important to note that the derivatives you are using for k_{2}, k_{3}, and k_{4} should be evaluated at different points, not just x + 0.5hk_{1}. This is because the Runge-Kutta method uses a weighted average of these derivatives to calculate the next value, so they need to be evaluated at different points in order to capture the behavior of the function accurately.

As for the logarithm, you do not need to raise 10 to the right-hand side to get the actual derivative. The logarithm is used to transform the equations into a form that is easier to work with, but you can still use the same numerical methods to solve for the values of g_{1}, g_{2}, g_{3}, and y.

I hope this helps and good luck with your stellar model!
 

Related to Runge-Kutta Numerical Integration

1. What is Runge-Kutta numerical integration?

Runge-Kutta numerical integration is a method used to solve ordinary differential equations (ODEs) numerically. It is a type of numerical integration that approximates the solution of an ODE by using a series of calculations to predict the value of the function at discrete points in time.

2. How does Runge-Kutta numerical integration work?

Runge-Kutta numerical integration works by using a set of equations to estimate the slope of the ODE at different points in time. These slopes are then used to predict the value of the function at the next time step. The process is repeated iteratively until the desired accuracy is achieved.

3. What are the advantages of using Runge-Kutta numerical integration?

One advantage of Runge-Kutta numerical integration is that it is a more accurate method of solving ODEs compared to simpler numerical methods. It is also more efficient and can handle a wider range of ODEs, including stiff equations.

4. Are there any limitations to using Runge-Kutta numerical integration?

One limitation of Runge-Kutta numerical integration is that it requires more computational resources compared to simpler methods. It also may not be suitable for solving ODEs with discontinuities or highly oscillatory solutions.

5. How is the accuracy of Runge-Kutta numerical integration measured?

The accuracy of Runge-Kutta numerical integration is measured by comparing the results to the exact solution of the ODE. The difference between the two is known as the error, and it can be reduced by using smaller time steps or higher-order methods.

Similar threads

  • Calculus and Beyond Homework Help
Replies
1
Views
413
  • Calculus and Beyond Homework Help
Replies
5
Views
378
  • Calculus and Beyond Homework Help
Replies
7
Views
647
  • Calculus and Beyond Homework Help
Replies
12
Views
1K
  • Calculus and Beyond Homework Help
Replies
5
Views
850
  • Calculus and Beyond Homework Help
Replies
2
Views
359
Replies
2
Views
4K
  • Special and General Relativity
Replies
24
Views
469
  • Special and General Relativity
Replies
4
Views
154
  • Calculus and Beyond Homework Help
Replies
8
Views
1K
Back
Top