Don't have an account? Register now to chat, post, use our tools, and much more.
This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

TI-Basic Brain Teasers => TI-BASIC
 » Goto page 1, 2  Next
Author Message
Flofloflo

Member

Joined: 07 Nov 2007
Posts: 120

 Posted: 12 Jan 2008 04:20:47 pm    Post subject: Hello, I was busy with Pi recently, and I came up with this formula to approach Pi: Quote: X/Tan(90-180/X) it's a formula that calculates the access (Used a translator for that word) of any polygon (again, translator). If you enter a big value (My calculator could only do it untill 10^14 or something like that, any higher couldn't do it because Tan90 doesn't exist) It approaches Pi Moved into a [­quote] to make the text more invisible. –Goose The thing is though, that my formula doesn't give any more then 9 decimals.... I gonna try some formula I once saw on Wikipedia soon =) But maybe somebody has orinigal idea's or something! So the brainteaser is: Make a program that approaches Pi in... say.... 100 decimals!Last edited by Guest on 12 Jan 2008 08:08:35 pm; edited 1 time in total
elfprince13
Retired

Super Elite (Last Title)

Joined: 11 Apr 2005
Posts: 3500

 Posted: 12 Jan 2008 04:30:16 pm    Post subject: the problem with that is that a trig function has a relationship with Pi anyway, which is kinda cheating. instead, try using your knowledge of geometry to approximate piLast edited by Guest on 12 Jan 2008 04:37:33 pm; edited 1 time in total
Flofloflo

Member

Joined: 07 Nov 2007
Posts: 120

 Posted: 12 Jan 2008 04:46:00 pm    Post subject: A trig function being Sin/Cos/Tan? Yeah, maybe your right.... But that makes it REALY difficult, but I'll think about it anyways. Maybe Pythagoras can help in this matter? Nah, he doesn't have anything to do with this.,... I think.,... I wanna do it without wikipedia...Last edited by Guest on 12 Jan 2008 04:51:07 pm; edited 1 time in total
TheStorm

Calc Guru

Joined: 17 Apr 2007
Posts: 1233

 Posted: 12 Jan 2008 07:07:04 pm    Post subject: I found a program that approaches pi but once it gets to about 5 decimals it is really freakin slow.
WikiGuru

Elite

Joined: 15 Sep 2005
Posts: 923

 Posted: 12 Jan 2008 07:19:53 pm    Post subject: yeah, I'm guessing it used a series... learned about that one in calculus :biggrin: Seriously, Series are extremely slow and take exponentially more iterations for each additional digit accuracy.
elfprince13
Retired

Super Elite (Last Title)

Joined: 11 Apr 2005
Posts: 3500

 Posted: 12 Jan 2008 08:44:26 pm    Post subject: Flofloflo wrote:A trig function being Sin/Cos/Tan? Yeah, maybe your right.... But that makes it REALY difficult, but I'll think about it anyways. Maybe Pythagoras can help in this matter? Nah, he doesn't have anything to do with this.,... I think.,... I wanna do it without wikipedia... [post="118721"]<{POST_SNAPBACK}>[/post] pythagoras, and some simple geometry + probability (or no probability for a more accurate, but slower approximation)Last edited by Guest on 12 Jan 2008 08:44:55 pm; edited 1 time in total
thornahawk
μολών λαβέ

Active Member

Joined: 27 Mar 2005
Posts: 569

 Posted: 12 Jan 2008 11:50:09 pm    Post subject: "Seriously, Series are extremely slow and take exponentially more iterations for each additional digit accuracy." - that is very much untrue; for certain series, they have the fastest convergence compared to other possible representations. Besides, one can use an acceleration algorithm sometimes. "Make a program that approaches Pi in... say.... 100 decimals!" - a tall order, for the TI calculator can only hold 14 digits. ...well, unless what you want to do is to output it as a digit-list. thornahawk
Pseudoprogrammer

Member

