PDA

View Full Version : Programers and mathematicians, help!


[UFP]Ghost
9 Nov 2006, 23:05
Thank You to those who are reading this :)

So me mate got help from my teacher is using equations that don't use unknown variables (x and y) to solve the shortest distance from a point to a line, on a t1-83 plus calculator. Can someone explain the formula and why it works and a better alternative if you have 1.

the formula is:
Disp "Ax+By=C","and (D,E).
Pmorpt A,B,C,D,E

part 1: (-1/(-a/b)->M


Part 2:
M -> J
-1 -> K
MD-E -> L


Part 3:
(CK-BL)/(AK-BJ) -> X
(AL-CJ)/(AK-BJ) -> Y


Part 4:
Disp "bla blah blah, the answer is:"
Disp (square root)_/(E-Y)^2+(D-X)^2)
________________

I understand part 1 and part 4 but the rest.....LOST.
I'm trying to advance the program to show the steps taken to achieve this including substituation but i cannot do so without understand the formula.

P.S. If you have a better formula it's welcome to be put in to be used.

[UFP]Ghost
9 Nov 2006, 23:22
just so you and everyone else understand the form in like this..... skip to step 2. I'd have to write what the second equation is, i don't really know how with this formula what the intercept of the y=mx+b form on the Ax+BY = C form, i don't knot the b in the first or the c in the last. then i write something like:

Rearange equasion 1:
Sub _______ in equasion 2 as Y:
Using: The Quickly: (answer)
Sub (answer) as X in equasion 1:
Using the quickly:
and then i can also do step 4....

Plasma
9 Nov 2006, 23:35
Wait, I think I can help, but I don't know what you really want:
What are you trying to get the program to do, exactly?

[UFP]Ghost
9 Nov 2006, 23:42
Wait, I think I can help, but I don't know what you really want:
What are you trying to get the program to do, exactly?

first thing i need help with is to understand part 2 and 3 of the formula unless a better 1 is suggested.

second i want the program to show is words these steps:
Equation 1:Ax+By=C
Equation 2: Hx+Jy=I
Rearange Equation 1: Y=-Ax/B + C/b
Sub Y=-Ax/B + C/b in equation 2:Hx+J(Ax/B + C/b)=I
Using the quickly: X = ?
Sub X=? in equation 1:?x+By=C
Using the Quickly:Y=?
and part 4 i can do.

Plasma
10 Nov 2006, 00:08
Here's a less confusing formula, and put in short (it might require a little tweaking, I'm tired right now):
The point is called "P"
The line is called "L"

* Find the slope of L
* Find a point on the line, and call it A
* Find the slope of the line from A to P, and subtract it from L. Call this "M"

* Find the distance from A to P. Call it "D"
* Multiply D by Sin M


There, try that.

bonz
10 Nov 2006, 00:44
Hehe! :D
Plasma answering in a post about programmers, while using Gamemaker to "program".
Sorry, couldn't resist.

Deadcode could probably answer this, as he is a Texas Instruments geek.

[UFP]Ghost
10 Nov 2006, 00:50
anyone know where i can contact him :) trying plasma thing now. umm didn't work on 2 questions...... once i even got a negative distance :O

bonz
10 Nov 2006, 00:52
Seita supposedly has knowledge about TI calculators too.

[UFP]Ghost
10 Nov 2006, 01:26
and how can i get these people and talk to them?

bonz
10 Nov 2006, 12:03
Ghost;542786']and how can i get these people and talk to them?
Private messages?

AndrewTaylor
10 Nov 2006, 12:08
That's a very hard to follow program. Not least because the TI range has a particularly obtuse form of BASIC. My advice is to look things like this up on Mathworld.

http://mathworld.wolfram.com/Point-LineDistance2-Dimensional.html

It's usually a pretty good source of formulae, and they're written in proper algebra rather than TI-BASIC. It assumes a fair level of maths knowledge, but so does owning a TI-83.

Plasma
10 Nov 2006, 17:09
Hehe! :D
Plasma answering in a post about programmers, while using Gamemaker to "program".
Sorry, couldn't resist.
...
I'm rather suspecting that you never actually used GameMaker...

evilworm2
10 Nov 2006, 17:38
...
I'm rather suspecting that you never actually used GameMaker...

..and that is why he is accepted by the guys. ;)

Plasma
10 Nov 2006, 18:18
..and that is why he is accepted by the guys. ;)
Ah, yes...

