THE BORE

General => The Superdeep Borehole => Topic started by: T234 on February 19, 2008, 04:48:46 PM

Title: PERL URGENT HELP NEEDED (Prole, Recursive, Cubicle, Frag enter)
Post by: T234 on February 19, 2008, 04:48:46 PM
How does one go about solving a quadratic equation using perl?

We are completely baffled as to even what the structure of the structure of the program would be.

PLZ HELP
Title: Re: PERL URGENT HELP NEEDED (Prole, Recursive, Cubicle, frag enter)
Post by: abrader on February 19, 2008, 04:53:29 PM
PERL

Reminds me of projects involving Cleo :(

Title: Re: PERL URGENT HELP NEEDED (Prole, Recursive, Cubicle, frag enter)
Post by: Van Cruncheon on February 19, 2008, 04:59:41 PM
you guys suck. crack open a numerical methods book!  anyhow:

ax^2 + bx + c = 0;

solving for x, x = (-b + sqrt(b^2 - 4*a*c))/2*a
--
print "gimme the value of a: ";
$a = <STDIN>;
print "gimme the value of b: ";
$b = <STDIN>;
print "gimme the value of c: ";
$c = <STDIN>;

# x = (-b + sqrt(b^2 - 4*a*c))/2*a

$x_pos = (-$b + sqrt($b^2 - (4*$a*$c)))/(2*$a);
$x_neg = (-$b - sqrt($b^2 - (4*$a*$c)))/(2*$a);

print: "lol perl wut! x = either $x_pos or $x_neg\r\n";

or somesuch; check the parentheses to make sure i got 'em right, i gotta run to a meeting

edit: fixed to include negative case, lol me, math is for jerx

Title: Re: PERL URGENT HELP NEEDED (Prole, Recursive, Cubicle, frag enter)
Post by: Fragamemnon on February 19, 2008, 05:08:59 PM
sweet god, solving quadratics is something you learn in like 8-9th grade. It's a FORMULA, you can pretty much punch in the two quadratic solutions for a given a,b, and c like prole posted.
Title: Re: PERL URGENT HELP NEEDED (Prole, Recursive, Cubicle, frag enter)
Post by: T234 on February 19, 2008, 07:40:43 PM
Some of our educations up until this point really sucked, like mine. Never solved a quadratic equation until I hit college, even that was a few years ago.

Prole:  :bow :bow :bow :bow
Title: Re: PERL URGENT HELP NEEDED (Prole, Recursive, Cubicle, frag enter)
Post by: Phoenix Dark on February 19, 2008, 07:44:05 PM
You never did a quadratic equation until highschool?

Homeschool>The South
Title: Re: PERL URGENT HELP NEEDED (Prole, Recursive, Cubicle, frag enter)
Post by: T234 on February 19, 2008, 07:44:52 PM
Part of that WAS home school, PD.
Title: Re: PERL URGENT HELP NEEDED (Prole, Recursive, Cubicle, frag enter)
Post by: Phoenix Dark on February 19, 2008, 07:48:32 PM
BAIL OUT  :-\
Title: Re: PERL URGENT HELP NEEDED (Prole, Recursive, Cubicle, Frag enter)
Post by: cubicle47b on February 19, 2008, 07:50:09 PM
It's like being back in high school with a TI-81 (had the 92 in college).
Title: Re: PERL URGENT HELP NEEDED (Prole, Recursive, Cubicle, Frag enter)
Post by: brawndolicious on February 19, 2008, 07:51:52 PM
wouldn't you have to have a couple algebra classes before taking coding?  seems important to it.
Title: Re: PERL URGENT HELP NEEDED (Prole, Recursive, Cubicle, Frag enter)
Post by: T234 on February 19, 2008, 07:55:19 PM
wouldn't you have to have a couple algebra classes before taking coding?  seems important to it.
One. And that was forever ago.
Title: Re: PERL URGENT HELP NEEDED (Prole, Recursive, Cubicle, Frag enter)
Post by: brawndolicious on February 19, 2008, 08:03:47 PM
I see.
Title: Re: PERL URGENT HELP NEEDED (Prole, Recursive, Cubicle, Frag enter)
Post by: Himu on February 19, 2008, 08:07:34 PM
yeah fuck coding in the ass i can't do this shit