Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Quadratic Formula (https://forums.graalonline.com/forums/showthread.php?t=134261753)

dabblercody 01-19-2011 03:29 AM

Quadratic Formula
 
If anyone can figure out why this formula won't work on Graal. !pissed!

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;



fowlplay4 01-19-2011 03:39 AM

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

dabblercody 01-19-2011 03:41 AM

What would the x represent?

salesman 01-19-2011 03:44 AM

Quote:

Originally Posted by dabblercody (Post 1623961)
If anyone can figure out why this formula won't work on Graal. !pissed!

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


dabblercody 01-19-2011 03:45 AM

Haha that worked salesman thanks.

fowlplay4 01-19-2011 03:52 AM

Quote:

Originally Posted by dabblercody (Post 1623966)
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.

MrOmega 01-19-2011 04:04 AM

Quote:

Originally Posted by fowlplay4 (Post 1623972)
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

dabblercody 01-19-2011 11:01 PM

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.

WhiteDragon 01-19-2011 11:52 PM

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.

darkcloud667 01-22-2011 01:16 AM

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

Fulg0reSama 01-22-2011 01:25 AM

Quote:

Originally Posted by darkcloud667 (Post 1624711)
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.

cbk1994 01-22-2011 01:30 AM

Quote:

Originally Posted by darkcloud667 (Post 1624711)
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:

http://u.graalcenter.org/i/asdf.png

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);


http://u.graalcenter.org/i/Capture%2...37.53%20PM.png

WhiteDragon 01-22-2011 01:34 AM

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.

MysticX2X 01-25-2011 06:03 PM

Takes 10 seconds to do this on a graphing calculator.

fowlplay4 01-25-2011 08:15 PM

Is the window background shadow thing when you're taking a screen-shot, a Mac feature or what?

cbk1994 01-25-2011 10:51 PM

Quote:

Originally Posted by fowlplay4 (Post 1625510)
Is the window background shadow thing when you're taking a screen-shot, a Mac feature or what?

The shadows are added by Grab, Mac's screenshot utility. It looks a bit silly when you look at it on white, especially when you're on another OS (mainly since gamma correction doesn't seem to work in most web browsers; Mac screenshots always look way too blue on other OSes.) It looks a lot nicer on screen :p.


All times are GMT +2. The time now is 03:58 PM.

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