• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[JASS] Fun with Arcs (parabola!)

Status
Not open for further replies.
Level 11
Joined
Aug 25, 2006
Messages
971
Ok everybody loves a good quadratic, right? Anyway I understand how to take two points and get a linear equation. I understand how to make a parabola along the X or Y axis using quadratics. What I want is to use three points to find a quadratic equation.

(See diagram)
 

Attachments

  • Equ.JPG
    Equ.JPG
    11 KB · Views: 159
ax² + bx + c = y

Let's say we have 3 points, For example:
(1,1)
(2,3)
(3,5)

Then all we need to do is fill in the x and y of our points in order to get the right equation.

In this example, we get:
a (1)² + b (1) + c = 1
a (2)² + b (2) + c = 3
a (3)² + b (3) + c = 5

Thus

a + b + c = 1
4a + 2b + c = 3
9a + 3b + c = 5

then just mess around with those 3 lines and you should get a corresponding a, b and c...
 
There must be an easier way then guessing. Perhaps kramer's rule? Maybe not, I'm not sure if it works with quadratics.... Then again the quadratic dissapears, so it probably does. I'll get back to you on that.
 
It's not guessing... It's just doing the same you do when solving a linear equation.

a + b + c = 1
4a + 2b + c = 3
9a + 3b + c = 5

Thus:
c = 1 - a - b
4a + 2b + c = 3
9a + 3b + c = 5

Thus:
c = 1 - a - b
4a + 2b + 1 - a - b = 3
9a + 3b + 1 - a - b = 5

Thus
c = 1 - a - b
3a + b = 2 ==> b = 2 - 3a
9a + 3b + 1 - a - b = 5 ==> 9a +6 - 9a + 1 -a - 2 +3a = 5
==> 2a +6 +1 -5 = 0 ==> 2a +2 = 0 ==> a = -1

If a = -1 then:
b = 2 - 3a ==> b = 2 + 3 = 5
then c = 1 - a - b ==> c = 1 +1 -5 = -3

Thus:
a = -1
b = 5
c = -3

Thus the equation is -x² +5x -3 = 0

It's just basic maths...
 
Sorry for the double post, but the problems not solved. If its so easy Eleandor, why doesn't it work? First of all -x² +5x -3 does not equal zero. Its supposed to equal y (I'm assuming) But it doesn't equal Y either.

ax² + bx + c = y

Let's say we have 3 points, For example:
(1,1)
(2,3)
(3,5)

So lets put 3 in for x.
-(3)² +(5*3) -3
Simplify
-9 + 15 -3
15 - 12 = 3 (not 5)
Next lets try 2
-(2)²+(5*2)-3
-4+10-3
10-7=3 (Hey that worked!)
Finally lets try 1
-(1)²+(5*1)-3
-1+5-3
5-4 = 1(Hey that worked two!)

So you got 2/3, close but no cigar.

Since you only got the last one wrong, I'm assuming you screwed some arithmetic in the last step. So much for 'easy'
 
Those points aren't quadratic, they are a line, thus A=0.
Proof:
C=1-A-B
4A+2B+1-A-B=3
3A+B+1=3
B=2-3A
C=1-A-2-3A
C=-1-4A
9A+3(2-3A)-1-4A=5
9A-9A-4A+6-1=5
-4A+5=5
-4A=0
A=0
B=2
C=-1
Thus the line Y=2x-1 follows that pattern.
 
Status
Not open for further replies.
Back
Top