Numerical Integration: Solving for (-2,0)

In summary, when trying to do a numerical integration in Mathematica, it is important to use machine precision numbers in either the integrand or the limits of integration. Otherwise, the result may be incorrect or give an unexpected answer.
  • #1
Nusc
760
2
u := x (4 - y - x^2)
v := y (-1 + x)

(-2,0)

du := (4 - y - 3 x^2) dx - x dy
dv := y dx + (-1 + x) dy

x := -2 + Cos[\[Theta]]
y := 0 + Sin[\[Theta]]
dx := -Sin[\[Theta]]
dy := Cos[\[Theta]]

Integrate[1/(2 \[Pi]) Expand[(u dv - v du)/(u^2 + v^2)], {\[Theta], 0,
2 \[Pi]}]

If you copy and paste that into mathematica, I'm supposed to get either 1 or -1 but it doesn't work. Does anyone know why?
 
Physics news on Phys.org
  • #2
Even if I use N
 
  • #3
If you want to do a numerical integration then be sure to have some machine precision numbers in either the integrand or the limits of integration. E.g.

Integrate[1/(2 \[Pi]) Expand[(u dv - v du)/(u^2 + v^2)], {\[Theta], 0.0, 2.0 \[Pi]}]

If you do that then it will perform a numerical integration. Otherwise it will try to evaluate the integral symbolically and then simply plug in the limits. However, when it does the symbolic integration I do not understand why it gives 0.
 
  • #4
Oh well it works. Thank you!
 

1. What is numerical integration?

Numerical integration is a method used to approximate the definite integral of a function by dividing the area under the curve into smaller rectangles and summing their areas.

2. Why is numerical integration important?

Numerical integration is important because it allows us to calculate the value of integrals that cannot be solved analytically. It is also used in many real-life applications such as calculating areas, volumes, and probabilities.

3. How is numerical integration performed?

Numerical integration is performed by dividing the interval of integration into smaller subintervals and using a numerical method, such as the trapezoidal rule or Simpson's rule, to approximate the integral over each subinterval. The results from each subinterval are then summed to get an overall approximation of the integral.

4. What is the difference between numerical integration and analytical integration?

Numerical integration involves approximating the value of an integral using a numerical method, while analytical integration involves finding the exact value of an integral using mathematical techniques such as integration by parts or substitution.

5. How can numerical integration be improved?

Numerical integration can be improved by using more subintervals, which will result in a more accurate approximation. Other methods, such as adaptive integration, can also be used to improve the accuracy of numerical integration. Additionally, using more advanced numerical methods, such as Gaussian quadrature, can also lead to better approximations.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
13
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
156
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • Calculus and Beyond Homework Help
Replies
19
Views
674
  • Calculus and Beyond Homework Help
Replies
1
Views
449
  • MATLAB, Maple, Mathematica, LaTeX
Replies
16
Views
1K
  • Calculus and Beyond Homework Help
Replies
5
Views
619
Replies
2
Views
179
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
869
Back
Top