This program will find the area of a circle without pi!

Pages: 1234
@naraku, are you aware that ei*pi = -1? It's a complex logarithm.
It doesn't actually work that nicely, but I wouldn't want to kill the cuteness of it by explaining why...

@LB, this whole problem is nothing but an approximation of pi. Are you aware that one of the best approximation algorithms for pi actually returns 1/pi, i.e. a result much further from pi than what this program is supposed to do?
Last edited on
@hamsterman my point is that it is possible to approximate area of a circle without in your calculation using an approximation of PI. That means that at no time should an approximation of PI be in memory and be multiplied by the square of the radius. That includes 1/PI and other nonsensical things that have PI in them.
@LB, my point is that there is no such thing as approximating area of a circle without approximating pi. I can define pi as area of unit circle. What you actually want is an algorithm that calculates pi in a geometric and intuitive way. But for all you know, something like ln(-1)/i might have a sensible geometric interpretation.
I don't know what you're even talking about now, the title of this topic is about finding the area of a circle without using PI in the process. Sure, you can say that if we approximate the area of the unit circle we've approximated PI as a result, but that doesn't mean you used an approximation of PI to get the approximation of the unit circle in the fist place. Am I wrong?
hamsterman wrote:
@naraku, are you aware that ei*pi = -1? It's a complex logarithm.
It doesn't actually work that nicely, but I wouldn't want to kill the cuteness of it by explaining why...
No, I wasn't aware of it, I found some information online that somewhat explained it. I haven't done anything with imaginary numbers since algebra.
They don't even teach complex numbers in school, just imaginary. And yet they teach vectors in calculus.
They taught complex numbers in my high school algebra II class.
We did imaginary numbers in Algebra II, the form a+bi was never mentioned.
Last edited on
2∫-rr√(r2-x2) dx

OK, I can see how this can be considered as calculating PI and multiplying it by the radius squared because of how you can factor out the whole radius squared thing - but, when you approximate the integral by adding up small rectangles, you are, at no point, ever using PI. I guess that doesn't make the line very clear, though. In fact, I'm not even sure I believe myself.
Last edited on
closed account (D80DSL3A)
Note: Four different fully coded methods for finding the value of that integral were given in page 1 of this thread. Evaluate it for r=1 and you get PI.

Side note. Complex variable methods give powerful results!
For example, Eulers identity: ei*x = cos(x) + i*sin(x) is my goto method for deriving trig. identities.
Last edited on
Why not just use Euler's identity: A = (ln(-1)/i)r^2?


chrisname, the complex logarithm is written as log, not as ln. Also, when you use the complex logarithm, you need to specify which ``analytic branch'' are you using. Since e^{2\pi i }=1, defining
log (-1) := \pi i
is just as good as defining
log (-1):= - \pi i.
and as good as defining
log(-1):=3 \pi i

The notation ln x implies that x is a real positive number.
Last edited on
Ugh...i hate math...
Kaleb wrote:
Ugh...i hate math...
Sacrilege.
Kaleb wrote:
Ugh...i hate math...

what do you hate about it? I mean programming uses a lot of math and logic. Its like if you said you were learning to be an author but hated grammar...
Why do we Americans say "Math" when it is short for "Mathematics"? In other countries, they say "Maths"...
That's a good question. I say math, and when I see "maths" it just looks awkward to me.
LB wrote:
Why do we Americans say "Math" when it is short for "Mathematics"? In other countries, they say "Maths"...

I'm not American and I say Math

"Maths" sounds funny...
Last edited on
Because math is short for mathematics, maths (IMO) is short for mathematics's. Maths just sounds weird to me, but it's idiomatic so not worth arguing about.
Yeah, for me, "Math" is one of those words that looks plural already.
Pages: 1234