...but then again, I'm the one accepted by the girl!
:D


...I'm gonna stop spamming now...

[UFP]Ghost
10 Nov 2006, 21:53
http://www.mathphiles.com/board/cgi-bin/yabb/YaBB.cgi?board=HHELP;action=display;num=1162863449

i want to show what she showed solving it, her and the guy asking the question are in my class. thats what i need help doing. without using x and y as unknown variables.

Plasma
10 Nov 2006, 22:13
Damnit! I completely screwed up my plan!
Ill have another try tomorrow.

Melon
11 Nov 2006, 13:19
Well, I've spent about 3 hours working on a formula to solve the shortest distance between a point and a line, and here it is. I don't know how to code on a t1-38 plus calculator, so you'll have to figure that out or yourself.

I will use a line in the form of Ax + By = C, and a point (D,E) I will also calculate the points of intersection, (F,G) of the line and a perpendicular one that passes through (D,E).

F = ((C/B) + (BD/A) - E) / ((B/A) + (A/B))

G = (BF/A) + E - (BD/A)

Now take the square root of ((D-F)^2 + (E-G)^2)

So those are the steps you would need to put into the calculator. If you want, I can tell you how I achieved that formula, but it's quite long.

So basically, you will want the person to input A,B,C,D and E into the calculator.
Then get it to work out F and G using the above formulae, then display the answer as root (D-F squared plus E-G squared). Easy.

Is this actually what you wanted, or have I got the wrong idea?

[UFP]Ghost
11 Nov 2006, 14:21
didn't work for me, maybe i did it wrong?:

1X+1Y=5
(5,4)

F=(5/1+5/1-4)/1+1
F=6/2
F=3
G=3/1+4+5/1
G=3+4+5
G=12 ____________________________
XY=_/(5-3)^2+(4-12)^2
XY=_/2^2+(-8)^2
XY=_/4+64
XY=_/68
XY=8.24

Calc using your program gave me: 4.47
my original program gave me 2.8
Doing it my way by hand gave me 2.8.

Melon
11 Nov 2006, 14:34
Eeek! Does my formula not work? I tested it before I submitted it and it worked for me. I'd better look back over that again...

And I don't quite understand what you mean by 'the quickly'. Is it that you want the calculator program to show you the perpendicular line equation, and the steps it goes through in sloving the questions simultaneously?

Also, when I did it, I found out the value of x and subbed that in, not y. Do you want me to re-arrange my formula for you?

[UFP]Ghost
11 Nov 2006, 14:36
1. the quickly is.
2. Yes please, but that was by hand the calculator did it itself, try the equasion i did the answer is most definatly 2.8 :)

Melon
11 Nov 2006, 14:44
It seems I miss-typed my formula.

G = (BF/A) + E - (BD/A)

I put + (BD/A)

Now it gives the answer as 2.828427125 Sorry about that.

[UFP]Ghost
11 Nov 2006, 14:46
works!!!!!!!!!!!!! :)

but can i show the steps using it?

Melon
11 Nov 2006, 15:05
Well here's how I did it.

Ax + By = C
Now rearrange
y = (C/B) - (Ax/B)
Now we find out the equation for the perpendicular line, with unknown value Q.
y = (Bx/A) + Q
Now rearrange
Q = y - (Bx/A)
Now sub in the values D and E as x and y
Q = E - (BD/A)
So: y = (Bx/A) + E - (BD/A)

Now we have 2 simultaneous equations. Put them together.
y = (C/B) - (Ax/B) and y = (Bx/A) + E - (BD/A)

So : (C/B) - (Ax/B) = (Bx/A) + E - (BD/A)
rearrange
((B/A) + (A/B))x = (C/B) + (BD/A) - E
make x the subject
x = ((C/B) + (BD/A) - E) / ((B/A) + (A/B))

this x value is F in the above formula.
Sub x into one of the simultaneous equations.

y = (BF/A) + E - (BD/A)
again, y is G in the above formula. Notice I have put F in as the x value so that it doesn't look ridiculously complicated.

Finally, find the differences and use Pythagoras.

square root of ((D-F)^2 + (E-G)^2)


Right, so that's my formula explained. Now let me work out what it would look like if I find the value of x first, and I'll post the new one up. Meanwhile, I hope you understand this...

[UFP]Ghost
11 Nov 2006, 15:12
when you type the next thing using X, just remember i'm ony 15 so i'm not as good at math as a 18 year old :P

