2
$\begingroup$

I have the following equation which I want to solve:

$$ I_D = [Li_2(-e^{V_D-I_D})-Li_{2}(e^{I_D})] $$

Here $Li_2(x)$ is the PolyLog function of order $2$. Is there a way to solve this equation iteratively in Mathematica to get $I_D$ as a function of $V_D$.

Edit: I want to solve this equation numerically for real values of $I_D$ and $V_D$.

$\endgroup$

2 Answers 2

4
$\begingroup$

A typical solution of the equation

id - PolyLog[2, -Exp[vd - id]] - PolyLog[2, Exp[id]] == 0

can be obtained by plotting this expression.

ReImPlot[(id - PolyLog[2, -Exp[vd - id]] - PolyLog[2, Exp[id]]) /. vd -> .5, id, -1, 1}, 
    ImageSize -> Large, AxesLabel -> {id, None}, LabelStyle -> {15, Bold, Black}]

enter image description here

Visibly, there is a branch point at id = 0, consistent with the documentation of PolyLog. A small amount of experimentation shows that the zero of the curve shown moves toward the branch point as vd increases. Consequently, there is no solution for vd greater than

FindRoot[(id - PolyLog[2, -Exp[vd - id]] - PolyLog[2, Exp[id]]) /. id -> 0, {vd, -.87}]
(* {vd -> 0.872676} *)

at least for the principal value of PolyLog. With this information, a plot of id as a function of vd is obtained by

Plot[id /. FindRoot[(id - PolyLog[2, -Exp[vd - id]] - PolyLog[2, Exp[id]]), {id, 01}], 
    {vd, -1, .872}, ImageSize -> Large, AxesLabel -> {vd, id}, LabelStyle -> {15, Bold, Black}]

enter image description here

$\endgroup$
4
  • $\begingroup$ Thank you, this is wonderful. Can you check out my recent question: mathematica.stackexchange.com/questions/240828/… and give suggestion as to how to solve this? $\endgroup$ Commented Mar 1, 2021 at 0:50
  • $\begingroup$ @Indeterminate I see that your new question received an answer a few minutes ago. Does it meet your needs? If so, it is good practice to upvote and accept it. $\endgroup$
    – bbgodfrey
    Commented Mar 1, 2021 at 1:46
  • $\begingroup$ thanks I have commented on that answer, it actually doesn't solve my problem completely. And thanks! I have also upvoted your answer and accepted it. $\endgroup$ Commented Mar 1, 2021 at 3:22
  • $\begingroup$ My bad, I am still new, so I assumed upvoting it means accepting it. I have accepted it. Thanks for bringing it to my notice. $\endgroup$ Commented Mar 1, 2021 at 4:44
1
$\begingroup$

You can investigate what your function does when you iterate it by plotting how it updates points in the complex $I_D$ plane, and I find that using VectorPlot to plot a vector field is a useful way of visualising this.

Define your function $f(I_D,V_D)$ - i.e. the righthand side of your equation.

f[id_, vd_] := PolyLog[2, -Exp[vd - id]] - PolyLog[2, Exp[id]];

Create an animation to explore what happens as you vary $V_D$.

With[{f0 = 5, v0 = 3, dv = 0.5, p = 25}, 
  Animate[
    VectorPlot[
      ReIm[f[idR + I idI, vd] - (idR + I idI)],
      {idR, -f0, f0}, {idI, -f0, f0},
      VectorPoints -> p
    ],
    {vd, -v0, v0, dv}
  ]
]

This plots a vector field of the update $f(I_D,V_D)-I_D$ in the complex $I_D$ plane, using arrows to show update direction, and arrow colour to show update magnitude. For $V_D=0$ this looks like the plot below.

enter image description here

Points in the complex $I_D$ plane that map to themselves - i.e. are solutions of your equation - show up prominently in this sort of plot. For instance, in the plot above you can see a couple of "vortices", where the flow circulates around points that map to themselves.

This and other clues can give you a feel for how your function moves points around in the complex plane, and in particular the location of points that map to themselves - i.e. the various solution-branches that you seek.

$\endgroup$
2
  • $\begingroup$ Thanks, that is a great visualization. Is there a numerical way to solve this? (Only real values of $I_D$ and $V_D$) $\endgroup$ Commented Feb 26, 2021 at 19:11
  • 1
    $\begingroup$ Because there is more than one solution-branch this is a non-trivial problem. For instance, for $V_D=0$ FindRoot[id == f[id, 0], {id, 0}] gives {id -> -1.00844 - 1.47085 I}, which is the lower of the pair of "vortices" in the above visualisation. If you then plot how this solution depends on $V_D$, the plot will switch (mid-plot) between different solution-branches. Play around with the above visualisation to get a good feel for where the solutions are, then you will be able to give a root-finding approach a guiding "steer" towards your preferred solution-branch. $\endgroup$ Commented Feb 26, 2021 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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