# Simplified solution to system of algebraic equations

1 visualización (últimos 30 días)
Aleem Andrew el 1 de Abr. de 2020
Comentada: Aleem Andrew el 1 de Abr. de 2020
The following code solves the system of equations for x, but the solution could be further simplified, for example, by factoring N from the numerator. Can I modify the code so the solution is simplified?
syms a b x N g b L m
eqns = [(1/b)*(-2*N*sin(a))/3==m*L, x/b==-(5*L*cos(a))/6+(5*a^2*L*sin(a))/6, N/b==m*(5*L*sin(a))/6+(5*a^2*L)/(6*cos(a) +3*g)];
S = solve(eqns,[b m x]);
sol = [S.x]
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

Ameer Hamza el 1 de Abr. de 2020
Try this
syms a b x N g b L m
eqns = [(1/b)*(-2*N*sin(a))/3==m*L, x/b==-(5*L*cos(a))/6+(5*a^2*L*sin(a))/6, N/b==m*(5*L*sin(a))/6+(5*a^2*L)/(6*cos(a) +3*g)];
S = solve(eqns,[b m x]);
sol = S.x
sol_simplified = simplify(S.x)
Result:
sol =
-(18*N*cos(a)^2 + 10*N*cos(a)^2*sin(a)^2 + 9*N*g*cos(a) - 18*N*a^2*cos(a)*sin(a) - 5*N*a^2*g*sin(a)^3 + 5*N*g*cos(a)*sin(a)^2 - 10*N*a^2*cos(a)*sin(a)^3 - 9*N*a^2*g*sin(a))/(18*a^2)
sol_simplified =
(N*(cos(a) - a^2*sin(a))*(5*cos(a)^2 - 14)*(g + 2*cos(a)))/(18*a^2)
##### 1 comentarioMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
Aleem Andrew el 1 de Abr. de 2020
Thank you

Iniciar sesión para comentar.

### Categorías

Más información sobre Numbers and Precision en Help Center y File Exchange.

### Community Treasure Hunt

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

Start Hunting!

Translated by