Numerical Integration: Solving for (-2,0)

AI Thread Summary
The discussion centers on a mathematical problem involving the integration of a specific expression in Mathematica. The user is attempting to evaluate the integral of the form 1/(2π) Expand[(u dv - v du)/(u^2 + v^2)] over the interval from 0 to 2π. The user notes that when using symbolic integration, the result is unexpectedly zero, while numerical integration yields either 1 or -1. A key point raised is the importance of using machine precision numbers for numerical integration to ensure accurate results. The user successfully resolves the issue by adjusting the limits of integration to include decimal points, prompting Mathematica to perform numerical integration instead of symbolic evaluation.
Nusc
Messages
752
Reaction score
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
Even if I use N
 
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.
 
Oh well it works. Thank you!
 

Similar threads

Replies
13
Views
2K
Replies
1
Views
2K
Replies
1
Views
2K
Replies
4
Views
1K
Replies
1
Views
2K
Replies
7
Views
2K
Replies
1
Views
2K
Back
Top