3
$\begingroup$

I wrote the following code:

Solve[{x == VIN/VOUT, VOUT == 5 VIN}, {x}]

Mathematica does not solve it. How can I get the result x=1/5?

Thank you so much for your willingness.

$\endgroup$
  • $\begingroup$ what if VIN = 0? or VOUT=0? $\endgroup$ – Nasser Jul 26 '18 at 9:58
  • $\begingroup$ Hello @Nasser, maybe Mathematica assumes VIN and VOUT as non zero constant by default....but this must to be verify. $\endgroup$ – Gennaro Arguzzi Jul 26 '18 at 14:24
  • 1
    $\begingroup$ @Nasser - "Solve gives generic solutions only. Solutions that are valid only when continuous parameters satisfy equations are removed. Other solutions that are only conditionally valid are expressed as ConditionalExpression objects." $\endgroup$ – Bob Hanlon Jul 26 '18 at 15:45
  • 1
    $\begingroup$ Another hack: Solve[Eliminate[{x == VIN/VOUT, VOUT == 5 VIN}, {VOUT}], {x}] giving {{x -> 1/5}} $\endgroup$ – user1066 Jul 29 '18 at 22:09
7
$\begingroup$
Solve[{x == VIN/VOUT, VOUT == 5 VIN}, {x, VOUT}]
(*{{x -> 1/5, VOUT -> 5 VIN}}*)
| improve this answer | |
$\endgroup$
  • $\begingroup$ Hello @UlrichNeumann, your solution is very useful. Thanks. $\endgroup$ – Gennaro Arguzzi Jul 26 '18 at 9:44
  • 1
    $\begingroup$ In recent versions, you can also just use Solve[{x == VIN/VOUT, VOUT == 5 VIN}] $\endgroup$ – Mark S. Jul 26 '18 at 12:17
  • $\begingroup$ ... also Solve[{x == VIN/VOUT, VOUT == 5 VIN}, {x}, MaxExtraConditions -> 1] $\endgroup$ – AccidentalFourierTransform Jul 26 '18 at 14:24
  • 2
    $\begingroup$ Or Solve[{x == VIN/VOUT, VOUT == 5 VIN}, x, {VOUT}] $\endgroup$ – Bob Hanlon Jul 26 '18 at 15:38
  • 1
    $\begingroup$ @rhermans - This syntax was documented in earlier versions but the documentation stopped mentioning it. However, it appears to be kept for backward compatibility. The variables to be eliminated must be in list brackets, e.g., {VOUT}. If you were to enter just VOUT then Mma would first try to interpreted it as a domain resulting in the warning: Solve::bdomv: Warning: VOUT is not a valid domain specification. Assuming it is a variable to eliminate. and then give the correct output. $\endgroup$ – Bob Hanlon Jul 30 '18 at 20:55
1
$\begingroup$
Reduce[
 {
  x == VIN/VOUT,
  VOUT == 5 VIN
  }, {x}
 ]
(* VIN == VOUT/5 && x == 1/5 && VOUT != 0 *)

Solve@Reduce[
  {
   x == VIN/VOUT,
   VOUT == 5 VIN
   }, {x}
  ]
(* {{VOUT -> 5 VIN, x -> 1/5}} *)
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.