Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Trapezoidal method

Trapezoidal method

Trapezoidal method

I am working on a program to find the value of the current in a coil. This value satisfies the following equation:

which is of the form y'=f(t,y)

I know that in order to solve this I need to use the trapezoidal method to solve a differential equation, the formula is:
yn+1=yn+.5*h(f(tn,yn)+f(tn+1,yn+1) where h=tn+1-tn

I have found examples of the standard trapezoidal method but I do not think they will help because of the difference in the formulas. Can anybody give me some guidance here?

RE: Trapezoidal method

Do you need guidance in the math or the programming?

RE: Trapezoidal method

the programming, I know how the math behaves but I am unfamiliar as far as how to write this in C++ code.

RE: Trapezoidal method

I am totally ignorant as to what is required. Do you need a load of y values given a set of t values or the y and t value when they satisfy some condition like y' is zero. I also don't really know how you would solve something like


because yn+1 appears on both sides. Assuming h is really small, why not use the Euler form of

y(n+1) = yn + h * f(tn, yn)

In that case, the same question arises: do you want all the values given a starting t0 and y0 up to a particular value of tn or do you just want it satisfying some criteria.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close