Miscellaneous > Programming & Networking

A programming challenge all up in your face.

<< < (12/24) > >>

mobrien_12:

--- Quote from: H_TeXMeX_H ---[offtopic] Yeah, that's why I don't like to use C++ for non-important programs that you wanna make work fast. It usually takes a decent amount of debugging to get working, and it's just things so obscure that you don't notice them EVEN WHILE STARING AT THEM !!![/offtopic]

--- End quote ---


[offtopic]
One of the reasons I like Octave for prototyping is that it is easy to work with, that and it's just really really powerful for math.  It has a lot of support for math that other languages just dont.

I've done huge code prototypes on Octave that would have probably taken twice the time or maybe been impossible with my skills to prototype directly on C.

But you can't beat compiled code for overall performance.  When I was in grad school, there was this guy who was running lots of number crunching for his thesis.  He used matlab, but his computations were so heavy that he ended up going to the computer lab and monopolizing 3-4 computers for several hours at a time, over months, just running them all in parallel grinding matlab.  If he stopped being lazy, and turned his code into C, he would have been able to crunch the code so much faster and on one machine.

By the way, Bash works very well on WindowsXP through Cygwin.  I think I'd be going freaking insane without it.

[/offtopic]

H_TeXMeX_H:
[offtopic]Oh yeah Cygwin ... I forgot about that.[/offtopic]

worker201:
Okay, so I have a version that appears to be working.  Quick question, though: we know that if the discriminant of the quadratic equation is less than zero, the line and the circle don't intersect.  If it is greater than zero, then the line and circle do intersect, at the solution points.  What happens if the discriminant equals zero?  That means there is one solution, or rather, 2 identical solutions.  Doesn't this mean that the line is vertical?

Furthermore, how should we deal with vertical lines?  If the x-coordinates are identical, the slope will be undefined.  I guess I have to include a couple more if statements.

H_TeXMeX_H:
if the descriminant is 0 then there is one root meaning that the line is tangent to the circle (it touches the circle at a single point ... rare indeed)

worker201:

--- Quote from: H_TeXMeX_H ---if the descriminant is 0 then there is one root meaning that the line is tangent to the circle (it touches the circle at a single point ... rare indeed)
--- End quote ---

How could you tell?  I think you would get the same solution for a tangent or for a vertical line.

Anyway, my program cannot handle vertical lines yet. Or tangents.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version