Joined: 12 Dec 2006
Posts: 121

 Posted: 13 Jan 2008 12:55:50 am    Post subject: 1 -> X DelVar AWhile 1 A+4(1/X -> X X+4 -> X A-4(1/X-2 -> X End Calc is out of batteries but i'm pretty sure thats it. Also, instead of 1/X, use X^-1 but use the -1 symbol thing. I left something similar running all night once I got around 7 or 8 decimal places accurate.Last edited by Guest on 13 Jan 2008 12:59:25 am; edited 1 time in total
Weregoose
Authentic INTJ

Super Elite (Last Title)

Joined: 25 Nov 2004
Posts: 3976

 Posted: 13 Jan 2008 03:20:56 am    Post subject: Pseudoprogrammer wrote:1 -> X DelVar AWhile 1 A+4(1/X -> X X+4 -> X A-4(1/X-2 -> X EndThat can be optimized to... 1→X While 1 4/X→X X+4→X 8-4/X→X End ...or... 1→X While 1 8-4/(4+(4/X→X End ...or... 1→X While 1 7+1/(X+1→X End ...or... 3+√(17 Find some batteries. :) This challenge has fallen flat on its face before (Teaser 21).Last edited by Guest on 30 Aug 2010 08:37:09 pm; edited 1 time in total
simonzack

Joined: 25 Dec 2007
Posts: 71

 Posted: 13 Jan 2008 06:05:52 am    Post subject: The geometry method (if just using Pythagoras) can't produce so many digits, but here's the formula sqrt(2-sqrt(2+sqrt(2+sqrt(2+... (I might have got the +s and -s wrong way round, cause I last did this ages ago ) Well, don't do the sqrts too much, or it'll get inaccurate I suggest doing the Tyler thing (but I think if you do it really accurate, like 100 digits, it's real slow) you can find it on wiki P.S. i think one is 6/(1/(1^2)+1/(2^2)+...)
Flofloflo

Member

Joined: 07 Nov 2007
Posts: 120

 Posted: 13 Jan 2008 06:09:32 am    Post subject: Ah, I see :lol: But a, this is REALY difficult, I've been making all these drawings of cirkles and triangles and other polygons, and tried to see some kind of logic in it, but I couldn't find anything! Or at least, I couldn't find anything that doesn't involve Sin Cos Tan...:( I remember this trick from Wikipedia, but without checking wikipedia I have no idea how it works and stuff, so I guess I am gonna ask wikipedia after all...
Weregoose
Authentic INTJ

Super Elite (Last Title)

Joined: 25 Nov 2004
Posts: 3976

 Posted: 13 Jan 2008 08:03:37 am    Post subject: When you say "make it approach [font="times new roman"]π in 100 decimals," do you mean have it calculate 14 correct digits in 100 iterations or less, or do you want us to compute [font="times new roman"]π to a hundred places? [EDIT] Per the former, I have the following: 8[font="times new roman"]×√(9450sum(cumSum(binomcdf(34,0))^-8 The 34 in that argument yields a 35-element list, which is the minimum length for snatching all 14 digits (Ans-[font="times new roman"]π = 0). This next one adds three bytes to reduce the number of calculations: 10[font="times new roman"]×√(93555sum(cumSum(binomcdf(14,0))^-10 That's 15 numbers generated in this list. Continuing the sequence (A100594) further at all presents accuracy issues. [EDIT×2] One requiring only 19 iterations: [indent].5 For(A,1,19 4‾¹(Ans+(1-√(1-Ans))² End 2^21√(Ans[/indent] Further optimizations sour the result—theoretically, .5(1-√(1-Ans should have worked. It doesn't.Last edited by Guest on 30 Aug 2010 08:36:22 pm; edited 1 time in total
thornahawk
μολών λαβέ

Active Member

Joined: 27 Mar 2005
Posts: 569

 Posted: 22 Jan 2008 02:16:49 am    Post subject: The Brent-Salamin formula and other related algorithms always struck me as nifty when computing π is a concern. thornahawk
WikiGuru

Elite

Joined: 15 Sep 2005
Posts: 923

 Posted: 22 Jan 2008 07:43:09 pm    Post subject: thornahawk wrote:- that is very much untrue; for certain series, they have the fastest convergence compared to other possible representations. Besides, one can use an acceleration algorithm sometimes. [post="118746"]<{POST_SNAPBACK}>[/post] Sorry, my mistake. The series that approximate sin, cos, tan, and pi all slowly converge I believe. At least I know pi's series does. Dang, it's been too long since i've worked with power seriesLast edited by Guest on 22 Jan 2008 07:43:25 pm; edited 1 time in total
DarkerLine
ceci n'est pas une |

Super Elite (Last Title)

Joined: 04 Nov 2003
Posts: 8328

 Posted: 22 Jan 2008 08:00:18 pm    Post subject: First of all, "series" and "power series" are fairly different things. It doesn't even make sense to talk about series being a slow way to approximate a number, because you could think about most methods in terms of series. Also, the sin and cos power series (don't know about the other ones) should be fairly fast, depending on what's fast for you, and certainly don't take exponentially more time for each additional digit. In fact, the error term for a series that includes powers less than xn is |xn|/n!. This decays faster than any exponential, so unless I'm making a huge mathematical mistake the additional number of terms needed should actually decrease with each additional digit you want (as long as you want enough digits).Last edited by Guest on 22 Jan 2008 08:01:13 pm; edited 1 time in total
stranger

Joined: 23 Jan 2008
Posts: 63

 Posted: 14 Feb 2008 09:17:48 pm    Post subject: Done, in 118 (whole program) :biggrin: Quote:Output(1,1,"3.14159265358979323846264338327950288419716939937510 5820974944592307816406286208998628034825342117067
JoostinOnline

Active Member

Joined: 22 Aug 2007
Posts: 559

 Posted: 14 Feb 2008 09:25:04 pm    Post subject: Quote:"3.14159265358979323846264338327950288419716939937510 5820974944592307816406286208998628034825342117067 Saved 5 bytes Last edited by Guest on 14 Feb 2008 09:34:30 pm; edited 1 time in total
Ph34r_my_l33t_skillz

Joined: 09 Oct 2007
Posts: 339

 Posted: 14 Feb 2008 09:25:55 pm    Post subject: Ahh... loophole. I should of thought of that... :) @Joostin: color didn't work. put it in a quote.Last edited by Guest on 14 Feb 2008 09:26:52 pm; edited 1 time in total
luby
I want to go back to Philmont!!

Calc Guru

Joined: 23 Apr 2006
Posts: 1477

 Posted: 14 Feb 2008 09:31:20 pm    Post subject: JoostinOnline wrote: Quote:3.14159265358979323846264338327950288419716939937510 5820974944592307816406286208998628034825342117067 Saved 6 bytes [post="120354"]<{POST_SNAPBACK}>[/post] Won't work. The Os will truncate it to 9 digits.
cjgone
Aw3s0m3

Active Member

Joined: 24 May 2006
Posts: 693

 Posted: 15 Feb 2008 02:01:25 am    Post subject: Is it possible to find the area of a 10e992323494934439 sided shape or some big number like that and calculate the circumference and diameter, then divide them? =\
 Display posts from previous: All Posts Oldest FirstNewest First
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

»
 » Goto page 1, 2  Next Page 1 of 2 » All times are GMT - 5 Hours