Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > To find the area under the curve using C

Reply
Thread Tools

To find the area under the curve using C

 
 
anand
Guest
Posts: n/a
 
      02-26-2006
Dear all,

I am trying to "find the area under the curve f(x)=sin(x)/x for x=1 to
3"

a) Use the trapezoidal rule method. Prove that your trapezoidal rule
method is second order
accurate (using he program)
b) Use the Romberg method. Compare the grid size neccessary to get
convergence to within 1e-8 using TR (part a) versus the Romberg method.

It would be of great help if you guys can programm in C and guide me..

thanks
Anand

 
Reply With Quote
 
 
 
 
Vladimir S. Oka
Guest
Posts: n/a
 
      02-27-2006
anand wrote:

> Dear all,
>
> I am trying to "find the area under the curve f(x)=sin(x)/x for x=1 to
> 3"
>
> a) Use the trapezoidal rule method. Prove that your trapezoidal rule
> method is second order
> accurate (using he program)
> b) Use the Romberg method. Compare the grid size neccessary to get
> convergence to within 1e-8 using TR (part a) versus the Romberg
> method.
>
> It would be of great help if you guys can programm in C and guide me..


We can program in C. We can probably guide you as well.

What we can't and won't do is do your homework for you. Show you've made
an effort (in C) and we can help you with any problems you encounter.

To get you going, go through your numerical analysis textbooks to
identify the methods you mention. Next, revise your C course to date.

Finally, try to actually implement what you learned.

Any C language problems along the way, and good people here will likely
try to help.


--
BR, Vladimir

Nuke the unborn gay female whales for Jesus.

 
Reply With Quote
 
 
 
 
Keith Thompson
Guest
Posts: n/a
 
      02-27-2006
"anand" <(E-Mail Removed)> writes:
> I am trying to "find the area under the curve f(x)=sin(x)/x for x=1 to
> 3"
>
> a) Use the trapezoidal rule method. Prove that your trapezoidal rule
> method is second order
> accurate (using he program)
> b) Use the Romberg method. Compare the grid size neccessary to get
> convergence to within 1e-8 using TR (part a) versus the Romberg method.
>
> It would be of great help if you guys can programm in C and guide me..


I'm sure it would.

Give us your instructor's e-mail address so we can submit our
solutions directly. For an extra fee, we'll mention your name. (Or
perhaps we should charge extra for *not* mentioning your name.)

--
Keith Thompson (The_Other_Keith) http://www.velocityreviews.com/forums/(E-Mail Removed) <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
 
Reply With Quote
 
Robert Gamble
Guest
Posts: n/a
 
      02-27-2006
anand wrote:
> Dear all,
>
> I am trying to "find the area under the curve f(x)=sin(x)/x for x=1 to
> 3"
>
> a) Use the trapezoidal rule method. Prove that your trapezoidal rule
> method is second order
> accurate (using he program)
> b) Use the Romberg method. Compare the grid size neccessary to get
> convergence to within 1e-8 using TR (part a) versus the Romberg method.
>
> It would be of great help if you guys can programm in C and guide me..


As you will likely soon discover, the majority of regulars aren't big
on doing other peoples' homework for them, especially when you haven't
even given it a try yourself.

Give the problem your best shot, if you have a C language question
along the way feel free to come back with what you have so far. If you
have an algorithm question, consult your calculus book or ask elsewhere
as such discussion is off-topic here.

Robert Gamble

 
Reply With Quote
 
osmium
Guest
Posts: n/a
 
      02-27-2006
"anand" writes:

> I am trying to "find the area under the curve f(x)=sin(x)/x for x=1 to
> 3"
>
> a) Use the trapezoidal rule method. Prove that your trapezoidal rule
> method is second order
> accurate (using he program)
> b) Use the Romberg method. Compare the grid size neccessary to get
> convergence to within 1e-8 using TR (part a) versus the Romberg method.
>
> It would be of great help if you guys can programm in C and guide me..


First of all, x is measured in radians, not inches. It looks like you need
at least three functions plus main. One to compute f(x), one to compute an
integral using the trapezoidal rule, and one to do the same thing via the
Romberg method. That will at least get you started. You might end up
adding some more functions later. Compile often. Start with f(x), it is the
easiest to do. For early debugging, you can change main to select one of
the two methods, one at a time.

I think the problem would be clearer if he had said "slice" size instead of
"grid" size. Where I come from, grids tend to be square.

