How to add assumptions to the integrated function

rocco_sprmnt21
Mon, 05 Jun 2023 19:41:09 +0000
Modelling & Simulations

I posted the question here because it seemed to me the least unrelated to the question.

Of the following integral I am interested only in the real part. How can I force to consider a>x>0?
Or, alternatively, how can I select only the second one between the two results?

julia> using SymPy

julia> @syms x y a b
(x, y, a, b)

julia> integrate(sqrt(a^2-x^2),x)
⎧     2      ⎛x⎞
⎪  ⅈ⋅a ⋅acosh⎜─⎟                                  3             │ 2│
⎪            ⎝a⎠         ⅈ⋅a⋅x                 ⅈ⋅x              │x │
⎪- ───────────── - ───────────────── + ───────────────────  for │──│ > 1
⎪        2                 _________             _________      │ 2│
⎪                         ╱       2             ╱       2       │a │
⎪                        ╱       x             ╱       x
⎪                  2⋅   ╱   -1 + ──    2⋅a⋅   ╱   -1 + ──
⎪                      ╱          2          ╱          2
⎨                    ╲╱          a         ╲╱          a
⎪
⎪                                    ________
⎪                                   ╱      2
⎪                                  ╱      x
⎪              2     ⎛x⎞   a⋅x⋅   ╱   1 - ──
⎪             a ⋅asin⎜─⎟         ╱         2
⎪                    ⎝a⎠       ╲╱         a
⎪             ────────── + ──────────────────                otherwise
⎩                 2                2

5 posts - 3 participants