Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#26 This is Cool » a program that searches for values of pi » 2006-01-28 07:03:50

se7en
Replies: 17

You must surely have heard that 22/7 is approximately equal to pi. Well, I have found a much better value that approximates pi... 355/113. 355/113 gives 3.14159292 and pi = 3.14159265. 22/7 only gives you 3.142857143, which is obviously way off. I found this by writing a program that searches for values that give something close to pi, and this is what I came up with. I'm quite stoked. smile Here's the Qbasic code for the program:



'program that searches for values of pi

DEFINT A-Z
CLS

FOR x = 1 TO 1000
  FOR y = 1 TO 1000
    n& = x / y * 100000
    IF n& = 314159 THEN
      PRINT x; "/"; y; "="; x / y; "   ...press a key"
      DO: LOOP WHILE INKEY$ = ""
    END IF
  NEXT
NEXT



Here's the same thing but in C++...


//program that searches for values of pi
#include <iostream>
using namespace std;

int main() {
    float m;
    int n;
    for (float x = 1; x <= 1000; x++) {
        for (float y = 1; y <= 1000; y++) {
            m = x / y * 100000;
            n = int(m);
            if (n == 314159) {
                cout << x << " / " << y << " = " << x / y << "   ...press enter" << endl;
                cin.get();
            }
        }
    }
    return 0;
}

#27 Help Me ! » exponential equations » 2005-12-25 08:41:40

se7en
Replies: 2

In a book I'm reading an exponential equation is defined as an equation containing terms of the form a^x (a to the power of x), where x is a real number, a is a real number, a > 0 and a is not equal to 1.

Now I understand why the definition excludes a < 0 (there are many values of x for which a^x is undefined if a < 0, for example if a = -2 and x = 1/2, a^x = (-2)^1/2 = sqrt(-2) which is undefined.)

But I can't understand why the definition excludes a = 0 and a = 1. The following reasons are given in the book (which I don't understand... reasons are given).

If a = 0 then a^x becomes 0^x. This is equal to the constant 0 for all x except x = 0. It is undefined for x = 0. Thus when a = 0, a^x reduces to a constant or is undefined.

Reason why I don't understand the above: Even if a = 0 in a^x = a^y, surely x still equals y.

If a = 1, then a^x = 1^x = 1 for all real values of x. In this case a^x reduces to the constant 1.

Reason why I don't understand the above: Again, even if a = 1 in a^x = a^y, surely x still equals y.

Now I have an idea of my own on why a = 0 and a = 1 are excluded in the definition and I would appreciate your input on the idea. My idea is that if a = 0 or a = 1 the equation is true for all values of x.

#28 Jokes » joke about pi » 2005-12-25 08:11:45

se7en
Replies: 17

Back in the good old US of A there exists a small group of poor farmers and labourers known as
"Hillbillies". Having pinched and saved for several years, one Hillbilly family finally managed
to send its eldest son off to University to make something of himself. At the end of his first
year, the son proudly returned home, intent on displaying his new-found knowledge.

"Well son, tell us'n what great things y'all larned at that thar ooniversity." requested the
father. The son thought for a few minutes, and then thought for a few minutes more. Finally, in
a brilliant display of mathematical fortitude, he said "pi r^2".

The father looked at his son for several minutes in shocked amazement, sadly shaking his head.
"Why son", he said, "everybody knows that pie are round - cornbread's squared".

Board footer

Powered by FluxBB