What is the meaning of 'simplify(n./d)?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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
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)]
Akzeptierte Antwort
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
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!