MATLAB: How to obtain a symbolic solution for a system of equations involving constant variables

specify constants in solve

I want to obtain a symbolic solution for v,x,y,z. I have to constant variables c1 and c2. Here are simultaneous equations:
v+x+y+z=1
v+y=c1
v+x=c2
sqrt(v*x*y*z)=x*y*z+v*y*z+v*x*z+v*x*y
If I assign specific real numbers to c1 and c2 and use the solve function I get results. But for some reason if I ask the solution to be expressed in terms of letters c1 and c2, solve fails to recognized c1 and c2. Any suggestion on how to get around the problem?

Best Answer

syms v x y z c1 c2
eq1 = v+x+y+z==1
eq2 = v+y==c1
eq3 = v+x==c2
eq4 = sqrt(v*x*y*z)==x*y*z+v*y*z+v*x*z+v*x*y
sols = solve([eq1,eq2,eq3,eq4],[v,x,y,z], 'returnconditions', true)
sols.parameters
sols.conditions
sols.v
sols.x
sols.y
sols.z
You will get a whole list of possibilities, some of which are only valid in particular conditions that are described by sols.conditions . You will notice that some of them are in terms of an extra variable, possibly named z1, exact name in sols.parameters . Under some conditions there are an indefinite number of solutions. For example if c1 = 1/2 and c2 = 1/2 then there are an indefinite number of solutions