# IRR Plot on Complex Plane

How do I plot the solutions of

Sum[cf1[[i, 2]] E^(-r cf1[[i, 1]]), {i, Length@cf1}] == 0


where

cf1 = {{0, -100}, {1, 10}, {2, 10}, {3, 110}}


as lines on the complex plane? The equation is an simple example of an internal rate of return problem. To restate, I know that FindRoot will give me the answer in reals. I want to demonstrate that, on the complex plane, the answer is much more, ahh..., complex.

• What is r supposed to be? Oct 13, 2016 at 13:38
• r is the interest rate, the internal rate of return that makes the present value of these cashflows equal to zero under continuous compounding. Oct 13, 2016 at 13:50
• ...and certainly those are supposed to be real; however, you want to know about complex solutions fo the resulting equation, then? Oct 13, 2016 at 13:52

My try.

cf1 = {{0, -100}, {1, 10}, {2, 10}, {3, 110}};
f[r_] := Sum[cf1[[i, 2]]/E^(r*cf1[[i, 1]]), {i, Length[cf1]}]

sol[A_] := Chop@Normal[r /. NSolve[f[r] == 0, r]] /. C[1] -> A
(* A is Integer according to the ConditionalExpression that I get rid of with Normal *)

pts = Flatten[#, 1] &@Table[sol[a], {a, 0, 15}];

ListPlot[ReIm /@ pts, Frame -> True, PlotRange -> All, FrameLabel -> {"Re", "Im"}]


Those are only the complex solutions to the equation f[r] == 0.

If you want something "prettier", use the domainPlot function written by Simon Woods:

domainPlot[f, 3]


domainPlot[f, 1]


• that is gorgeous, better than what I had in mind. Oct 13, 2016 at 14:46
• Remember to upvote the excellent answer of Simon Woods that I linked in my post, after you gain enough reputation to do so. Oct 13, 2016 at 14:48
• How do I show that as a Plot3D? Oct 13, 2016 at 14:58
• Got it, Plot3D[ReIm@f[Complex[a, b]], {a, -3, 3}, {b, -3, 3}] Oct 13, 2016 at 15:20
• But when I look closely, the resulting surface is actually two surfaces. What is happening? Oct 13, 2016 at 15:29
cf1 = {{0, -100}, {1, 10}, {2, 10}, {3, 110}};

f[r_] = Sum[cf1[[i, 2]] E^(-r cf1[[i, 1]]), {i, Length@cf1}] // Simplify;


Solve will provide exact solutions

sol[m_] = Solve[f[r] == 0, r] /. C[1] -> m // Normal // Simplify

(*  {{r -> 2/3 I (-1 + 3 m) π},
{r -> 2/3 I (π + 3 m π)},
{r -> 2 I m π + Log[11/10]}}


The solutions are three points in the complex plane for each integer m

Verifying the solutions

And @@ (f[r] == 0 /. sol[m] //
FullSimplify[#, Element[m, Integers]] &)

(*  True  *)


Note that ReIm is Listable

Attributes[ReIm]

(*  {Listable, Protected}  *)

pts = ReIm[Table[r /. sol[m], {m, -2, 2}]];

ListPlot[Tooltip[pts],
Frame -> True, Axes -> False,
FrameLabel -> (Style[#, 14, Bold] & /@
{"Re[r]", "Im[r]"}),
PlotLegends -> Range[-2, 2]]


I took the answers from Solve and did the following:

t1 = Table[ReIm[-((2 I \[Pi])/3) + 2 I \[Pi] n], {n, -5, 10}];
t2 = Table[ReIm[(2 I \[Pi])/3 + 2 I \[Pi] n], {n, -5, 10}];
t3 = Table[ReIm[2 I \[Pi] n + Log[11/10]], {n, -5, 10}];
Show@Graphics[{Point[t1], Point[t2], Point[t3]},
Axes -> True, AspectRatio -> 1/GoldenRatio]


It works but I was hoping for something prettier.

• Try ListPlot[t1~Join~t2~Join~t3]. But what did you hope for? Oct 13, 2016 at 13:54