I am going to program Eulers method in Octave to approximate gravity in 1-dimension. I understand the formula for Eulers method, which is equal to: y_(i+1)=y_i+(triangle t*f(t_i.y_i)) What I don't understand is what my function f(t,y) is in this case. What do I have to insert into the formula to get my next y-point?

Justine Pennington

Justine Pennington

Answered question

2022-11-22

I am going to program Eulers method in Octave to approximate gravity in 1-dimension. I understand the formula for Eulers method, which is equal to:
y i + 1 = y i + ( t f ( t i , y i ) )
What I don't understand is what my function f(t,y) is in this case. What do I have to insert into the formula to get my next y-point?

Answer & Explanation

Kaiya Bird

Kaiya Bird

Beginner2022-11-23Added 7 answers

Depending on the scale, you have
x ¨ = a ( t , x ) = g
or
x ¨ = a ( t , x ) = G M ( R + x ) 2
where G is the gravitational constant, M the mass of Earth and R its radius.

As this is second order, a first order system would have the form
( x ˙ v ˙ ) = f ( t , ( x , v ) ) = ( v a ( t , x ) ) .

Do you have a similar question?

Recalculate according to your conditions!

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?