[UFP]Ghost
11 Nov 2006, 15:34
hmmm i seem to understand most of it execpt"

So : (C/B) - (Ax/B) = (B/Ax) + E - (BD/A)
rearrange
((B/A) + (A/B))x = (C/B) + (BD/A) - E


Ok so how do you take x out of the bracket without x affecting anything else and why does e become -e

Melon
11 Nov 2006, 15:37
Right, finding y first is similar, but invovles squared terms.

G = ((BC/A^2) + E - (BD/A)) / (1 + (B^2/A^2))

F = (C/A) - (BG/A)


So, how I did it :

Rearrange one of the simultaneous equations to:
x = (C/A) - (By/A)

Put this x value into the other equation.

y = ((B/A) * ((C/A) - (By/A))) + E - (BD/A)

y = (BC/A^2) - (yB^2/A^2) + E - (BD/A)

y + (yB^2/A^2) = (BC/A^2) + E - (BD/A)

Factorise y terms:

y * (1 + (B^2/A^2)) = (BC/A^2) + E - (BD/A)

Make y the subject.

y = ((BC/A^2) + E - (BD/A)) / (1 + (B^2/A^2))

This is G as shown above.

Now sub it into x = (C/A) - (By/A) to get what F is.


To be honest, I don't think that this will clear things up at all. It shouldn't matter which one you use for your program, but then again, I still can't understand EXACTLY what steps your program wants to show. Sorry.

Oh, and apoligies if it seems confusing to you. I'm doing a maths degree at university, and it all seems to make sense to me. Also, writing it out using ^2 as squared doesn't make it look any clearer.

-EDIT- I see you understand it now. You would post that as I'm writing this out, wouldn't you. I think I may just confuse you now with this.

[UFP]Ghost
11 Nov 2006, 15:40
hmmm i seem to understand most of it execpt"

So : (C/B) - (Ax/B) = (B/Ax) + E - (BD/A)
rearrange
((B/A) + (A/B))x = (C/B) + (BD/A) - E


Ok so how do you take x out of the bracket without x affecting anything else and why does e become -e

Melon
11 Nov 2006, 15:52
Ah, I think I missed a step there. Also, by (B/Ax) I meant B/A * x or Bx/A. Sorry if that is confusing. I'll edit that.

(C/B) - (Ax/B) = (Bx/A) + E - (BD/A)

(Bx/A) + (Ax/B) = (C/B) - E + (BD/A)

Here I've basically swapped the sides over. So i've put E and (BD/A) over the other side of the equation, hence why they swap sign. I realise now that it looks confusing. I've also moved (Ax/B).

So it's identical to : (C/B) - E + (BD/A) = (Bx/A) + (Ax/B)

Finally, you factorise the side with the x terms to get x on it's own.

((B/A) + (A/B))x = (C/B) + (BD/A) - E

[UFP]Ghost
11 Nov 2006, 16:15
Finally, you factorise the side with the x terms to get x on it's own.

((B/A) + (A/B))x = (C/B) + (BD/A) - E

in english m8. show like the non important crap on that step like don't do

X+3=10
X=7
Do:
X+3=10
X+3-3=10-3
X=7

Melon
11 Nov 2006, 16:25
Unfortunately, going form this:
(Bx/A) + (Ax/B)
to this:
((B/A) + (A/B))x

is only one step.

It's the same as:

(x * (B/A)) + (x * (A/B))

x * ((B/A) + (A/B))

x((B/A) + (A/B))

Does that help?

[UFP]Ghost
11 Nov 2006, 16:41
I Got It!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

[UFP]Ghost
11 Nov 2006, 17:30
wait the slope is -b/a
what is the second line? is it: y = (Bx/A) + Q

Melon
11 Nov 2006, 17:48
Right, lets pretend the equation is 2x + 3y = 4
This rearranges to :
3y = 4 - 2x
y = 4/3 - 2x/3

So the second line equation would be :
y = 3x/2 + Q

This is because (-2x/3) * (3x/2) = -1

If you multiply the two gradients together, they should = -1. This is because the lines are perpendicular.

If the equation was 2x - 3y = 4
Then the second line equation would be
y = -3x/2 + Q
As B is basically (-3).

[UFP]Ghost
11 Nov 2006, 18:40
I finished the program ! Thanx to you all. I love you :) :) :) :) :)

o and melon i got the asnwer while playing with the (D,E) because
Y-Y1=M(X-X1)