isolate a variable?

조회 수: 6 (최근 30일)
Artur M. G. Lourenço
Artur M. G. Lourenço 2011년 9월 2일
I can isolate one variable as an expression? example:
'x^2+2+x' em 'x = x^2 +2'
remembering that they are symbolic objects.
Thanks in advance.

채택된 답변

Walter Roberson
Walter Roberson 2011년 9월 2일
If your input is x^2 + 2 + x then you cannot isolate x to one side of an equation, as your input is not an equation.
If your input is implicitly x^2 + 2 + x = 0 then your example output of x = x^2 + 2 is incorrect: instead x = -x^2 - 2
You cannot always isolate one variable -- not unless you are willing to make some restrictions on the form of the equation.
If you have a polynomial as input, then
S = x^2+2+x;
c = sym2poly(S);
isolated_x = x * c(end-1) - S;
  댓글 수: 2
Artur M. G. Lourenço
Artur M. G. Lourenço 2011년 9월 2일
Thank you and sorry for having written the equation the wrong way. However I could not do the same for this equation:
f = x * pi * sqrt (x ^ 2 +20 ^ 2);
it is possible to do in the Symbolic Math Toolbox?
Walter Roberson
Walter Roberson 2011년 9월 2일
Usually what you do is solve() for a variable, rather than try to isolate the variable.
You could try working with map() and coeff(), but as I do not have the Symbolic Toolbox I am not certain what result you will get for terms that do not have the variable. The coeff() page indicates that FAIL should be returned; I do not know what FAIL translates to when moved from the MuPad side to the MATLAB side.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by