0
$\begingroup$

I am trying to solve following system of equations, but i am not getting the desired solution:

{uc[t] -> u[t] - ul[t] - y[t]}

I am trying to solve from following set of equations, but Mathematica answers with the empty set {}. Am I having a problem with my syntax?

KEquations = {ic[t] - il[t] == 0,
              il[t] - ir[t] == 0,
              -u[t] + uc[t] + ul[t] + y[t] == 0};

solution1 = Solve[KEquations, uc[t]]
$\endgroup$
1
$\begingroup$
KEquations = {ic[t] - il[t] == 0, 
   il[t] - ir[t] == 0, -u[t] + uc[t] + ul[t] + y[t] == 0};

You have three equations, you need to tell Mathematica which three variables you want

solution1 = Solve[KEquations, {uc[t], ic[t], il[t]}][[1]]

(* {uc[t] -> u[t] - ul[t] - y[t], ic[t] -> ir[t], il[t] -> ir[t]} *)

Alternatively, specify the variables to be eliminated

solution1 = Solve[KEquations, uc[t], {ic[t], il[t]}][[1]]

(* {uc[t] -> u[t] - ul[t] - y[t]} *)

Or

solution1 = Solve[Eliminate[KEquations, {ic[t], il[t]}], uc[t]][[1]]

(* {uc[t] -> u[t] - ul[t] - y[t]} *)
$\endgroup$
0
$\begingroup$

For some reason that I don't understand, if you give too few variables to Solve for the output is {} as you've found out. Just give three variables, e.g.

Solve[KEquations, {uc[t],ic[t],ir[t]}]

{{uc[t] -> u[t] - ul[t] - y[t], ic[t] -> il[t], ir[t] -> il[t]}}
$\endgroup$
  • $\begingroup$ Isn't there another way of doing it @KraZug? $\endgroup$ – calaedo Dec 15 '17 at 20:25
  • $\begingroup$ You can just leave the second option empty: Solve[KEquations], but it may not give you the substitution you want. There is probably some other way, but I don't know it. $\endgroup$ – KraZug Dec 15 '17 at 21:18

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.