Closed mikldk closed 5 years ago
Not a function, but there's a quite general mechanism (local rules) which works great in this case:
In> solutions := Solve({(x*y)/2-3*a == 0, x^2/4-(3*a)/2 == 0, 45-(3*x+(3*y)/2) == 0}, {x, y, a})
Out> {{x==0,y==30,a==0},{x==10,y==10,a==50/3}}
In> solutions := solutions /:: { _lhs == _rhs <- rhs }
Out> {{0,30,0},{10,10,50/3}}
The /::
operator applies a local rule, which matches _lhs==_rhs
and rewrites it as rhs
. Note that, contrary to global rules, local ones are defined by <-
and not by <--
.
Fantastic. Thanks.
It is probably easy for you, but is there an easy way to remove variable names in a solution to
Solve()
? E.g. when I getI would like an easy way to remove the variable names, e.g. called
StripNames()
such thatwould return
Does such a function exists?