0
$\begingroup$

I want to evaluate this integral, but it won't work. Does anyone knows why?

Remove["Global`*"]

dm = (M/(2 π a)) a ;

i[ϵ_] = 1/(a Sqrt[1 - 2 (ϵ) Cos[θ] + (ϵ)^2]);
i1[ϵ_] = Series[i[ϵ], {ϵ, 0, 1}];
invertdist[r_] = i1[a/r];

ϕ[r_] = -Integrate[G dm invertdist[r], {θ, 0, 2  π}]
$\endgroup$
1
  • 1
    $\begingroup$ There are two errors in your code: functions are defined with := and Series requires a symbol as a variable. $\endgroup$
    – Hector
    Commented Mar 21, 2014 at 23:38

1 Answer 1

3
$\begingroup$

The only thing wrong with your code is that Series doesn't return an expression suitable for evaluation at specific values of the expansion variable. You first have to convert the SeriesData object to a normal expression using Normal. This is the only change needed:

i1[ϵ_] = Normal[Series[i[ϵ], {ϵ, 0, 1}]];

With this, the integration works as expected:

ϕ[r_] = -Integrate[G dm invertdist[r], {θ, 0, 2 Pi}]

(* ==> -((G M)/a) *)
$\endgroup$
2
  • $\begingroup$ Thanks a lot! I now know how to use the "Normal". $\endgroup$
    – Lawerance
    Commented Mar 22, 2014 at 20:10
  • $\begingroup$ @Lawerance: if you are satisfied with the answer you received from Jens (and it seems you are), then please Accept his answer. $\endgroup$
    – Cassini
    Commented Mar 30, 2014 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.