indefinite Integral with two unknowns

I am trying to find the solution to this indefinite integral but when I try the symbolic method I get an error saying 'a' is an undefined variable. Can anyone help me out?

 Accepted Answer

The solution is to define ‘a’:
syms x a
e = int(sqrt((x - a)/(x + a)), x);
e = simplify(e, 'steps', 10)
e =
(a + x)*(-(a - x)/(a + x))^(1/2) - 2*a*atanh((-(a - x)/(a + x))^(1/2))

More Answers (1)

syms a x
int(sqrt((x-a)/(x+a)),x)
does not work ?
Best wishes
Torsten.

3 Comments

I already tried that and unfortunately no. Here is the error I got with that method
Error using inlineeval (line 14) Error in inline expression ==> sqrt((x-a)/(x+a)) Undefined function or variable 'a'. Error in inline/subsref (line 23) INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr);
Then you don't seem to use the most recent MATLAB version.
Take a look at your documentation for suitable examples.
Best wishes
Torsten.
You defined the expression to be integrated as an inline object. That won't work. Define it as a symbolic expression instead as Star Strider and Torsten did; note that this will require Symbolic Math Toolbox.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!