473,395 Members | 1,411 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Cubic Function

PART 1:
Your task in Part 1 is to write a program that takes in:
1. the 4 coefficients of a third degree polynomial ial (ax3 + bx2 + cx + d ),
2. the range of the integral (starting and ending x values),
3. number of bins to be used
and calculates the Riemann sum approximation to the integral.


PART 2:
The Riemann sum only gives an approximation to the integral. We could in fact calculate
the actual value using the definition of the integral. For polynomials, the actual value of
the integral is found by:
1. For each term raise the power by one, and divide the term with the raised power
2. Plug in (1) the value of the bounding x value on the right
3. Plug in (1) the value of the bounding x value on the left
4. Find the difference between (2) and (3)


please help me I couldn't write the program
Apr 1 '07 #1
4 3078
svlsr2000
181 Expert 100+
PART 1:
Your task in Part 1 is to write a program that takes in:
1. the 4 coefficients of a third degree polynomial ial (ax3 + bx2 + cx + d ),
2. the range of the integral (starting and ending x values),
3. number of bins to be used
and calculates the Riemann sum approximation to the integral.


PART 2:
The Riemann sum only gives an approximation to the integral. We could in fact calculate
the actual value using the definition of the integral. For polynomials, the actual value of
the integral is found by:
1. For each term raise the power by one, and divide the term with the raised power
2. Plug in (1) the value of the bounding x value on the right
3. Plug in (1) the value of the bounding x value on the left
4. Find the difference between (2) and (3)


please help me I couldn't write the program
Can you post part of code where you are struck.
Apr 2 '07 #2
r035198x
13,262 8TB
PART 1:
Your task in Part 1 is to write a program that takes in:
1. the 4 coefficients of a third degree polynomial ial (ax3 + bx2 + cx + d ),
2. the range of the integral (starting and ending x values),
3. number of bins to be used
and calculates the Riemann sum approximation to the integral.


PART 2:
The Riemann sum only gives an approximation to the integral. We could in fact calculate
the actual value using the definition of the integral. For polynomials, the actual value of
the integral is found by:
1. For each term raise the power by one, and divide the term with the raised power
2. Plug in (1) the value of the bounding x value on the right
3. Plug in (1) the value of the bounding x value on the left
4. Find the difference between (2) and (3)


please help me I couldn't write the program
Please read the guidelines.
Apr 2 '07 #3
Ganon11
3,652 Expert 2GB
The thread title has been changed.
Apr 2 '07 #4
JosAH
11,448 Expert 8TB
please help me I couldn't write the program
Well, your keyboard and internet connection seem fine. What's the trouble then?
For those Riemann sums you just add the (signed) areas of little blocks; each
block has a width (lo-hi)/b where lo and high are the lower and upperbounds of
your x interval and b equals the number of bins.

The height differs per block; for an x in [lo hi] the height of the block is f(x)
where f() is your cubic function.

Basically it's just a for loop and a bit of bookkeeping.

Analytical integration is even easier; check your text book for that.

kind regards,

Jos
Apr 2 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Philip KOCH | last post by:
I'm trying to calculate the cubic root of a fonction, what syntax should I use? Thanx PHIL
3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
8
by: JKop | last post by:
Could someone please point me to somewhere where I can get a full complete reference of the C++ Standard Libaries, how to use all their functions and global varibles. Is there any function in...
5
by: phil_gg04 | last post by:
Dear Javascript Experts, Opera seems to have different ideas about the visibility of Javascript functions than other browsers. For example, if I have this code: if (1==2) { function...
2
by: laredotornado | last post by:
Hello, I am looking for a cross-browser way (Firefox 1+, IE 5.5+) to have my Javascript function execute from the BODY's "onload" method, but if there is already an onload method defined, I would...
2
by: sushil | last post by:
+1 #include<stdio.h> +2 #include <stdlib.h> +3 typedef struct +4 { +5 unsigned int PID; +6 unsigned int CID; +7 } T_ID; +8 +9 typedef unsigned int (*T_HANDLER)(void); +10
1
by: jitasi | last post by:
Hi all I want to use the matlab function "pchip" in python. I have checked the scipy, but there is only spline Interpolating. Are there any pchip Interpolating in python? Thanks Steven
4
by: Peng Yu | last post by:
Hi, I'm wondering how to get the cubic root for a complex number? It seems that cbrt does not work complex numbers. Thanks, Peng #include <complex> #include <iostream>
2
by: Peng Yu | last post by:
Hi, I have the following program which computes roots of a cubic function. The solution is sensitive to the type, which is due to the truncation error. 'long double T' gives three solutions, and...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.