Why does calculating $exp z$ using $ln z$ via newton-raphson method fail to converge?












6












$begingroup$


I am trying to calculate $exp z$ using $ln z$ via Newton-Raphson method $$x_{n+1} = x_n-frac{f(x_n)}{f^{'}(x_n)}$$and got the formula $$x_{n+1}=x_n-frac{ln x_n-z}{frac{1}{x_n}}$$ where $z = a + bi$ is the value i'm trying to iterate to. However this formula only converges when $-3< b < 3$. But, if $z$ is instead any real number the formula converges accurately. Why does the formula not converge to any complex $z$, and how can I fix it so that it does?










share|cite|improve this question











$endgroup$








  • 4




    $begingroup$
    It's almost certainly a problem with the branching of the complex log.
    $endgroup$
    – Randall
    Dec 2 '18 at 20:03










  • $begingroup$
    yes it means that b has to be less that 3 and greater than -3 to converge towards $e^z$
    $endgroup$
    – user10560552
    Dec 2 '18 at 20:03










  • $begingroup$
    Randall can you go more into detail about the branching of the complex log?
    $endgroup$
    – user10560552
    Dec 2 '18 at 20:06






  • 1




    $begingroup$
    Not really, because it's been 20 years since I thought about this stuff intimately. You need someone with a better answer, who will certainly be along shortly. But, the complex exponential is not one-to-one, so what do you mean by "$ln z$"?
    $endgroup$
    – Randall
    Dec 2 '18 at 20:08












  • $begingroup$
    The complex logarithm is $ln(z)$ and I know that $ln(z)$ is multivalued, along with $e^z$ like the trigonometric functions however, the formula should still be able to evaluate over all complex numbers right?
    $endgroup$
    – user10560552
    Dec 2 '18 at 20:13
















6












$begingroup$


I am trying to calculate $exp z$ using $ln z$ via Newton-Raphson method $$x_{n+1} = x_n-frac{f(x_n)}{f^{'}(x_n)}$$and got the formula $$x_{n+1}=x_n-frac{ln x_n-z}{frac{1}{x_n}}$$ where $z = a + bi$ is the value i'm trying to iterate to. However this formula only converges when $-3< b < 3$. But, if $z$ is instead any real number the formula converges accurately. Why does the formula not converge to any complex $z$, and how can I fix it so that it does?










share|cite|improve this question











$endgroup$








  • 4




    $begingroup$
    It's almost certainly a problem with the branching of the complex log.
    $endgroup$
    – Randall
    Dec 2 '18 at 20:03










  • $begingroup$
    yes it means that b has to be less that 3 and greater than -3 to converge towards $e^z$
    $endgroup$
    – user10560552
    Dec 2 '18 at 20:03










  • $begingroup$
    Randall can you go more into detail about the branching of the complex log?
    $endgroup$
    – user10560552
    Dec 2 '18 at 20:06






  • 1




    $begingroup$
    Not really, because it's been 20 years since I thought about this stuff intimately. You need someone with a better answer, who will certainly be along shortly. But, the complex exponential is not one-to-one, so what do you mean by "$ln z$"?
    $endgroup$
    – Randall
    Dec 2 '18 at 20:08












  • $begingroup$
    The complex logarithm is $ln(z)$ and I know that $ln(z)$ is multivalued, along with $e^z$ like the trigonometric functions however, the formula should still be able to evaluate over all complex numbers right?
    $endgroup$
    – user10560552
    Dec 2 '18 at 20:13














6












6








6


3



$begingroup$


I am trying to calculate $exp z$ using $ln z$ via Newton-Raphson method $$x_{n+1} = x_n-frac{f(x_n)}{f^{'}(x_n)}$$and got the formula $$x_{n+1}=x_n-frac{ln x_n-z}{frac{1}{x_n}}$$ where $z = a + bi$ is the value i'm trying to iterate to. However this formula only converges when $-3< b < 3$. But, if $z$ is instead any real number the formula converges accurately. Why does the formula not converge to any complex $z$, and how can I fix it so that it does?










share|cite|improve this question











$endgroup$




I am trying to calculate $exp z$ using $ln z$ via Newton-Raphson method $$x_{n+1} = x_n-frac{f(x_n)}{f^{'}(x_n)}$$and got the formula $$x_{n+1}=x_n-frac{ln x_n-z}{frac{1}{x_n}}$$ where $z = a + bi$ is the value i'm trying to iterate to. However this formula only converges when $-3< b < 3$. But, if $z$ is instead any real number the formula converges accurately. Why does the formula not converge to any complex $z$, and how can I fix it so that it does?







complex-numbers numerical-methods exponential-function recursive-algorithms newton-raphson






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Dec 2 '18 at 20:27









J.G.

27.2k22843




27.2k22843










asked Dec 2 '18 at 19:53









user10560552user10560552

355




355








  • 4




    $begingroup$
    It's almost certainly a problem with the branching of the complex log.
    $endgroup$
    – Randall
    Dec 2 '18 at 20:03










  • $begingroup$
    yes it means that b has to be less that 3 and greater than -3 to converge towards $e^z$
    $endgroup$
    – user10560552
    Dec 2 '18 at 20:03










  • $begingroup$
    Randall can you go more into detail about the branching of the complex log?
    $endgroup$
    – user10560552
    Dec 2 '18 at 20:06






  • 1




    $begingroup$
    Not really, because it's been 20 years since I thought about this stuff intimately. You need someone with a better answer, who will certainly be along shortly. But, the complex exponential is not one-to-one, so what do you mean by "$ln z$"?
    $endgroup$
    – Randall
    Dec 2 '18 at 20:08












  • $begingroup$
    The complex logarithm is $ln(z)$ and I know that $ln(z)$ is multivalued, along with $e^z$ like the trigonometric functions however, the formula should still be able to evaluate over all complex numbers right?
    $endgroup$
    – user10560552
    Dec 2 '18 at 20:13














  • 4




    $begingroup$
    It's almost certainly a problem with the branching of the complex log.
    $endgroup$
    – Randall
    Dec 2 '18 at 20:03










  • $begingroup$
    yes it means that b has to be less that 3 and greater than -3 to converge towards $e^z$
    $endgroup$
    – user10560552
    Dec 2 '18 at 20:03










  • $begingroup$
    Randall can you go more into detail about the branching of the complex log?
    $endgroup$
    – user10560552
    Dec 2 '18 at 20:06






  • 1




    $begingroup$
    Not really, because it's been 20 years since I thought about this stuff intimately. You need someone with a better answer, who will certainly be along shortly. But, the complex exponential is not one-to-one, so what do you mean by "$ln z$"?
    $endgroup$
    – Randall
    Dec 2 '18 at 20:08












  • $begingroup$
    The complex logarithm is $ln(z)$ and I know that $ln(z)$ is multivalued, along with $e^z$ like the trigonometric functions however, the formula should still be able to evaluate over all complex numbers right?
    $endgroup$
    – user10560552
    Dec 2 '18 at 20:13








4




4




$begingroup$
It's almost certainly a problem with the branching of the complex log.
$endgroup$
– Randall
Dec 2 '18 at 20:03




$begingroup$
It's almost certainly a problem with the branching of the complex log.
$endgroup$
– Randall
Dec 2 '18 at 20:03












$begingroup$
yes it means that b has to be less that 3 and greater than -3 to converge towards $e^z$
$endgroup$
– user10560552
Dec 2 '18 at 20:03




$begingroup$
yes it means that b has to be less that 3 and greater than -3 to converge towards $e^z$
$endgroup$
– user10560552
Dec 2 '18 at 20:03












$begingroup$
Randall can you go more into detail about the branching of the complex log?
$endgroup$
– user10560552
Dec 2 '18 at 20:06




$begingroup$
Randall can you go more into detail about the branching of the complex log?
$endgroup$
– user10560552
Dec 2 '18 at 20:06




1




1




$begingroup$
Not really, because it's been 20 years since I thought about this stuff intimately. You need someone with a better answer, who will certainly be along shortly. But, the complex exponential is not one-to-one, so what do you mean by "$ln z$"?
$endgroup$
– Randall
Dec 2 '18 at 20:08






$begingroup$
Not really, because it's been 20 years since I thought about this stuff intimately. You need someone with a better answer, who will certainly be along shortly. But, the complex exponential is not one-to-one, so what do you mean by "$ln z$"?
$endgroup$
– Randall
Dec 2 '18 at 20:08














$begingroup$
The complex logarithm is $ln(z)$ and I know that $ln(z)$ is multivalued, along with $e^z$ like the trigonometric functions however, the formula should still be able to evaluate over all complex numbers right?
$endgroup$
– user10560552
Dec 2 '18 at 20:13




$begingroup$
The complex logarithm is $ln(z)$ and I know that $ln(z)$ is multivalued, along with $e^z$ like the trigonometric functions however, the formula should still be able to evaluate over all complex numbers right?
$endgroup$
– user10560552
Dec 2 '18 at 20:13










1 Answer
1






active

oldest

votes


















3












$begingroup$

The complex, principal logarithm $text{Log}(z)$ is defined by
$$
text{Log}(z) = ln|z| + i text{Arg}(z),
$$

where $text{Arg}$ stands for the principal argument of $z$ - that is $text{Arg}(z)$ represents the angle that $z$ makes against the positive real axis when viewed in polar form. By the principal argument, we mean that
$$-pi < text{Arg}(z) leq pi.$$
As a result, $text{Log}(w) = z$ has no solution if $|text{Im}(z)|>pi$ so you cannot to expect to use that formulation to compute $e^z$.



To fix this, you can define your own branch of the logarithm with the appropriate value of it's imaginary part. For example, since
12 is between $3pi$ and $5pi$, you can define your logarithm by
$$
text{LOG}(z) = ln|z| + i (text{Arg}(z) + 4pi).
$$

Here's a simple implementation in Sage..






share|cite|improve this answer









$endgroup$









  • 1




    $begingroup$
    Thanks, that makes a lot of sense, it's like how arccosine needs to have a domain restriction, because otherwise it wouldn't be a function.
    $endgroup$
    – user10560552
    Dec 3 '18 at 1:06






  • 1




    $begingroup$
    That's exactly right. The complex exponential is periodic with period $2pi i$ so you can define a branch of the logarithm whose range lies in a strip of height $2pi$.
    $endgroup$
    – Mark McClure
    Dec 3 '18 at 1:20










  • $begingroup$
    Just wondering why did you choose $4pi$ wouldn't $5pi$ also work?
    $endgroup$
    – user10560552
    Dec 3 '18 at 1:40






  • 1




    $begingroup$
    We know that $-pi<Arg(z)leq pi$ so I added on two periods of $2pi i$ each to get $3pi < Arg(z)leq 5pi$ which works since 12 is between these numbers. More generally, you want to add on some integer multiple of the period $2pi i$ so i wouldn't expect $+5pi$ to work.
    $endgroup$
    – Mark McClure
    Dec 3 '18 at 2:03













Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3023103%2fwhy-does-calculating-exp-z-using-ln-z-via-newton-raphson-method-fail-to-co%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3












$begingroup$

The complex, principal logarithm $text{Log}(z)$ is defined by
$$
text{Log}(z) = ln|z| + i text{Arg}(z),
$$

where $text{Arg}$ stands for the principal argument of $z$ - that is $text{Arg}(z)$ represents the angle that $z$ makes against the positive real axis when viewed in polar form. By the principal argument, we mean that
$$-pi < text{Arg}(z) leq pi.$$
As a result, $text{Log}(w) = z$ has no solution if $|text{Im}(z)|>pi$ so you cannot to expect to use that formulation to compute $e^z$.



To fix this, you can define your own branch of the logarithm with the appropriate value of it's imaginary part. For example, since
12 is between $3pi$ and $5pi$, you can define your logarithm by
$$
text{LOG}(z) = ln|z| + i (text{Arg}(z) + 4pi).
$$

Here's a simple implementation in Sage..






share|cite|improve this answer









$endgroup$









  • 1




    $begingroup$
    Thanks, that makes a lot of sense, it's like how arccosine needs to have a domain restriction, because otherwise it wouldn't be a function.
    $endgroup$
    – user10560552
    Dec 3 '18 at 1:06






  • 1




    $begingroup$
    That's exactly right. The complex exponential is periodic with period $2pi i$ so you can define a branch of the logarithm whose range lies in a strip of height $2pi$.
    $endgroup$
    – Mark McClure
    Dec 3 '18 at 1:20










  • $begingroup$
    Just wondering why did you choose $4pi$ wouldn't $5pi$ also work?
    $endgroup$
    – user10560552
    Dec 3 '18 at 1:40






  • 1




    $begingroup$
    We know that $-pi<Arg(z)leq pi$ so I added on two periods of $2pi i$ each to get $3pi < Arg(z)leq 5pi$ which works since 12 is between these numbers. More generally, you want to add on some integer multiple of the period $2pi i$ so i wouldn't expect $+5pi$ to work.
    $endgroup$
    – Mark McClure
    Dec 3 '18 at 2:03


















3












$begingroup$

The complex, principal logarithm $text{Log}(z)$ is defined by
$$
text{Log}(z) = ln|z| + i text{Arg}(z),
$$

where $text{Arg}$ stands for the principal argument of $z$ - that is $text{Arg}(z)$ represents the angle that $z$ makes against the positive real axis when viewed in polar form. By the principal argument, we mean that
$$-pi < text{Arg}(z) leq pi.$$
As a result, $text{Log}(w) = z$ has no solution if $|text{Im}(z)|>pi$ so you cannot to expect to use that formulation to compute $e^z$.



To fix this, you can define your own branch of the logarithm with the appropriate value of it's imaginary part. For example, since
12 is between $3pi$ and $5pi$, you can define your logarithm by
$$
text{LOG}(z) = ln|z| + i (text{Arg}(z) + 4pi).
$$

Here's a simple implementation in Sage..






share|cite|improve this answer









$endgroup$









  • 1




    $begingroup$
    Thanks, that makes a lot of sense, it's like how arccosine needs to have a domain restriction, because otherwise it wouldn't be a function.
    $endgroup$
    – user10560552
    Dec 3 '18 at 1:06






  • 1




    $begingroup$
    That's exactly right. The complex exponential is periodic with period $2pi i$ so you can define a branch of the logarithm whose range lies in a strip of height $2pi$.
    $endgroup$
    – Mark McClure
    Dec 3 '18 at 1:20










  • $begingroup$
    Just wondering why did you choose $4pi$ wouldn't $5pi$ also work?
    $endgroup$
    – user10560552
    Dec 3 '18 at 1:40






  • 1




    $begingroup$
    We know that $-pi<Arg(z)leq pi$ so I added on two periods of $2pi i$ each to get $3pi < Arg(z)leq 5pi$ which works since 12 is between these numbers. More generally, you want to add on some integer multiple of the period $2pi i$ so i wouldn't expect $+5pi$ to work.
    $endgroup$
    – Mark McClure
    Dec 3 '18 at 2:03
















3












3








3





$begingroup$

The complex, principal logarithm $text{Log}(z)$ is defined by
$$
text{Log}(z) = ln|z| + i text{Arg}(z),
$$

where $text{Arg}$ stands for the principal argument of $z$ - that is $text{Arg}(z)$ represents the angle that $z$ makes against the positive real axis when viewed in polar form. By the principal argument, we mean that
$$-pi < text{Arg}(z) leq pi.$$
As a result, $text{Log}(w) = z$ has no solution if $|text{Im}(z)|>pi$ so you cannot to expect to use that formulation to compute $e^z$.



To fix this, you can define your own branch of the logarithm with the appropriate value of it's imaginary part. For example, since
12 is between $3pi$ and $5pi$, you can define your logarithm by
$$
text{LOG}(z) = ln|z| + i (text{Arg}(z) + 4pi).
$$

Here's a simple implementation in Sage..






share|cite|improve this answer









$endgroup$



The complex, principal logarithm $text{Log}(z)$ is defined by
$$
text{Log}(z) = ln|z| + i text{Arg}(z),
$$

where $text{Arg}$ stands for the principal argument of $z$ - that is $text{Arg}(z)$ represents the angle that $z$ makes against the positive real axis when viewed in polar form. By the principal argument, we mean that
$$-pi < text{Arg}(z) leq pi.$$
As a result, $text{Log}(w) = z$ has no solution if $|text{Im}(z)|>pi$ so you cannot to expect to use that formulation to compute $e^z$.



To fix this, you can define your own branch of the logarithm with the appropriate value of it's imaginary part. For example, since
12 is between $3pi$ and $5pi$, you can define your logarithm by
$$
text{LOG}(z) = ln|z| + i (text{Arg}(z) + 4pi).
$$

Here's a simple implementation in Sage..







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered Dec 2 '18 at 22:18









Mark McClureMark McClure

23.6k34471




23.6k34471








  • 1




    $begingroup$
    Thanks, that makes a lot of sense, it's like how arccosine needs to have a domain restriction, because otherwise it wouldn't be a function.
    $endgroup$
    – user10560552
    Dec 3 '18 at 1:06






  • 1




    $begingroup$
    That's exactly right. The complex exponential is periodic with period $2pi i$ so you can define a branch of the logarithm whose range lies in a strip of height $2pi$.
    $endgroup$
    – Mark McClure
    Dec 3 '18 at 1:20










  • $begingroup$
    Just wondering why did you choose $4pi$ wouldn't $5pi$ also work?
    $endgroup$
    – user10560552
    Dec 3 '18 at 1:40






  • 1




    $begingroup$
    We know that $-pi<Arg(z)leq pi$ so I added on two periods of $2pi i$ each to get $3pi < Arg(z)leq 5pi$ which works since 12 is between these numbers. More generally, you want to add on some integer multiple of the period $2pi i$ so i wouldn't expect $+5pi$ to work.
    $endgroup$
    – Mark McClure
    Dec 3 '18 at 2:03
















  • 1




    $begingroup$
    Thanks, that makes a lot of sense, it's like how arccosine needs to have a domain restriction, because otherwise it wouldn't be a function.
    $endgroup$
    – user10560552
    Dec 3 '18 at 1:06






  • 1




    $begingroup$
    That's exactly right. The complex exponential is periodic with period $2pi i$ so you can define a branch of the logarithm whose range lies in a strip of height $2pi$.
    $endgroup$
    – Mark McClure
    Dec 3 '18 at 1:20










  • $begingroup$
    Just wondering why did you choose $4pi$ wouldn't $5pi$ also work?
    $endgroup$
    – user10560552
    Dec 3 '18 at 1:40






  • 1




    $begingroup$
    We know that $-pi<Arg(z)leq pi$ so I added on two periods of $2pi i$ each to get $3pi < Arg(z)leq 5pi$ which works since 12 is between these numbers. More generally, you want to add on some integer multiple of the period $2pi i$ so i wouldn't expect $+5pi$ to work.
    $endgroup$
    – Mark McClure
    Dec 3 '18 at 2:03










1




1




$begingroup$
Thanks, that makes a lot of sense, it's like how arccosine needs to have a domain restriction, because otherwise it wouldn't be a function.
$endgroup$
– user10560552
Dec 3 '18 at 1:06




$begingroup$
Thanks, that makes a lot of sense, it's like how arccosine needs to have a domain restriction, because otherwise it wouldn't be a function.
$endgroup$
– user10560552
Dec 3 '18 at 1:06




1




1




$begingroup$
That's exactly right. The complex exponential is periodic with period $2pi i$ so you can define a branch of the logarithm whose range lies in a strip of height $2pi$.
$endgroup$
– Mark McClure
Dec 3 '18 at 1:20




$begingroup$
That's exactly right. The complex exponential is periodic with period $2pi i$ so you can define a branch of the logarithm whose range lies in a strip of height $2pi$.
$endgroup$
– Mark McClure
Dec 3 '18 at 1:20












$begingroup$
Just wondering why did you choose $4pi$ wouldn't $5pi$ also work?
$endgroup$
– user10560552
Dec 3 '18 at 1:40




$begingroup$
Just wondering why did you choose $4pi$ wouldn't $5pi$ also work?
$endgroup$
– user10560552
Dec 3 '18 at 1:40




1




1




$begingroup$
We know that $-pi<Arg(z)leq pi$ so I added on two periods of $2pi i$ each to get $3pi < Arg(z)leq 5pi$ which works since 12 is between these numbers. More generally, you want to add on some integer multiple of the period $2pi i$ so i wouldn't expect $+5pi$ to work.
$endgroup$
– Mark McClure
Dec 3 '18 at 2:03






$begingroup$
We know that $-pi<Arg(z)leq pi$ so I added on two periods of $2pi i$ each to get $3pi < Arg(z)leq 5pi$ which works since 12 is between these numbers. More generally, you want to add on some integer multiple of the period $2pi i$ so i wouldn't expect $+5pi$ to work.
$endgroup$
– Mark McClure
Dec 3 '18 at 2:03




















draft saved

draft discarded




















































Thanks for contributing an answer to Mathematics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3023103%2fwhy-does-calculating-exp-z-using-ln-z-via-newton-raphson-method-fail-to-co%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to change which sound is reproduced for terminal bell?

Can I use Tabulator js library in my java Spring + Thymeleaf project?

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents