Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   ABC Theory (https://forums.graalonline.com/forums/showthread.php?t=70448)

contiga 11-28-2006 12:31 PM

ABC Theory
 
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

PHP Code:

function onCreated() {
  
= - 33.5;
  
1.5;
  
4;
  
/* Don't edit below here */
  
xr "";
  
= ( 2) - c;
  if ( 
NULL) {
    for ( try: { 
"-""+"}) {
      if ( try = 
"-")
        
xr = ( - - ( 0.5)) / ( a);
      else if ( try = 
"+")
        
xr @= " or " @ ( - + ( 0.5)) / ( a);
    }
  }
  else if ( 
NULL) {
    
xr = - / ( 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

Quote:

Originally Posted by contiga (Post 1248151)
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

Quote:

Originally Posted by Loriel (Post 1248175)
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

Quote:

Originally Posted by WanDaMan (Post 1248190)
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

Quote:

Originally Posted by Loriel (Post 1248198)
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

Quote:

Originally Posted by excaliber7388 (Post 1248208)
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

Quote:

Originally Posted by Galdor (Post 1248442)
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...a3bb558916.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

Quote:

Originally Posted by SayianOozaru (Post 1248628)
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

Quote:

Originally Posted by Gambet (Post 1248618)
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

Quote:

Originally Posted by coreys (Post 1248607)
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

Quote:

Originally Posted by contiga (Post 1248733)
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

Quote:

Originally Posted by coreys (Post 1248657)
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

Quote:

Originally Posted by coreys (Post 1248755)
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

Quote:

Originally Posted by contiga (Post 1249077)
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 ;[)


All times are GMT +2. The time now is 10:17 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.