wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Need some basic algebra methods.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Need some basic algebra methods...." Watch "Need some basic algebra methods...." New topic
Author

Need some basic algebra methods....

Will Carpenter
Greenhorn

Joined: Mar 17, 2004
Posts: 26
Given two points on a graph (you know, each with a x-coordinate and a y-coordinate) which method could I use to determine the slope of a line between those two points?
Which method could I use to determine the distance between those two points?
Given three integer coefficients, A, B, C, which method could I use to solve a quadratic function of the form: Ax^2 + Bx + C = 0 ?
Given four integer coefficients, A, B, C, D which method could I use to find the derivative of a cube polynomial function: Ax^3 + Bx^2 + Cx + D?
Carlos Failde
Ranch Hand

Joined: Oct 20, 2000
Posts: 84

Given two points on a graph (you know, each with a x-coordinate and a y-coordinate) which method could I use to determine the slope of a line between those two points?

If point one has coordinates x1,y1 and point two has coords x2,y2
then the slope is
(y2 - y1) / (x2 - x1)

Which method could I use to determine the distance between those two points?

Pythagoras's Theorem:
distance = sqrt[ (y2-y1)^2 + (x2 - x1)^2 ]


Given three integer coefficients, A, B, C, which method could I use to solve a quadratic function of the form: Ax^2 + Bx + C = 0 ?

Oh dear how embarrassing that I had to look that one up
One root is x = [ -B + sqrt( B^2 - 4*A*C) ] / (2*A)
The other is x = [ -B - sqrt( B^2 - 4*A*C) ] / (2*A)

Given four integer coefficients, A, B, C, D which method could I use to find the derivative of a cube polynomial function: Ax^3 + Bx^2 + Cx + D?

Yikes... er ... .... hey what's that thing behind you !? .... *RUNS* (hee hee hee)
[ March 20, 2004: Message edited by: Carlos Failde ]
chi Lin
Ranch Hand

Joined: Aug 24, 2001
Posts: 348
derivative function would be 3Ax^2+2Bx+C for each x.

Given four integer coefficients, A, B, C, D which method could I use to find the derivative of a cube polynomial function: Ax^3 + Bx^2 + Cx + D?
Will Carpenter
Greenhorn

Joined: Mar 17, 2004
Posts: 26
Thanks Carlos and Chi Lin!
(Although I though for sure there would be some methods that did those. You know, something like slope(int a, int b, int c, int d). Now I guess I'll have to do some work. )
Tim West
Ranch Hand

Joined: Mar 15, 2004
Posts: 539
There's a proof in number theory that there's no formula for the zeroes of an order-5 polynomial (ie, p(x) = ax^5 + bx^4 + cx^3 + dx^2 + ex + f), or any polynomial of greater order.
OK, when I say "formula", I mean a function f(a, b, c, d, e, f) which yields the zeroes to p(x) above.
IIRC there are formulae for the zeroes of polynomials of orders 3 and 4, but they're sufficiently complex that in almost all circumstances an approximation is better.

--Tim
 
Don't get me started about those stupid light bulbs.
 
subject: Need some basic algebra methods....
 
Similar Threads
How to take linear equation as input.
A flatland puzzle
is rectangle?
line graphs
Quadratic perplextion