How can I add conditions to a system of equations?
15 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Domenico Mancini
el 22 de Nov. de 2021
Respondida: Star Strider
el 22 de Nov. de 2021
regarding this code, i want to add the conditions that the variables takes values between 1 and 9, so 1<q,w,e,r,t,y,u,i,o>9. thank you
syms q w e r t y u i o
eqn1= (w*r)/o==6
eqn2=(t-u)*q==8
eqn3=(1+y)/w==1
eqn4=((q*e)-0)/t==3
sol = solve([eqn1, eqn2, eqn3,eqn3], [q,w,e,r,t,y,u,i,o]);
qsol=sol.q
wsol=sol.w
esol=sol.e
rsol=sol.r
tsol=sol.t
ysol=sol.y
usol=sol.u
isol=sol.i
osol=sol.o
0 comentarios
Respuesta aceptada
Star Strider
el 22 de Nov. de 2021
syms q w e r t y u i o real
assume([q w e r t y u i o]>=1 & [q w e r t y u i o]<=9)
eqn1= (w*r)/o==6
eqn2=(t-u)*q==8
eqn3=(1+y)/w==1
eqn4=((q*e)-0)/t==3
sol = solve([eqn1, eqn2, eqn3,eqn3], [q,w,e,r,t,y,u,i,o], 'ReturnConditions',1);
parms = sol.parameters
condx = sol.conditions
qsol=sol.q
wsol=sol.w
esol=sol.e
rsol=sol.r
tsol=sol.t
ysol=sol.y
usol=sol.u
isol=sol.i
osol=sol.o
That seems to work.
Experiment to get the desired results.
.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Symbolic Math Toolbox 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!