Search code examples
matlabsymbolic-mathsimplify

Simplify behavior on symbolic expression with limit


I want to simplify this symbolic expression, and then take the limit of it (this is not too hard on a paper) using Matlab

syms n x
sn = 8^n * n^2 * (sin(x))^(3*n)
simplify(sn^(1/n))

which results in

ans =

8*n^(2/n)*(sin(x)^(3*n))^(1/n)

This must be like 8 * n^(2/n) * (sin(x))^3. However, if I use

x = sym('x', 'positive'); n = sym('n', 'positive');
sn = 8^n * n^2 * (sin(x))^(3*n)
simplify(sn^(1/n))

to obtain a similar answer and then take limit, I get:

limit(ans, n, inf)

ans =

8*limit(n^(2/n)*(sin(x)^(3*n))^(1/n), n == Inf)

instead of 8*sin(x)^3.

If I simplify this on paper and then take limit, everything works:

limit(8*n^(2/n)*sin(x)^3, n, inf)

ans =

8*sin(x)^3

Is it possible to solve this using Matlab?


Solution

  • MuPAD doesn't simplify the expression, and thus can't take the limit, because you haven't provided the appropriate assumptions. It's not true that an expression such as (sin(x)^n)^(1/n) simplifies to sin(x) if n and x are positive. You need to fully restrict the range of x as it the argument of a periodic function:

    x = sym('x','positive');
    n = sym('n','real');
    assumeAlso(x<=sym(pi));
    sn = 8^n * n^2 * (sin(x))^(3*n);
    sn2 = simplify(sn^(1/n))
    limit(sn2, n, Inf)
    

    which returns the answer you were expecting

    ans =
    
    8*sin(x)^3
    

    If you have access to Mathematica, this sort of thing can be accomplished very easily:

    Limit[(8^n n^2 Sin[x]^(3 n))^(1/n), n -> \[Infinity], Assumptions -> {n \[Element] Reals, x >= 0, x <= \[Pi]}]