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

3 Ansichten (letzte 30 Tage)
zhenyu zeng
zhenyu zeng am 22 Apr. 2019
Kommentiert: Steven Lord am 22 Apr. 2019
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 Kommentare
zhenyu zeng
zhenyu zeng am 22 Apr. 2019
>> 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 am 22 Apr. 2019
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)]

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Steven Lord
Steven Lord am 22 Apr. 2019
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 Kommentare
zhenyu zeng
zhenyu zeng am 22 Apr. 2019
What is the difference between n./d and n/d?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by