0
$\begingroup$

I have two circuit equations

power == voltage*current
voltage == resistance*current

You can plug the second equation into the first and get

power == current^2 * resistance

I'm wondering why this input is returning no solution

Solve[{power == voltage*current, voltage == resistance*current}
  /. {voltage -> 5, resistance -> 10}, current]

If I manually solve for power, then I can get the correct result

Solve[{power == voltage*current, voltage == resistance*current}
  /. {voltage -> 5, resistance -> 10, power -> 5^2/10}, current]

{{current -> 1/2}}

I also get the correct solution if I request the solution for both current and power

Solve[{power == voltage*current, voltage == resistance*current}
   /. {voltage -> 5, resistance -> 10}, {current, power}]

{{current -> 1/2, power -> 5/2}}

I did some more testing and found that if I provide the MaxExtraConditions->All that I get a solution. Is this what I should be using?

{{current -> ConditionalExpression[1/2, power == 5/2]}}
$\endgroup$
  • 2
    $\begingroup$ The issue is that unless you solve for power, it is assumed to be a parameter of the equations. And the equations do not have solutions for arbitrary values of power, hence nothing is returned (Solve normally only returns generic solutions as mentioned in the documentation) - as you've realized, MaxExtraConditions->All can help with that $\endgroup$ – Lukas Lang Jan 9 '19 at 20:23
2
$\begingroup$

It can't read your mind to understand that power is a free variable rather than a parameter you intend to define later. One way to deal with this is to solve for both current and power. Another way is to simplify by eliminating power:

Eliminate[{power == voltage*current, voltage == resistance*current}, power]
(* voltage == current resistance *)

Then, solve that.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Or eliminate power with Solve using this form: Solve[{power == voltage*current, voltage == resistance*current} /. {voltage -> 5, resistance -> 10}, current, {power}][[1]] $\endgroup$ – Bob Hanlon Jan 10 '19 at 0:43

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.