Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-19-2011, 03:29 AM
dabblercody dabblercody is offline
Tech Assistant
dabblercody's Avatar
Join Date: May 2006
Location: Florida
Posts: 22
dabblercody is on a distinguished road
Quadratic Formula

If anyone can figure out why this formula won't work on Graal.

http://en.wikipedia.org/wiki/Quadrat...dratic_formula


PHP Code:
//#CLIENTSIDE
function onPlayerChats()
{
 if (
player.chat == "/quad")
 {
  
Quad();
 }
}

function 
Quad()
{
 
temp.5;
 
temp.27;
 
temp.10;
 
temp.x1 = (-temp.+ ((temp.b*temp.b-4*temp.a*temp.c)^0.5))/2*temp.a;
 
temp.x2 = (-temp.- ((temp.b*temp.b-4*temp.a*temp.c)^0.5))/2*temp.a;
 
player.chat "Solution is:" SPC temp.x1 SPC temp.x2;

__________________
Dabbler

"Our work is the presentation of our capabilities."
- Goethe, Johann Wolfgang Von
Reply With Quote
  #2  
Old 01-19-2011, 03:39 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
All the information in your other thread is relevant to this one, the only difference is a change of parameters and the formula.

Supply a, b, c and x to calculate y.

y = a * x ^ 2 + b * x + c
__________________
Quote:
Reply With Quote
  #3  
Old 01-19-2011, 03:41 AM
dabblercody dabblercody is offline
Tech Assistant
dabblercody's Avatar
Join Date: May 2006
Location: Florida
Posts: 22
dabblercody is on a distinguished road
What would the x represent?
__________________
Dabbler

"Our work is the presentation of our capabilities."
- Goethe, Johann Wolfgang Von
Reply With Quote
  #4  
Old 01-19-2011, 03:44 AM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
Quote:
Originally Posted by dabblercody View Post
If anyone can figure out why this formula won't work on Graal.

http://en.wikipedia.org/wiki/Quadrat...dratic_formula
I'd just go through and separate everything with parenthesis and see if that works:
PHP Code:
temp.x1 = (-temp.+ ((temp.2) - (temp.temp.c)) ^ .5) / (temp.a
__________________
Reply With Quote
  #5  
Old 01-19-2011, 03:45 AM
dabblercody dabblercody is offline
Tech Assistant
dabblercody's Avatar
Join Date: May 2006
Location: Florida
Posts: 22
dabblercody is on a distinguished road
Haha that worked salesman thanks.
__________________
Dabbler

"Our work is the presentation of our capabilities."
- Goethe, Johann Wolfgang Von
Reply With Quote
  #6  
Old 01-19-2011, 03:52 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by dabblercody View Post
What would the x represent?
Re-read: http://en.wikipedia.org/wiki/Quadratic_Formula#Geometry

It's used to calculate the Y position on a graph based on your a, b, c and X position on the graph.

Aside from maybe an EXP formula or other statistical values I can't see any other practical use in Graal unless you're using it for graphing for some reason.
__________________
Quote:
Reply With Quote
  #7  
Old 01-19-2011, 04:04 AM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
Quote:
Originally Posted by fowlplay4 View Post
Re-read: http://en.wikipedia.org/wiki/Quadratic_Formula#Geometry

It's used to calculate the Y position on a graph based on your a, b, c and X position on the graph.

Aside from maybe an EXP formula or other statistical values I can't see any other practical use in Graal unless you're using it for graphing for some reason.
Graal has been my personal calculator on some of my personal calculus homework. :P
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
Reply With Quote
  #8  
Old 01-19-2011, 11:01 PM
dabblercody dabblercody is offline
Tech Assistant
dabblercody's Avatar
Join Date: May 2006
Location: Florida
Posts: 22
dabblercody is on a distinguished road
Lmao yeah I can't wait for pre calc next year for my senior year of HS. I'n only in Prob & Stat so I sometimes let Graal do my homework as well.
__________________
Dabbler

"Our work is the presentation of our capabilities."
- Goethe, Johann Wolfgang Von
Reply With Quote
  #9  
Old 01-19-2011, 11:52 PM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
I'm letting you know right now that it'd be a much better idea to invest in learning mathematica instead, if doing Math homework is the goal.
Reply With Quote
  #10  
Old 01-22-2011, 01:16 AM
darkcloud667 darkcloud667 is offline
That One Guy.
darkcloud667's Avatar
Join Date: Dec 2009
Location: Missouri
Posts: 40
darkcloud667 will become famous soon enough
im a little curious as to how you would be able to implement this to show the formula in a particle form. i mean showing the parabola that the equation would create. i think it'd be pretty cool to be able to do parabolas on graal out of pretty lights.

any ideas :o
__________________
"Time is a great teacher, but unfortunately it kills all its pupils."

"Friendship is like peeing on yourself: everyone can see it, but only you get the warm feeling that it brings."

"The man who smiles when things go wrong has thought of someone to blame it on."
Reply With Quote
  #11  
Old 01-22-2011, 01:25 AM
Fulg0reSama Fulg0reSama is offline
Extrinsical Anomaly
Fulg0reSama's Avatar
Join Date: Sep 2009
Location: Ohio
Posts: 3,049
Fulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant future
Quote:
Originally Posted by darkcloud667 View Post
im a little curious as to how you would be able to implement this to show the formula in a particle form. i mean showing the parabola that the equation would create. i think it'd be pretty cool to be able to do parabolas on graal out of pretty lights.

any ideas :o
That would be kinda weird, but definitely an out there idea.
__________________

Careful, thoughts and opinions here scare people.
Reply With Quote
  #12  
Old 01-22-2011, 01:30 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by darkcloud667 View Post
im a little curious as to how you would be able to implement this to show the formula in a particle form. i mean showing the parabola that the equation would create. i think it'd be pretty cool to be able to do parabolas on graal out of pretty lights.

any ideas :o
A simple parabola:



Not sure if it's possible to use particles but you could easily use lights:

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
this.showLights();
}

function 
showLights() {
  
temp.0;
  
  for (
temp.= (- 15); <= 15+= 0.5) { // change this to change the range of x values
    
with (findimg(200 c)) {
      
25 i;
      
10 parabola(i);
      
      
image "light4.png";
      
      
layer 3;
      
      
red 1;
      
green 0;
      
blue 0;
      
      
alpha 0.9;
    }
    
    
++;
  }
}

function 
parabola(i) { // returns y for y = 1/10(x^2); like f(x) = 1/10(x^2)
  
return (1/10) * (2);

__________________

Last edited by cbk1994; 01-22-2011 at 01:38 AM.. Reason: light4.png > light2.png
Reply With Quote
  #13  
Old 01-22-2011, 01:34 AM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
You can also grab utility_graph from GBench, join it, and call
PHP Code:
this.graphLine("Graph title"temp.xstemp.ys); 
It should create a graph like the one in that thread.
Reply With Quote
  #14  
Old 01-25-2011, 06:03 PM
MysticX2X MysticX2X is offline
Prince
MysticX2X's Avatar
Join Date: Sep 2005
Posts: 2,529
MysticX2X will become famous soon enough
Takes 10 seconds to do this on a graphing calculator.
__________________
-Mystic

former acc: mystic2k


RIP Matt (NBK)
Reply With Quote
  #15  
Old 01-25-2011, 08:15 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Is the window background shadow thing when you're taking a screen-shot, a Mac feature or what?
__________________
Quote:
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 05:47 PM.


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