I don't think your program can "prove" anything, it can demonstrate by
example that something or other might be true.


 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      02-27-2006
anand wrote:
>
> I am trying to "find the area under the curve f(x)=sin(x)/x for
> x=1 to 3"
>
> a) Use the trapezoidal rule method. Prove that your trapezoidal
> rule method is second order accurate (using he program)
> b) Use the Romberg method. Compare the grid size neccessary to
> get convergence to within 1e-8 using TR (part a) versus the
> Romberg method.
>
> It would be of great help if you guys can programm in C and
> guide me..


We are happy to do homework, with advance payment of at least 1/2
day at USD 200 per hour. We also require your instructors e-mail
address for delivery of the result. Certified check or paypal will
suffice. The advance amount will be 800 USD.

You will need to also supply the he program with full
documentation. We only have the she program available.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>

 
Reply With Quote
 
Robert Gamble
Guest
Posts: n/a
 
      02-27-2006
osmium wrote:
> "anand" writes:
>
> > I am trying to "find the area under the curve f(x)=sin(x)/x for x=1 to
> > 3"
> >
> > a) Use the trapezoidal rule method. Prove that your trapezoidal rule
> > method is second order
> > accurate (using he program)
> > b) Use the Romberg method. Compare the grid size neccessary to get
> > convergence to within 1e-8 using TR (part a) versus the Romberg method.
> >
> > It would be of great help if you guys can programm in C and guide me..

>
> First of all, x is measured in radians, not inches.


Who said anything about inches?

Robert Gamble

 
Reply With Quote
 
osmium
Guest
Posts: n/a
 
      02-27-2006
"Robert Gamble" writes:

> osmium wrote:
>> "anand" writes:
>>
>> > I am trying to "find the area under the curve f(x)=sin(x)/x for x=1 to
>> > 3"
>> >
>> > a) Use the trapezoidal rule method. Prove that your trapezoidal rule
>> > method is second order
>> > accurate (using he program)
>> > b) Use the Romberg method. Compare the grid size neccessary to get
>> > convergence to within 1e-8 using TR (part a) versus the Romberg method.
>> >
>> > It would be of great help if you guys can programm in C and guide me..

>>
>> First of all, x is measured in radians, not inches.

>
> Who said anything about inches?


I saw the " and took it to be inches, rather than seconds.


 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      02-27-2006
"osmium" <(E-Mail Removed)> writes:
> "anand" writes:
>
>> I am trying to "find the area under the curve f(x)=sin(x)/x for x=1 to
>> 3"

[snip]
> First of all, x is measured in radians, not inches. It looks like you need
> at least three functions plus main.


The '"' character was a closing quotation mark, matching the opening
quotation mark in front of the word "find".

--
Keith Thompson (The_Other_Keith) (E-Mail Removed) <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
 
Reply With Quote
 
Robert Gamble
Guest
Posts: n/a
 
      02-27-2006
osmium wrote:
> "Robert Gamble" writes:
>
> > osmium wrote:
> >> "anand" writes:
> >>
> >> > I am trying to "find the area under the curve f(x)=sin(x)/x for x=1 to
> >> > 3"
> >> >
> >> > a) Use the trapezoidal rule method. Prove that your trapezoidal rule
> >> > method is second order
> >> > accurate (using he program)
> >> > b) Use the Romberg method. Compare the grid size neccessary to get
> >> > convergence to within 1e-8 using TR (part a) versus the Romberg method.
> >> >
> >> > It would be of great help if you guys can programm in C and guide me..
> >>
> >> First of all, x is measured in radians, not inches.

> >
> > Who said anything about inches?

>
> I saw the " and took it to be inches, rather than seconds.


He quoted the problem text, that double quote you confused for inches,
then seconds, is simply the closing quote of that text, I guess you
missed the opening quote. Twice

Robert Gamble

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MVC2: linking from one area view to another area view Andy B. ASP .Net 0 04-30-2010 07:46 AM
curve and curve with error objects : sorting , friend Hicham Mouline C++ 2 09-14-2009 02:11 PM
where can I find the transmission curve for my camcorder's IRblocker? hillpc Digital Photography 2 02-17-2009 10:22 PM
do structure definitions go in data area or in code area... hotadvice C Programming 14 10-02-2007 04:10 AM
Add point to graphics area without having to paint the whole area? Mark Java 1 06-27-2005 03:09 AM



Advertisments