필터 지우기
필터 지우기

What is the meaning of 'simplify(n./d)?

조회 수: 1 (최근 30일)
zhenyu zeng
zhenyu zeng 2019년 4월 22일
댓글: Steven Lord 2019년 4월 22일
What is the meaning of 'simplify(n./d)? I feel n./d is weird.
syms x
A=[3/2 (x^2+3)/(2*x-1)+3*x/(x-1);4/x^2,3*x+4]
pretty(simplify(A))
pretty(simplify(n./d)
  댓글 수: 9
zhenyu zeng
zhenyu zeng 2019년 4월 22일
>> syms x
>> A=[3/2,(x^2+3)/(2*x-1)+3*x/(x-1);4/x^2,3*x+4]
A =
[ 3/2, (3*x)/(x - 1) + (x^2 + 3)/(2*x - 1)]
[ 4/x^2, 3*x + 4]
>> [n,d]=numden(A)
n =
[ 3, x^3 + 5*x^2 - 3]
[ 4, 3*x + 4]
d =
[ 2, (2*x - 1)*(x - 1)]
[ x^2, 1]
>> simplify(A)
ans =
[ 3/2, (3*x)/(x - 1) + (x^2 + 3)/(2*x - 1)]
[ 4/x^2, 3*x + 4]
>> pretty(simplify(n./d))
/ 3 2 \
| 3 x + 5 x - 3 |
| -, ----------------- |
| 2 (2 x - 1) (x - 1) |
| |
| 4 |
| --, 3 x + 4 |
| 2 |
\ x /
Star Strider
Star Strider 2019년 4월 22일
syms x
n = ...
[ 3, x^3 + 5*x^2 - 3;
4, 3*x + 4];
d = ...
[ 2, (2*x - 1)*(x - 1);
x^2, 1];
simplified_fraction = simplify(n/d, 'Steps',20)
produces:
simplified_fraction =
[ -(- x^5 - 5*x^4 + 3*x^2 + 3)/(2*x^4 - 3*x^3 + x^2 - 2), -(2*x^3 + 4*x^2 + 9*x - 9)/(2*x^4 - 3*x^3 + x^2 - 2)]
[ (3*x^3 + 4*x^2 - 4)/(2*x^4 - 3*x^3 + x^2 - 2), -(2*(- 4*x^2 + 9*x + 2))/(2*x^4 - 3*x^3 + x^2 - 2)]

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

채택된 답변

Steven Lord
Steven Lord 2019년 4월 22일
The expression n./d divides each element of n by the corresponding element of d (with a few caveats to that if they're different sizes.) Since in your example n and d are both sym objects, the result of n./d is also a sym object.
Calling simplify on a sym object attempts to simplify the symbolic expression. In this case, since n and d were created by a call to numden (which extracts the numerator and denominator of a symbolic expression) on the sym object A, n./d should be equivalent to A. If it isn't displayed the same as A initially, simplifying it may make the similarity more pronounced. If you want to check that they're always equal:
isAlways(A == n./d)
  댓글 수: 2
zhenyu zeng
zhenyu zeng 2019년 4월 22일
What is the difference between n./d and n/d?

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

추가 답변 (0개)

태그

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by