ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 01 May 2016 23:05:03 +0200Unexpected Answer for an Equationhttps://ask.sagemath.org/question/33254/unexpected-answer-for-an-equation/ Hello,
I am trying to calculate the following equation in SAGE.
N = 100.
p = 0.9.
r = (N /(N-1))*(ln(N)-ln(-ln(p))); r
Unfortunately, sage gives this answer **100/99*log(100) + 2.27309831041661** , which is not the expected answer !!
But, when I used google calculator, I got the expected answer, which is **6.92478536697**
Please let me know what is going on.? Thank you. Thu, 28 Apr 2016 20:52:10 +0200https://ask.sagemath.org/question/33254/unexpected-answer-for-an-equation/Comment by B r u n o for <p>Hello, </p>
<p>I am trying to calculate the following equation in SAGE.</p>
<p>N = 100.</p>
<p>p = 0.9.</p>
<p>r = (N /(N-1))*(ln(N)-ln(-ln(p))); r </p>
<p>Unfortunately, sage gives this answer <strong>100/99*log(100) + 2.27309831041661</strong> , which is not the expected answer !!</p>
<p>But, when I used google calculator, I got the expected answer, which is <strong>6.92478536697</strong></p>
<p>Please let me know what is going on.? Thank you. </p>
https://ask.sagemath.org/question/33254/unexpected-answer-for-an-equation/?comment=33258#post-id-33258To add to the answer below, note that if you enter `N` as a floating-point number, you directly get what you want:
sage: N = 100. # Note the '.' after '100'
sage: p = 0.9
sage: r = (N /(N-1))*(ln(N)-ln(-ln(p))); r
6.92478536697024Fri, 29 Apr 2016 14:47:37 +0200https://ask.sagemath.org/question/33254/unexpected-answer-for-an-equation/?comment=33258#post-id-33258Comment by usamrf for <p>Hello, </p>
<p>I am trying to calculate the following equation in SAGE.</p>
<p>N = 100.</p>
<p>p = 0.9.</p>
<p>r = (N /(N-1))*(ln(N)-ln(-ln(p))); r </p>
<p>Unfortunately, sage gives this answer <strong>100/99*log(100) + 2.27309831041661</strong> , which is not the expected answer !!</p>
<p>But, when I used google calculator, I got the expected answer, which is <strong>6.92478536697</strong></p>
<p>Please let me know what is going on.? Thank you. </p>
https://ask.sagemath.org/question/33254/unexpected-answer-for-an-equation/?comment=33282#post-id-33282Thank you Bruno.Sun, 01 May 2016 23:05:03 +0200https://ask.sagemath.org/question/33254/unexpected-answer-for-an-equation/?comment=33282#post-id-33282Answer by calc314 for <p>Hello, </p>
<p>I am trying to calculate the following equation in SAGE.</p>
<p>N = 100.</p>
<p>p = 0.9.</p>
<p>r = (N /(N-1))*(ln(N)-ln(-ln(p))); r </p>
<p>Unfortunately, sage gives this answer <strong>100/99*log(100) + 2.27309831041661</strong> , which is not the expected answer !!</p>
<p>But, when I used google calculator, I got the expected answer, which is <strong>6.92478536697</strong></p>
<p>Please let me know what is going on.? Thank you. </p>
https://ask.sagemath.org/question/33254/unexpected-answer-for-an-equation/?answer=33255#post-id-33255These have the same value. If you do `r.n()`, you will see that the answer Sage gives is equal to 6.92478536697.Thu, 28 Apr 2016 22:37:15 +0200https://ask.sagemath.org/question/33254/unexpected-answer-for-an-equation/?answer=33255#post-id-33255Comment by usamrf for <p>These have the same value. If you do <code>r.n()</code>, you will see that the answer Sage gives is equal to 6.92478536697.</p>
https://ask.sagemath.org/question/33254/unexpected-answer-for-an-equation/?comment=33281#post-id-33281Thank you.Sun, 01 May 2016 23:04:18 +0200https://ask.sagemath.org/question/33254/unexpected-answer-for-an-equation/?comment=33281#post-id-33281