# Solving a complicated time-dependent function

I want to solve the following time-dependent system of equations:

Clear["Global*"];
q = (((1602176634)/10^9))*10^(-19);
k = (((1380649)/10^6))*10^(-23);
\[Eta] = 3/2;
Td = 20 + (5463/20);
R1 = 10;
Vi = Piecewise[{{u*Sin[\[Omega]*t],
0 <= t <= ((2*Pi)/\[Omega])/2}, {0, t > ((2*Pi)/\[Omega])/2}}];
u = 230*Sqrt[2];
\[Omega] = 2*Pi*50;
Is = 5*10^(-9);
FullSimplify[
Solve[{I1 == Is*(Exp[(q*(Vi - V1))/(\[Eta]*k*Td)] - 1),
I1 == Is*(Exp[(q*(V1 - V2))/(\[Eta]*k*Td)] - 1), I1 == V2/R1}, {I1,
V1, V2}]]


But it spits out nothing, just the simplified version of the input. Is there a way to solve for the unknowns $$I_1$$, $$V_1$$ and $$V_2$$?

• Vi is a function of t but I can not see any t in your equations. Mar 14 at 19:10
• @DanielHuber because the input is a function of time the outputs are also, do I need to specify that? And if so, how do I do that?
– Jan
Mar 14 at 19:16
• If Vi is to be treated like a constant in your equation, then replace it by a symbol without value ( e.g. Vi0), then solve the equations and replace Vi0in the solution by Vi Mar 14 at 19:38
• @DanielHuber Does that solve the problem?
– Jan
Mar 14 at 19:39

## 1 Answer

You get no result because Vi is a function.

If you replace Vi, say Vi0 by a constant you will get a solution that is not unique. But if you restrict the solutions to Reals you will get a unique results.

Here is the procedure:

Clear["Global*"];
q = (((1602176634)/10^9))*10^(-19);
k = (((1380649)/10^6))*10^(-23);
\[Eta] = 3/2;
Td = 20 + (5463/20);
R1 = 10;
Vi = Piecewise[{{u*Sin[\[Omega]*t],
0 <= t <= ((2*Pi)/\[Omega])/2}, {0, t > ((2*Pi)/\[Omega])/2}}];
u = 230*Sqrt[2];
\[Omega] = 2*Pi*50;
Is = 5*10^(-9);
FullSimplify[
sol = Solve[{I1 == Is*(Exp[(q*(Vi0 - V1))/(\[Eta]*k*Td)] - 1),
I1 == Is*(Exp[(q*(V1 - V2))/(\[Eta]*k*Td)] - 1),
I1 == V2/R1}, {I1, V1, V2}, Reals][[1]]];
funs[t_] = {I1, V1, V2} /. sol /. Vi0 -> Vi // Simplify;


You can now plot the solutions:

Plot[funs[t], {t, 0, .01}]


You only see 2 functions, because the 2. and 3. component of funs are nearly the identical. However, we may plot the difference:

Plot[funs[x][2] - funs[x][[3]], {x, 0, .01}]