Professional Documents
Culture Documents
Documentation of The Program
Documentation of The Program
Introduction
where
on the interval.
Middle sum
Approximating f at the midpoint of intervals gives f(a + x/2) for the first interval,
for the next one f(a + 3x/2), and so on until f(b x/2). Summing up the areas gives
where
on the interval.
Trapezoidal Rule
In this case, the values of the function f on an interval are approximated by the
average of the values at the left and right endpoints. In the same manner as above, a
simple calculation using the area formula
where
The approximation obtained with the trapezoid rule for a function is the same as
the average of the left hand and right hand sums of that function.
Left
Right
Middle
Trapezoidal
Abstract
The developers created an application in Visual Basic for computing the area on a
certain function using Left and Trapezoidal method of Riemann Sums. This application
would help a lot of people to approximate the area of functions or lines on a graph while
considering the efficiency of the application. It is done by analyzing and simplifying the
formulas given in Riemann Sums that could be written as a code. The methods used by
the developers were the Left and Trapezoidal Method. The developers found some
solutions and alternatives to maximize the capability of the application in computing the
area while eliminating bugs and errors. The interface of the application was also simple
and informative, therefore making it more approachable and user-friendly.
Interface
Left Method:
a.) Textbox 1 to 4- The box that will guide the user to input his/her desired equation.
b.) Combobox 1 to 3- The combobox that can help the user to decide wether the certain
part of the equation would be + or -.
c.) Button 1- The button that will make the users choice to become an equation.
d.) Labelbox- The box that will show the whole equation.
e.) Textbox 5- The user can decide where will be the computation of the area starts.
f.) Textbox 6- The user can decide where will be the computation of the area ends.
g.) Textbox 7- The user can decide how many rectangles will be using for computation.
h.) Button 2-The button that will analyze and solve for the given problem.
i.) Labelbox- The box that will show the answer in square units.
Trapezoidal Method:
a.) Textbox 1 to 4- The box that will guide the user to input his/her desired equation.
b.) Combobox 1 to 3- The combobox that can help the user to decide wether the certain
part of the equation would be + or -.
c.) Button 1- The button that will make the users choice to become an equation.
d.) Labelbox- The box that will show the whole equation.
e.) Textbox 5- The user can decide where will be the computation of the area starts.
f.) Textbox 6- The user can decide where will be the computation of the area ends.
g.) Textbox 7- The user can decide how many trapezoids will be using for computation.
h.) Button 2-The button that will analyze and solve for the given problem.
i.) Labelbox- The box that will show the answer in square units.
Code
Left Method:
Public Class Form1
Dim equation, plusmin1, plusmin2, plusmin3 As Integer
Dim interval, start, ends, rect, area, norect, yans, yans2, yans3, yans4, yansf, val1, val2, val3,
val4 As Double
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ComboBox1.Items.Add("+")
ComboBox1.Items.Add("-")
ComboBox1.SelectedIndex = 0
ComboBox2.Items.Add("+")
ComboBox2.Items.Add("-")
ComboBox2.SelectedIndex = 0
ComboBox3.Items.Add("+")
ComboBox3.Items.Add("-")
ComboBox3.SelectedIndex = 0
End Sub
Private Sub Button2_Click_1(sender As Object, e As EventArgs) Handles Button2.Click
interval = (TextBox6.Text - TextBox5.Text) / TextBox7.Text
yansf = 0
While norect < TextBox7.Text
yans = ((TextBox5.Text ^ 3) * TextBox1.Text)
If ComboBox1.Text = "+" Then
yans2 = yans + ((TextBox5.Text ^ 2) * TextBox2.Text)
Else
yans2 = yans - ((TextBox5.Text ^ 2) * TextBox2.Text)
End If
If ComboBox2.Text = "+" Then
yans3 = yans2 + (TextBox5.Text * TextBox3.Text)
Else
yans3 = yans2 - (TextBox5.Text * TextBox3.Text)
End If
If ComboBox3.Text = "+" Then
Trapezoidal Method:
Public Class Form1
Dim equation, plusmin1, plusmin2, plusmin3 As Integer
Dim interval, area, notrap, yans, yans2, yans3, yans4, yansf, yval, start, ends As Double
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ComboBox1.Items.Add("+")
ComboBox1.Items.Add("-")
ComboBox1.SelectedIndex = 0
ComboBox2.Items.Add("+")
ComboBox2.Items.Add("-")
ComboBox2.SelectedIndex = 0
ComboBox3.Items.Add("+")
ComboBox3.Items.Add("-")
ComboBox3.SelectedIndex = 0
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Label6.Text = TextBox1.Text & "x " & ComboBox1.Text & TextBox2.Text & "x " &
ComboBox2.Text & TextBox3.Text & "x " & ComboBox3.Text & TextBox4.Text
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
interval = (TextBox6.Text - TextBox5.Text) / TextBox7.Text
yansf = 0
yval = 0
notrap = 0
While notrap <= TextBox7.Text
yans = ((TextBox5.Text ^ 3) * TextBox1.Text)
If ComboBox1.Text = "+" Then
yans2 = yans + ((TextBox5.Text ^ 2) * TextBox2.Text)
Else
yans2 = yans - ((TextBox5.Text ^ 2) * TextBox2.Text)
End If
If ComboBox2.Text = "+" Then
yans3 = yans2 + (TextBox5.Text * TextBox3.Text)
Else
yans3 = yans2 - (TextBox5.Text * TextBox3.Text)
End If
If ComboBox3.Text = "+" Then
yans4 = yans3 + TextBox4.Text
Else
yans4 = yans3 - TextBox4.Text
End If
If notrap = TextBox7.Text Then
yansf = yans4
yval += yansf
ElseIf notrap = 0 Then
yansf = yans4
yval += yansf
Else
yansf = yans4 * 2
yval += yansf
End If
TextBox5.Text = TextBox5.Text + interval
notrap = notrap + 1
End While
No. Of Rectangles: 2
Solution: (emathhelp.net/calculators/calculus-2/riemann-sum-calculator/)
The Application:
Trapezoidal Method:
Equation: 4x+5x+6x+7
Start: 2
End: 10
No. Of Trapezoids: 4
Solution:(emathhelp.net/calculators/calculus-2/riemann-sum-calculator/)
The Application:
Bibliography
https://en.wikipedia.org/wiki/Riemann_sum
https://emathhelp.net/calculators/calculus-2/riemann-sum-calculator/
https://www.youtube.com/watch?v=wJ2Q4jKqBnY
http://mathworld.wolfram.com/RiemannSum.html