Miscellaneous > Programming & Networking

A programming challenge all up in your face.

<< < (2/24) > >>

Orethrius:

--- Quote from: Pathos ---If you use complex numbers it works, if you algebraically cancel the two operations out it works. If you attempt the find the Real root your screwed.
--- End quote ---
You have already lost.
The correct answer is always "42."

Having said that, 42.   QED. :D

piratePenguin:
http://illhostit.com/files/3913162470455711/curve_q.png
Whenever the curve is going around a circle it can go around it clockwise or anti-clockwise, does it always go clockwise or should it go for the shortest route?

TheQuirk:
Shortest route, and no, the circles don't overlap.

About the (sqrt(x))^2 = x thing: for x >= 0, yes, (sqrt(x))^2 = x is correct. What a lot of people do, though, is forget that the square root function has a domain of [0; inf) and solve things like (sqrt(x))^2 = -1 in the real number system.

TheQuirk:
Let's take this thing apart piece  piece!

Before we write any code, we have to answer a few questions:

a) How do we represent the line mathematically?
b) How do we represent the circles mathematically?
c) How do we check whether the line touches/intersects a given circle?
d) If the line intersects a given circle, what is the arc length which is "created"?

worker201:
a)
slope = (y2-y1)/(x2-x1);
b = y1 - (slope * x1);

the line's equation is then:
y = b + (slope * x);
or maybe:
y = y1-m(x+x1);
or if you prefer:
y = y1 - (((y2-y1)/(x2-x1)) * (x+x1));

Even though the order of operations covers most of the math, I still use parentheses, for clarity.

So is that enough?  Or do we need to build some kind of array of points that satisfy the equation?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version