INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

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!

*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.

Jobs

Trapezoidal method

Trapezoidal method

(OP)
Hello,
I am working on a program to find the value of the current in a coil. This value satisfies the following equation:
y'=sin(2t)-[(ey-1)/(ey+1)]

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

yn+1=yn+.5*h(f(tn,yn)+f(tn+1,yn+1)

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!

Resources

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