PDA

View Full Version : ABC Theory


contiga
11-28-2006, 12:31 PM
I just made a simple workout for the ABC theory, example:

You have the formule: 2x + 3 = 0
You can work this out like.. -3 on both sides, so 2x = - 3
You do it all / 2, and you'll have x = - 1.5... but now
You've got this formule: -33.5x + 1.5x + 4 = 0, how are we going to do this?
Fill in for;
a: -33.5
b: 1.5
c: 4


function onCreated() {
a = - 33.5;
b = 1.5;
c = 4;
/* Don't edit below here */
xr = "";
D = ( b ^ 2) - 4 * a * c;
if ( D > NULL) {
for ( try: { "-", "+"}) {
if ( try = "-")
xr = ( - b - ( D ^ 0.5)) / ( 2 * a);
else if ( try = "+")
xr @= " or " @ ( - b + ( D ^ 0.5)) / ( 2 * a);
}
}
else if ( D = NULL) {
xr = - b / ( 2 * a);
}
else
xr = "No solutions!";
echo( "Result: " @ xr);
}



And as you see, the result will be (for 'x' in the formule);
Result: 0.368659933 or -0.323883813

You don't realy have anything that you can use it for in Graal, but whatever, wanted to work it out in a script ;)

Twinny
11-28-2006, 02:37 PM
Ahhh mathematics!! Algebra!!

*melts*

coreys
11-28-2006, 03:52 PM
Yes, quadratic formula...I made a program for that on my calculator a few months ago. Cause we were doing it in my Algebra 2 class at the time. I still have it in there, but because I have no clue how to use if statements in its crazy scripting language, it won't work when (b^2-4(a)(c)) is a negative number.

Anyways, a simple, but I suppose useful script.

It is possible to use it with non-real numbers though, if you just do it in terms of i.

contiga
11-28-2006, 07:30 PM
Thanks ;p I thought, lets go for some rep++; by posting some scripts (I guess I'll do more later) ^^

Loriel
11-28-2006, 08:10 PM
Thanks ;p I thought, lets go for some rep++; by posting some scripts (I guess I'll do more later) ^^

If I figured out how I would give you --rep; for retarded style, and possibly for posting stupidly trivial graal-unrelated code snippets.

WanDaMan
11-28-2006, 08:42 PM
If I figured out how I would give you --rep; for retarded style, and possibly for posting stupidly trivial graal-unrelated code snippets.

Un-true; GScript, y0? :D

Loriel
11-28-2006, 08:54 PM
Un-true; GScript, y0? :D

So if I post a bunch of spam that is valid gscript syntax it is Graal-related?

contiga
11-28-2006, 09:01 PM
@ Loriel:
You know what.. go beg some Administrator for a "Un-Graal-Related Code Gallery", so I can post this "noncense" (in your eyes) in there.. everyone has his own style btw, don't complain. And it can be useful for people who don't get the ABC theory with maths, they perhaps can learn from it xP

excaliber7388
11-28-2006, 09:11 PM
So if I post a bunch of spam that is valid gscript syntax it is Graal-related?
It's gscript related ;)

xAndrewx
11-28-2006, 09:47 PM
It's gscript related ;)

It's not really relevant to graal though, that's what he is saying.

Gambet
11-28-2006, 09:56 PM
What? Why not just call it the quadratic formula x-x

contiga
11-29-2006, 09:32 AM
It's simple but effective, you can do your homework faster with it :D Haha
Like that you have more time for Graal ^^ How comes you don't see that connection? xP

PS. I just saw this:

Reputation
Your reputation on this post is Somewhat Negative.
Comments on this Post
I disapprove of posting generic math-related snippets just because they are implemented in gscript and also your style kind of sucks

Sad, haha. Because my style sucks is not a valid reason, I want my 3 points back ;)

Galdor
11-29-2006, 08:51 PM
Hello I'm galdor and I come from earth, nice to meet you all.
(point is that your aliens that somehow see some sence in that square of nonsense)

coreys
11-30-2006, 03:40 AM
Hello I'm galdor and I come from earth, nice to meet you all.
(point is that your aliens that somehow see some sence in that square of nonsense)

It's fairly basic algebra...fairly...

http://upload.wikimedia.org/math/3/e/a/3ea647783b5121989cd87ca3bb558916.png

And Contiga, use the wikipedia article, maybe it'll help you make it do it in terms of i when the discriminant is negative.

Gambet
11-30-2006, 04:03 AM
Yeah, um, I learned this back in the 9th grade. You're trying to make it sound a lot more complicated than it really is so that people could be all over you and compliment you, when really you've done nothing spectacular. It's simple math.

It's the quadratic formula, don't try to make it sound like it's anything else.

SayianOozaru
11-30-2006, 04:19 AM
lol.

im in 11th grade, and still haven't even seen that ****. lol.

Galdor
11-30-2006, 05:19 AM
lol.

im in 11th grade, and still haven't even seen that ****. lol.

maybe you didndt look hard enough? :p

coreys
11-30-2006, 05:27 AM
Yeah, um, I learned this back in the 9th grade. You're trying to make it sound a lot more complicated than it really is so that people could be all over you and compliment you, when really you've done nothing spectacular. It's simple math.

It's the quadratic formula, don't try to make it sound like it's anything else.

Me? O.o

If so, not really, I'm just suggesting something to Contiga...no need to see to far into things...

contiga
11-30-2006, 11:47 AM
And Contiga, use the wikipedia article, maybe it'll help you make it do it in terms of i when the discriminant is negative.

What do you mean with in terms of 'i'?

coreys
11-30-2006, 04:07 PM
What do you mean with in terms of 'i'?

Oh...I guess you haven't learned it yet.

Well...as I'm sure you know, you can't do a square root of a negative number and get a real number. But you can still represent it with i.

For example:
(-12)^.5

would be
i(12)^.5

Basically i is equal to (-1)^.5

Gambet
12-01-2006, 02:19 AM
Me? O.o

If so, not really, I'm just suggesting something to Contiga...no need to see to far into things...


No, not you, Contiga.

contiga
12-01-2006, 02:46 PM
Oh...I guess you haven't learned it yet.

Well...as I'm sure you know, you can't do a square root of a negative number and get a real number. But you can still represent it with i.

For example:
(-12)^.5

would be
i(12)^.5

Basically i is equal to (-1)^.5

Does GS2 read i as -1 tho?

coreys
12-01-2006, 04:01 PM
Does GS2 read i as -1 tho?

Well its not -1, its the square root of negative one. Thats why I did (-1)^.5. You would obviously have to make a variable. Or possibly just somehow work it into the output of the answer.

I'm not sure if it's possible to get it to work like that, but maybe. (Hey, if my TI-84 can do it, maybe it can be done in gs2 ;[)