Editing
Equations, Formulas and Algorithms
(section)
From FusionGirl Wiki
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==== Numerical Integration ==== Numerical integration methods approximate the integral of a function over a specified interval. Common numerical integration techniques include the trapezoidal rule, Simpson's rule, and Gaussian quadrature. These methods are used to compute integrals in situations where analytical solutions are not feasible. '''Example: Trapezoidal Rule''' The trapezoidal rule approximates the integral of a function <math> f(x) </math> over the interval <math>[a, b]</math> as follows: <math mode="display"> \int_{a}^{b} f(x) \, dx \approx \frac{h}{2} \left( f(a) + 2\sum_{i=1}^{n-1} f(x_i) + f(b) \right) </math> where <math> h = \frac{b - a}{n} </math> is the width of each subinterval and <math> x_i = a + ih </math> are the points at which the function is evaluated. '''Source Code Example (Python):''' <syntaxhighlight lang="python"> def trapezoidal_rule(f, a, b, n): h = (b - a) / n sum_val = 0.5 * (f(a) + f(b)) for i in range(1, n): sum_val += f(a + i * h) return h * sum_val # Example usage: def func(x): return x**2 result = trapezoidal_rule(func, 0, 1, 100) print("Approximated integral using Trapezoidal Rule:", result) </syntaxhighlight>
Summary:
Please note that all contributions to FusionGirl Wiki are considered to be released under the Creative Commons Attribution (see
FusionGirl Wiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Page actions
Page
Discussion
Read
Edit
Edit source
History
Page actions
Page
Discussion
More
Tools
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Search
Tools
What links here
Related changes
Special pages
Page information