Group Abstract Group Abstract

Message Boards Message Boards

0
|
2.6K Views
|
2 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Help with subscripts: computing Salamin and brent equation?

Posted 4 years ago

The equation Hey guys, I am trying to learn Mathematica and am attempting to compute pi using the Salamin and Brent equation. (Pic attached). The thing is, this equation is very different from the ones I attempted before as it doesn't have a typical summation.

To start this, I attempted to define a[0] = 1 and b[0]=1/sqrt[2] etc.However, this doesn't seem right as the letters turn green and I'm not able to assign that particular value to the aforementioned variables.

However, since I'm new to this kind of computing, I am just unsure about how to approach computing a sum like this. What are some codes I need to learn in order to be able to do this? I am blank as to how I must code these series and require guidance for where I can look at to learn how to code such formulae. Thank you very much!

2 Replies
Posted 4 years ago

Compare this, character by character, with what you did

a[0]=1;b[0]=1/Sqrt[2];s[0]=1/2;
a[k_]:=(a[k-1]+b[k-1])/2;
b[k_]:=Sqrt[a[k-1]*b[k-1]];
c[k_]:=a[k]^2-b[k]^2;
s[k_]:=s[k-1]-2^k*c[k];
p[k_]:=2*a[k]^2/s[k];
N[p[10],32]

For every character that is different study the documentation and track down exactly what that difference means. Doing that will help you learn far more about how to use this.

POSTED BY: Bill Nelson
Posted 4 years ago

Crossposted here.

POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard