Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
zhenyu zeng
zhenyu zeng el 22 de Abr. de 2019
Comentada: Steven Lord el 22 de Abr. de 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 comentarios
zhenyu zeng
zhenyu zeng el 22 de Abr. de 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 el 22 de Abr. de 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)]

Iniciar sesión para comentar.

Respuesta aceptada

Steven Lord
Steven Lord el 22 de Abr. de 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 comentarios
zhenyu zeng
zhenyu zeng el 22 de Abr. de 2019
What is the difference between n./d and n/d?

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by