Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Distance formula (https://forums.graalonline.com/forums/showthread.php?t=72813)

Angel_Light 03-14-2007 12:01 AM

Distance formula
 
Is it possible to do the distance formula Graal? Does graal have square root symbol? It has powers "^2".

Chandler 03-14-2007 12:05 AM

HTML Code:

temp.objectDistance = ((this.x ^ 2) + (this.y ^ 2)) ^ 0.5;
:)

Angel_Light 03-14-2007 12:07 AM

Thank you very much! =D

DustyPorViva 03-14-2007 12:07 AM

Square root is ^.5

Anyways, to further on what Chandler said, this.dx and this.dy should be this.dx and this.dy. Though it really doesn't matter as the variables are what you make of them, but for understanding purposes, you're getting the distance from delta's.

Gambet 03-14-2007 12:14 AM

The root of a number is the same thing as saying that same number to the power of the exponent it's being multipled to inside the root over the degree of the root.


How that works?


Well, when you rationalize a root, if the root has no outside degree showing, then it's automatically a square root (degree of 2). If you a number inside that square root that does not have an exponent (i.e. doesn't have a power), then the power is automatically 1, since any number to the power of 1 is that same number.

So, by knowing that, you can apply what I said earlier to realize that, for example, the square root of 2 is the same thing as saying 2 to the power of 1/2, or 0.5 (decimal form).

To write the power of a number, you use this symbol: ^

So, it would be written as:

2^0.5 or 2^1/2

Angel_Light 03-14-2007 01:04 AM

a=1
b=1
a=b
a²=ab
a²+a²=a²+ab
2a²=a²+ab
2a²-2ab=a²+ab-2ab
2a²-2ab=a²-ab
2(a²-ab)=1(a²-ab)
1=2


yay

also

Does 0.9 = 1?

1/3 +1/3 +1/3 =1

Put it into decimal, note the 3 in 0.3 is repeating.

0.3 + 0.3 + 0.3 = 0.9

So does 0.9 = 1.

JkWhoSaysNi 03-14-2007 01:09 AM

Yes.

0.999.... repeating = 1.

Chris 03-14-2007 01:31 AM

Quote:

Originally Posted by JkWhoSaysNi (Post 1288336)
Yes.

0.999.... repeating = 1.

LOL

JkWhoSaysNi 03-14-2007 01:35 AM

what?

Was Angel_Light joking? It's hard to infer humour from text :(

DustyPorViva 03-14-2007 01:43 AM

1+1=11

Sum41Freeeeek 03-14-2007 02:16 AM

derr

Tolnaftate2004 03-14-2007 04:26 AM

Quote:

Originally Posted by Angel_Light (Post 1288334)
2(a²-ab)=1(a²-ab)
1=2

a²-ab = 0, so removing them is division by 0, which is a math foul.

Rapidwolve 03-14-2007 04:32 AM

Quote:

Originally Posted by Angel_Light (Post 1288315)
Is it possible.

Anything is possible

Gambet 03-14-2007 04:44 AM

Quote:

Originally Posted by Rapidwolve (Post 1288408)
Anything is possible



