Author Topic: PERL URGENT HELP NEEDED (Prole, Recursive, Cubicle, Frag enter)  (Read 950 times)

0 Members and 1 Guest are viewing this topic.

T234

  • Canadian Legal Expert and Hillballer
  • Senior Member
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
« Last Edit: February 19, 2008, 07:49:39 PM by T234 »
UK

abrader

  • Bomb-A-Daeus
  • Senior Member
Re: PERL URGENT HELP NEEDED (Prole, Recursive, Cubicle, frag enter)
« Reply #1 on: February 19, 2008, 04:53:29 PM »
PERL

Reminds me of projects involving Cleo :(


Van Cruncheon

  • live mas or die trying
  • Banned
Re: PERL URGENT HELP NEEDED (Prole, Recursive, Cubicle, frag enter)
« Reply #2 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

« Last Edit: February 19, 2008, 05:06:11 PM by Professor Prole »
duc

Fragamemnon

  • Excel 2008 GOTY
  • Icon
Re: PERL URGENT HELP NEEDED (Prole, Recursive, Cubicle, frag enter)
« Reply #3 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.
hex

T234

  • Canadian Legal Expert and Hillballer
  • Senior Member
Re: PERL URGENT HELP NEEDED (Prole, Recursive, Cubicle, frag enter)
« Reply #4 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
UK

Phoenix Dark

  • I got no game it's just some bitches understand my story
  • Senior Member
Re: PERL URGENT HELP NEEDED (Prole, Recursive, Cubicle, frag enter)
« Reply #5 on: February 19, 2008, 07:44:05 PM »
You never did a quadratic equation until highschool?

Homeschool>The South
010

T234

  • Canadian Legal Expert and Hillballer
  • Senior Member
Re: PERL URGENT HELP NEEDED (Prole, Recursive, Cubicle, frag enter)
« Reply #6 on: February 19, 2008, 07:44:52 PM »
Part of that WAS home school, PD.
UK

Phoenix Dark

  • I got no game it's just some bitches understand my story
  • Senior Member
Re: PERL URGENT HELP NEEDED (Prole, Recursive, Cubicle, frag enter)
« Reply #7 on: February 19, 2008, 07:48:32 PM »
BAIL OUT  :-\
010

cubicle47b

  • Member
Re: PERL URGENT HELP NEEDED (Prole, Recursive, Cubicle, Frag enter)
« Reply #8 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).
« Last Edit: February 19, 2008, 07:53:25 PM by cubicle47b »

brawndolicious

  • Nylonhilist
  • Senior Member
Re: PERL URGENT HELP NEEDED (Prole, Recursive, Cubicle, Frag enter)
« Reply #9 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.

T234

  • Canadian Legal Expert and Hillballer
  • Senior Member
Re: PERL URGENT HELP NEEDED (Prole, Recursive, Cubicle, Frag enter)
« Reply #10 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.
UK

brawndolicious

  • Nylonhilist
  • Senior Member
Re: PERL URGENT HELP NEEDED (Prole, Recursive, Cubicle, Frag enter)
« Reply #11 on: February 19, 2008, 08:03:47 PM »
I see.

Himu

  • Senior Member
Re: PERL URGENT HELP NEEDED (Prole, Recursive, Cubicle, Frag enter)
« Reply #12 on: February 19, 2008, 08:07:34 PM »
yeah fuck coding in the ass i can't do this shit
IYKYK