ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 01 May 2016 16:05:03 -0500Unexpected Answer for an Equationhttp://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 13:52:10 -0500http://ask.sagemath.org/question/33254/unexpected-answer-for-an-equation/Comment 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>
http://ask.sagemath.org/question/33254/unexpected-answer-for-an-equation/?comment=33282#post-id-33282Thank you Bruno.Sun, 01 May 2016 16:05:03 -0500http://ask.sagemath.org/question/33254/unexpected-answer-for-an-equation/?comment=33282#post-id-33282Comment 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>
http://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 07:47:37 -0500http://ask.sagemath.org/question/33254/unexpected-answer-for-an-equation/?comment=33258#post-id-33258Answer 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>
http://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 15:37:15 -0500http://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>
http://ask.sagemath.org/question/33254/unexpected-answer-for-an-equation/?comment=33281#post-id-33281Thank you.Sun, 01 May 2016 16:04:18 -0500http://ask.sagemath.org/question/33254/unexpected-answer-for-an-equation/?comment=33281#post-id-33281