Hence my custom user title (:

Kristi 03-14-2007 01:18 PM

Quote:

Originally Posted by Tolnaftate2004 (Post 1288403)
a²-ab = 0, so removing them is division by 0, which is a math foul.

well, if they were divided out, it would be infinity=infinity, so it is all good.

napo_p2p 03-14-2007 07:47 PM

Quote:

Originally Posted by Kristi (Post 1288477)
well, if they were divided out, it would be infinity=infinity, so it is all good.

Then, it's not 1=2 anymore ;).

Tolnaftate2004 03-14-2007 11:29 PM

Quote:

Originally Posted by Kristi (Post 1288477)
well, if they were divided out, it would be infinity=infinity, so it is all good.

0/0 does not definitely equal infinity.
In fact, to make Taylor/Maclaurin series work, 0/0 is finite (likely 1).


On another note, if you're going to use ^1/2, you may want to think again (PEMDAS). ^(1/2)...

Kristi 03-15-2007 01:33 AM

Quote:

Originally Posted by Tolnaftate2004 (Post 1288671)
0/0 does not definitely equal infinity.
In fact, to make Taylor/Maclaurin series work, 0/0 is finite (likely 1).


On another note, if you're going to use ^1/2, you may want to think again (PEMDAS). ^(1/2)...

Umm, 0 was never divided by 0 in that equation.

Tolnaftate2004 03-15-2007 05:56 AM

Quote:

Originally Posted by Kristi (Post 1288704)
Umm, 0 was never divided by 0 in that equation.

2(a²-ab)=1(a²-ab)
2(a²-ab)/(a²-ab)=1(a²-ab)/(a²-ab)
recall that (a²-ab) = 0
gives us 2*0/0 = 1*0/0

Hey, what do you know.

Kristi 03-15-2007 10:16 AM

Quote:

Originally Posted by Tolnaftate2004 (Post 1288796)
2(a²-ab)=1(a²-ab)
2(a²-ab)/(a²-ab)=1(a²-ab)/(a²-ab)
recall that (a²-ab) = 0
gives us 2*0/0 = 1*0/0

Hey, what do you know.

Well either way, by order of operations in that case, the 2 and 1 would have both been multiplied by 0 before being divided by zero. So 0/0 = 0/0, which I do believe in modern math is concidered 0.

Angel_Light 03-15-2007 01:55 PM

I wonder what would happen IF we put those equation in GS2 and allow the language to solve it .=o

DustyPorViva 03-15-2007 01:59 PM

"OK, now what you gotta do is go down the road past the old Johnson place. You're gonna find two roads, one parallel and one perpendicular. Now keep going until you come to a highway that bisects it at a 45-degree angle. Solve for x."

Twinny 03-15-2007 02:27 PM

Quote:

Originally Posted by DustyPorViva (Post 1288879)
"OK, now what you gotta do is go down the road past the old Johnson place. You're gonna find two roads, one parallel and one perpendicular. Now keep going until you come to a highway that bisects it at a 45-degree angle. Solve for x."

*Curls into fetal position and sucks thumb*

Gambet 03-15-2007 09:07 PM

Quote:

Originally Posted by DustyPorViva (Post 1288879)
"OK, now what you gotta do is go down the road past the old Johnson place. You're gonna find two roads, one parallel and one perpendicular. Now keep going until you come to a highway that bisects it at a 45-degree angle. Solve for x."




How can one road be parallel to itself? :rolleyes:

Angel_Light 03-15-2007 09:56 PM

Quote:

Originally Posted by Gambet (Post 1288981)
How can one road be parallel to itself? :rolleyes:

Kinda the point XD lol

Skyld 03-15-2007 10:45 PM

Quote:

Originally Posted by Gambet (Post 1288981)
How can one road be parallel to itself? :rolleyes:

Uncertainty theory? >_<

Tolnaftate2004 03-16-2007 12:10 AM

Quote:

Originally Posted by Kristi (Post 1288859)
Well either way, by order of operations in that case, the 2 and 1 would have both been multiplied by 0 before being divided by zero. So 0/0 = 0/0, which I do believe in modern math is concidered 0.

I can rearrange the numbers to do division first... If they're both multiplied by 0, I'd say the statement reads 0=0 and leave it at that. There is no infinity in either case. On top of that, 0/0 could be anything in C. Also, the taylor series for e (and sin and cos probably, along with others, I really haven't thought about it) needs 0/0 to be 1 to work. Oh, and TI-89s replace 0/0 with 1... ??? :confused:

Gambet 03-16-2007 12:23 AM

You can't divide any number by 0, you can only divide 0 by a number.


What are you guys talking about? :confused:

Tolnaftate2004 03-16-2007 12:30 AM

Quote:

Originally Posted by Gambet (Post 1289064)
You can't divide any number by 0, you can only divide 0 by a number.

This sort of thing is dealt with all the time in calculus. But I think that is a discussion for somewhere else.

Kristi 03-16-2007 03:30 AM

Quote:

Originally Posted by Tolnaftate2004 (Post 1289067)
This sort of thing is dealt with all the time in calculus. But I think that is a discussion for somewhere else.

Yes, Gambet, stop thinking so algebraically. It all has to do with approaching limits.

for f(x) = 1/x
.5 = 1/2
1 = 1/1
2 = 1/.5
10 = 1/.1
....

as x approaches 0, f(x) gets infinitely larger and larger, thus equating to infinity.

in the case of f(x) = 0/x
0 = 0/2
0 = 0/1
0 = 0/.5
0 = 0/.1
....

as x approaches 0, f(x) stays 0, so 0/0 = 0.

Gambet 03-16-2007 03:45 AM

Yeah I'm taking Algebra II Honors this year, all I can do is think algebraically -_-

Angel_Light 03-16-2007 02:05 PM

Quote:

Originally Posted by Kristi (Post 1289116)
Yes, Gambet, stop thinking so algebraically. It all has to do with approaching limits.

for f(x) = 1/x
.5 = 1/2
1 = 1/1
2 = 1/.5
10 = 1/.1
....

as x approaches 0, f(x) gets infinitely larger and larger, thus equating to infinity.

in the case of f(x) = 0/x
0 = 0/2
0 = 0/1
0 = 0/.5
0 = 0/.1
....

as x approaches 0, f(x) stays 0, so 0/0 = 0.

*Joins Twinny in the fetal position while sucking my thumb*

Twinny 03-16-2007 02:44 PM

Quote:

Originally Posted by Angel_Light (Post 1289196)
*Joins Twinny in the fetal position while sucking my thumb*

I left all those stuff at school. I never ever want to do another primitive function ever again. I did all right in calculus and trigonemtry and such but.....damn if I will ever use it. Or will ever be able to remember it >_<

Kristi 03-17-2007 12:03 AM

Quote:

Originally Posted by Tolnaftate2004 (Post 1289061)
I can rearrange the numbers to do division first... If they're both multiplied by 0, I'd say the statement reads 0=0 and leave it at that. There is no infinity in either case. On top of that, 0/0 could be anything in C. Also, the taylor series for e (and sin and cos probably, along with others, I really haven't thought about it) needs 0/0 to be 1 to work. Oh, and TI-89s replace 0/0 with 1... ??? :confused:

The TI-89 is wrong. The only way you can describe 0/0 equating to one is because of the algebraic rule that a/a is always equal to one, but that implies that a is a nonzero number. If you think about what division means in algebra, it establishs a ratio. if you did 2/5, then you would have ,4:1, if you did 1/2, then you would have .5:1, if you did 5/2, then you would have 2.5:1, etc etc. but what if you have a/0? You could never establish it as b:1. a/a as a ratio is 1:1, unless it is 0, which is why a/a when a=0 does not equal 1. The TI-89 incorrectly uses an algebraic rule in a situation where it cannot apply.

The only way to solve 0/0 is to use a limit approach, which makes it equal to 0, and which is the right answer defined by modern mathematics .

napo_p2p 03-17-2007 01:12 AM

Quote:

Originally Posted by Tolnaftate2004 (Post 1289061)
Oh, and TI-89s replace 0/0 with 1... ??? :confused:

Wierd. Mines says 'undef' for 0/0.

Tolnaftate2004 03-17-2007 02:14 AM

Quote:

Originally Posted by napo_p2p (Post 1289343)
Wierd. Mines says 'undef' for 0/0.

When you graph in 3D, I think it says "0/0 replaced with 1." I've only tinkered with an 89 for a little while, I don't actually own one, though.

Quote:

Originally Posted by Kristi (Post 1289308)
The only way to solve 0/0 is to use a limit approach, which makes it equal to 0, and which is the right answer defined by modern mathematics .

I can make several limits to equate 0/0, and each of them gives a different result.

e: in fact,
lim (x,y) -> (0,0) y/x (does not exist) but evaluated individually gives C.

Kristi 03-17-2007 03:58 AM

Quote:

Originally Posted by Tolnaftate2004 (Post 1289357)
When you graph in 3D, I think it says "0/0 replaced with 1." I've only tinkered with an 89 for a little while, I don't actually own one, though.


I can make several limits to equate 0/0, and each of them gives a different result.

e: in fact,
lim (x,y) -> (0,0) y/x (does not exist) but evaluated individually gives C.

It doesn't matter what your calculator says, 0/0 is 0

Angel_Light 03-17-2007 06:53 AM

I use a TI 83+ so I know it's not as powerful as a TI 89 but mine gives me undefined and when I used my friends TI 92 it said 0/0 is one... so.... I just lost myself in thought >_<

Torankusu 03-17-2007 08:47 AM

Zero is simple. If you do not have anything, then you cannot receive anything.

For example, If you split nothing (0) between (/) two (2) people, then they both have two nothings, which, equals 0.

The same is going to hold true if you divide nothing between no one. It will not even occur and there will still be nothing. You will not create something and end up with one (1) object.

For you math wizzes, I'm sure you know zero literally and mathematically means "nothing."



Oddly enough though, if you do 0^0 you will end up with one.

Kristi 03-17-2007 12:59 PM

Quote:

Originally Posted by Torankusu (Post 1289422)
Zero is simple. If you do not have anything, then you cannot receive anything.

For example, If you split nothing (0) between (/) two (2) people, then they both have two nothings, which, equals 0.

The same is going to hold true if you divide nothing between no one. It will not even occur and there will still be nothing. You will not create something and end up with one (1) object.

For you math wizzes, I'm sure you know zero literally and mathematically means "nothing."



Oddly enough though, if you do 0^0 you will end up with one.

once again its a calculator error. 0^0 is equal to 0.

f(x) = 0^x

f(2) = 0^2 = 0
f(1) = 0^1 = 0
f(.5) = 0^.5 = 0
f(.1) = 0^.1 = 0
f(.01) = 0^.01 = 0
....

as you can see, as you approach 0, the value stays 0, so 0^0 = 0. you cannot apply the algebraic rule that a^0 = 1 unless its a nonzero number.


All times are GMT +2. The time now is 07:41 AM.

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