Wikipedia:Reference desk/Archives/Mathematics/2006 July 11
| ||||||||
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions at one of the pages linked to above. | ||||||||
|
What does =? mean?
[edit]I saw a statement today that used the (I'm assuming) mathmatical operator =? -- what function is this? -Quasipalm 00:01, 11 July 2006 (UTC)
- If the author does not say otherwise, typically this is used to explore whether a proposed equality holds. For example, we might consider
- or
- In the first example we could substitute x = 2, y = 1 to produce 1 on the left and 3 on the right, and conclude that the equation is false; while in the second example we could multiply through on the right and simplify, to conclude the equation is true. Thus we resolve the proposed equalities to
- and
- The notation is less common in advanced mathematics, but useful for more elementary teaching. Typically the question mark appears over the equality sign, as in the Unicode character "≟" (U+225F, QUESTIONED EQUAL TO). The TeX markup would be "\mathop{=}\limits^?", but Wikipedia's texvc chokes on it. --KSmrqT 01:20, 11 July 2006 (UTC)
- Awesome thanks! -Quasipalm 04:27, 11 July 2006 (UTC)
Programming Language
[edit]I want to learn a general purpose programming language, either C, C++ or Java; does anyone have any suggestions as to which would be the best one to learn? Many thanks --86.139.216.231 14:07, 11 July 2006 (UTC)
- This is not really a factual question, and is likely to generate more heat than light (i.e., a flame war). But the important thing is that your choice should depend on your prior experience and what you want to do (immediately). If you've never programmed before at all, you would want C if you wanted the simplest language to start with, or Java if you wanted the most structured as a basis. If you have programmed a lot before, then you might want to learn C++ if you had learned functional programming before and wanted to continue using it (somewhat), or you might want C if you had used Smalltalk before and wanted to try something very different. It is possible to write graphical applications, network applications, scientific applications, and games in any of those three; however, for systems programming on Unix C or C++ is clearly a superior choice, whereas for a simple graphical program that will most easily run on multiple platforms Java is the obvious candidate. C and C++ are faster than Java (somewhat), but that's only important for severe amounts of mathematics; C++ and Java support (differently: see garbage collection and RAII) automatic memory management, which is useful in many programs (especially dealing with strings and advanced data structures), but is entirely unnecessary in others. C has the widest compiler support, but that's only important if you plan to be working with many different architectures (and Java wins in terms of support in many "odd" environments such as cellular phones). In other words, "which one is best" is not at all answerable without knowing more about your goals and experience. I personally know all three and find each to be useful at different times. Hope this helps. --Tardis 19:41, 11 July 2006 (UTC)
- I've been considering the same question myself, since I learned BASIC many years ago and think it might be time to also become competant with a more modern language, something that can interact with the internet or offers the possibilty of object-orientation if I want it.
- The conclusion that I can to is that Python is easily the best language to choose. See the article on Python programming language. In addition to the above, two other important considerations are 1) it has a clear easily-readable syntax without those curly brackets or other obscure punctuation, and 2) it is the best supported modern language, with many tutorials for beginners, discussion fourms, etc. Its not just a passing fad, but is here to stay. And its all free!
- I'd like to know what language you finally choose.
- --81.104.12.70 11:12, 12 July 2006 (UTC)
- If I could toss in my two cents, I would first point out a few things about these languages. The reason you may be looking at them is that they are both very powerful. I'm more a C++ guy, but some of the great things about C++ that it has above most other languages is it allows the programer to write in a way that tells the machine how to allocate memory and how to do this all very efficiently. If you know what you are doing, you can write extremely efficient programs. There's a million other things that C++ can do, but I'm using this as an illustration. So this is great, because C++ allows you to write the fastest, least RAM-hungry apps you could ever want. The problem is this: to facilitate this, C++ has a whole mess of commands and options that seem, to a beginning programmer, extremely pointless. As a beginning programer, you don't have to worry about memory allocation, blahblahblah. In fact, you better not worry about it, or you'll never get anything coded. So learning C++ will involve learning a myriad of things that won't make any sense unless you have a great CS background or you have a grasp of another language that will let you appreciate it. Like I said, I don't know Java well, but I think some of these things are true there too, although to a lesser extent. When you are learning to program, the most important part is to learn how to translate your thoughts into loops and classes and variables, and you can do this with any language. The good news is, if you are proficient at one language, you'll have a lot easier time learning the next one. So, my one word answer: neither; start with something simpler, or if you're dead set on Java / C++, pick one and make sure you stay open-minded; don't get into bad habits. I'm not going to vote between C++ and Java, because I don't want this thread to explode
If you're set on picking from those three, I would strongly recommend Java, even though I'm not a Java programmer myself. It is not beneficial for beginners to spend their time worrying about memory allocation and accidentally overwriting memory by going out of bounds on arrays and such. —Caesura(t) 16:29, 13 July 2006 (UTC)
- Which language would you choose if I removed the restriction of it being either C, C++ or Java? Which one would you recommend as a good one to start with? Many thanks! --86.137.237.198 14:45, 14 July 2006 (UTC)
- I'd agree with Caesura that Java is the best choice of the three you named originally. It's a good general purpose language, and it avoids many of the pitfalls of C and C++. If you're willing to look further afield, I've heard good things about Python.-gadfium 00:36, 15 July 2006 (UTC)
- Perl is interesting as well, and easy to get started with, since you can write small programs that do useful things, and as your skills progress, Perl provides enough features to grow with you. A large community of Perl users contributes vast amounts of free code (see: CPAN), documentation, etc., and the standard Perl distribution is freely available for Linux, Cygwin, and most other popular operating systems. Of course the same is true of other languages such as Python, so either one is probably a good place for you to start. But Tardis correctly states that the "best" language depends on your goals and prior experience. To that I would also add your environment; for example, do you plan to work with other people who write programs? In many cases, the choice of a programming language gets made for you, by people who started some programming project you want to join. The other thing to note is that it might not matter too much which language you start with, because there is enough similarity between many of the popular programming languages to make learning your second, third, etc. language easier than learning your first. Provided, I suppose, that you don't start with something like Lisp or Forth or APL. Check out the comparison of programming languages. Also see what Google finds for the question what programming language should I start with. Ask a dozen experts, get a dozen different answers. This question is similar to "What musical instrument should I learn to play?" with the answer being "Well, that depends ..." Teratornis 15:36, 19 July 2006 (UTC)
Geometrically stumped
[edit]O ye mathematicians: I am completely stumped by this - I've been crunching the algebra for an hour, and I can't seem to solve it. So, here's a challenge - one wikipat on the back to whoever can figure this out. And I don't need any partial solution - i have lots of those :).
The situation:
In a 2-D rectangular coordinate system: There is a circle of radius R at the location (x,y) = (0, h) - on the y-axis. There is an ellipse with minor and major axes of length 2*a and 2*b, respectively. The center of the ellipse is at (x,y) = (-L, d) (off to the left). d < h, and L > 0. The two figures don't intersect, and a < R and b < R.
The goal:
The thing I'm trying to do is to find a line that goes between them and is tangent to both figures with a positive slope.
Simple, you think? Well, the algebra becomes very unpleasant, then I get stuck. Anyone want to help me out? It would be MUCH appreciated. And I swear this is no homework problem. If it was, I would have just given up long ago. --Bmk 20:04, 11 July 2006 (UTC)
- I think you need to specify the rotation of the ellipse. For example, is the major axis parallel to the X-axis ? StuRat 22:10, 11 July 2006 (UTC)
- Good point - thanks. The major axis is parallel to the y-axis. And in case anyone was wondering, i need this because I'm trying to do some computer-assisted modeling of a structure with a profile that has that description. --Bmk 22:20, 11 July 2006 (UTC)
- This (with the axis specified) seems to me to be relatively straightforward. Allow me to use different notation that I found simpler: consider a circle of radius R at the origin, and your y-major ellipse (same axes, 2a in x and 2b in y) centered at in Quadrant III. Now:
- Consider the line's y-intercept and label it B, such that .
- Label its point of tangency to the circle ; since the radius to that point is perpendicular to the tangent, the radius has slope , so we have and , yielding (since m and B are positive, the tangency must be in Quadrant II).
- This is on the line, so and : only. Then plug that into the equation for the ellipse: . Expand in powers of x: you get a quadratic, of course (it being a conic and all).
- Because we want this line to be tangent, we want there to be precisely one solution for x (think about what the two solutions would be for a line through the ellipse, and what happens as the line approaches tangency). This means that the discriminant is 0: this is then a quadratic in m, since (as it turns out; I'm omitting the algebra) the linear coefficient in x's equation is linear in m and the quadratic coefficient is but quadratic.
- Solve this quadratic, and you'll get the two values of m that "hug" the ellipse on top and bottom.
- From m you get B, and you have the line.
- (Note that the points of tangency can be obtained by then solving for x and then y for the ellipse, and by consulting P for the circle.)
- Hope this helps. --Tardis 23:10, 11 July 2006 (UTC)
- I'm inclined to believe this is not a homework problem, because it is too much of a challenge, especially without calculus (for the tangents). There is, however, a magically simple (?) approach using the geometric theory of poles and polars. The tangency problem becomes an intersection problem for two conics, and that reduces to finding the four real roots of a quartic equation. Each root gives a point of tangency. Pick the one you want.
- 1. Write the circle and the ellipse as implicit equations.
- 2. Rewrite the equations in homogeneous matrix form.
- 3. Calling the circle matrix C and the ellipse matrix E, compute the matrix for a new conic Q = CE−1C.
- 4. Convert Q to an implicit equation (details omitted). Write the circle in rational parametric form.
- 5. Substitute the parametric coordinates of the circle into the implicit equation generated by Q to get a (numeric) quartic equation in t.
- 1. Write the circle and the ellipse as implicit equations.
- 6. Solve the quartic in t for its four real roots (using a numerical method).
- 7. Substitute each t value into the parametric equation for the circle to get the circle contacts.
- 8. Multiply each of the four circle contacts by C to get four line equations.
- 9. Choose the desired line. For positive slope, t must be between −1 and 0, or between +1 and ∞.
- Simple, yes? ;-D
- Let's try an example with specific numbers, to see how simple it really is.
- Values
- Quartic
- Roots
- Circle contacts
- Values
t x y w point (x⁄w,y⁄w) −15.3707 −941.032 2012.36 237.258 (−3.96628, 8.48172) −0.758734 1.69729 8.11122 1.57568 (1.07718, 5.14777) −0.416599 3.30578 7.2292 1.17355 (2.81689, 6.16009) 3.74602 −52.1307 165.262 15.0327 (−3.46783, 10.9935)
- Lines
- 0 = −235.258 x − 30.7414 y − 672.36
- 0 = 0.424323 x − 1.51747 y + 7.3545
- 0 = 0.826445 x − 0.833198 y + 2.80457
- 0 = −13.0327 x + 7.49204 y − 127.559
- Lines
- Contact points for the ellipse can be obtained as LE−1, where L is a row of line coefficients. Although a quartic equation has a closed-form solution in principle, the form is so complicated it is rarely useful in practice. Robust numerical root-finding software is available in the GNU Scientific Library, among other places. If a tangent should touch the circle vertically on its far left side, the t value will be infinite; this can be avoided by changing the circle parametric equations, if necessary. Also, be sure to check for typographical errors in all of this! :-) --KSmrqT 04:54, 12 July 2006 (UTC)
Thank you so much Tardis and KSmrq!!!! Both of you took very innovative paths through the problem - I hadn't tried either method. It will take me a while to go through this, but thanks so much for the effort. Allow me to extend wikipats on the back to both of you, even though i haven't studied your answers yet. --Bmk 15:08, 12 July 2006 (UTC)
- I hadn't noticed that for some cases (like KSmrq's picture) where the ellipse is relatively close to the circle, tangents with positive slope (like this blue line) can have y-intercepts below the circle. So you need to consider . However, while writing this I realize that the discriminant may not be a quadratic in m because of the square root in B; it may in fact become a quartic! This makes sense; if we square away the square root in B, we lose information about the sign of B. So my method seems to already be as general as KSmrq's and must yield four solutions for m. It's not too bad, though: since quartics can technically be solved in closed form, both of these solutions are actually exact (if correct at all). --Tardis 18:13, 12 July 2006 (UTC)
- Theory. The method I described is so classic it's ancient, the kind of thing algebraic geometers used to do routinely in the early parts of the twentieth century. Vestiges of polarity and duality remain in our DNA even today. For example, for every point with homogeneous coordinates (p:q:r) we can pair a line 0 = px+qy+rw, a point–line duality.
- This is a special case of a much broader pairing produced by any (non-degenerate) conic, whether circle or ellipse or parabola or hyperbola. In this context each point is called a "pole", and its associated line is called its "polar" with respect to the given conic. Pole–polar pairing is a natural consequence of a tangency question.
- Suppose we are given a circle with center c and radius r. If x is a point on the circle, then x satisfies
- 0 = (x−c)·(x−c)−r2
- (Here "·" denotes the dot product.) Now suppose we are given a point p outside the circle, which will be our "pole". The difference x−p is a vector along the line from p to x. If that line is tangent to the circle at x, then the radial vector x−c will be perpendicular to the line vector, so that
- 0 = (x−c)·(x−p)
- Subtract, and use the linearity of the dot product to simplify.
- 0 = (x−c)·(p−c)−r2
- Notice that we now have a linear equation in x; that is, we have a line equation. This is the polar line paired with pole p. It intersects the circle exactly where a line from p would be tangent to the circle.
- The formula produces a paired line for all points, not just those outside the circle. (However, the point at the center of the circle is paired with the line "at infinity", for which properly we must switch to homogeneous coordinates.) Points on the circle produce the line tangent there.
- If we write the circle equation in matrix form, 0 = xTQx, then the polar of column vector p is the row vector ℓ = pTQ. The reverse pairing, from lines to points, is obviously given by p = Q−1ℓT. (The matrix Q will be symmetric, so QT = Q and (Q−1)T = Q−1.)
- Working with a matrix, we need no longer restrict our conic to be a circle. For example, the extremely simple duality mentioned earlier is produced by the conic whose matrix is the identity, 0 = x2+y2+w2.
- With these tools, we reason as follows. Take a point x on the conic with matrix Q1. The line tangent there is given by ℓ = xTQ1. The pole of this line with respect to a second conic given by Q2 is y = Q2−1ℓT = Q2−1Q1x. For a mutual tangent, y lies on the second conic, and so satisfies 0 = yTQ2y. Substitute and simplify.
0 = yTQ2y = (Q2−1Q1x)TQ2(Q2−1Q1x) = xTQ1Q2−1Q1x = xTQx, for Q = Q1Q2−1Q1
- We conclude that the points x on Q1 that have a mutual tangent with Q2 are precisely those that lie on the conic Q we have just derived. In other words, we have replaced the question of finding tangent lines common to Q1 and Q2 with the question of finding points common to Q1 and Q.
- Every non-degenerate conic is projectively equivalent to a parabola, and has a rational parameterization (of degree 2). Thus we can produce points x(t) by using the parameterization of Q1, substitute this symbolic expression into the implicit equation for Q, and find the values of t that satisfy the resulting quartic.
- The usual rational form of a circle uses as parameter the slope of a line through the far left point.
- It's a pity such appealing and useful mathematics has been largely forgotten, especially as the theory is so much simpler than modern algebraic geometry. The most difficult part of this whole method in practice is finding the quartic roots! (Even that can be avoided if we have two circles instead of two arbitrary conics: Shrink both circles by the radius of the smaller, solve the resulting point–circle tangency problem using a quadratic equation, and inflate the results.) Of course, in general we are not guaranteed four real roots; for example, nested circles have no common tangents. --KSmrqT 12:59, 13 July 2006 (UTC)
Very interesting! Thanks for the follow up/background lesson. It was a good opportunity to dust off my linear algebra, too :) --Bmk 20:34, 13 July 2006 (UTC)
- This is a good problem! While ingenious insights are, well, ingenious and insightful, sometimes you just need an answer in a hurry, so humdrum methods are often of interest too. I specialize in being systemically st00p1d :-/ so I could outline a humdrum computer algebra approach based upon widely applicable methods from elimination theory in computational algebraic geometry which use Gröbner bases in probably horrendous computations :-/ In more complicated problems involving integer coefficients, it may behoove one to use modular arithmetic to find answers from which one guesses a rational answer which can then be easily verified. The mathematicians here may recognize that the "four tangents" in this problem is the answer to a counting problem as per Schubert calculus.---CH 02:38, 14 July 2006 (UTC)
- Ha; you don't think I worked out the specific values for this specific problem by laborious hand calculations, do you? No, I've sought the assistance of computer algebra systems many times, and here such help was useful for steps 3 and 5, for example. I don't explain those methods, perhaps involving Gröbner bases, any more than I explain how to find the roots of the quartic. I was tempted to mention resultants, but decided against it. And unless you use some kind of mapping, counting the number of tangents is a more general question of incidence calculus, not specifically Schubert calculus (which deals with linear subspaces).
- But don't dismiss polarization as a one-off trick; it's far more useful than that. For example, it is now a standard part of how computer graphics works with Bézier and B-spline curves; see Lyle Ramshaw's influential exploration at DEC-SRC, where he used the term "blossoming" before he realized this was the classical technique of polarization. Also, any time we convert a quadratic form to a bilinear form (for example, converting the Pythagorean x2+y2 to the dot product x1x2+y1y2), we're polarizing. Remind anyone of a metric tensor? And I think I see a little Hodge duality peeking shyly from behind a bush. :-) --KSmrqT 05:36, 14 July 2006 (UTC)
Wow! I was never expecting such mathematical depth to arise from my silly little geometry problem :) - but that's kind of the beauty of mathematics! I admit that last little barrage was way out of my mathematical league, but thanks again to everyone for your comments. --Bmk 22:51, 17 July 2006 (UTC)
Downloading streaming videos
[edit]OK, so I'm trying to find a good free program to download that will download streaming videos... I've tried a few and they all don't work or don't work right. So any suggestion would be great! Thanks!
I highly recommend VLC Player. --Bmk 20:07, 11 July 2006 (UTC)
That can download streaming videos!?! I've been having that program! hehe... Well at least I know it does that now. But how do you do that?
Hmm - actually I guess I didn't really answer your question. VLC is ok with playing video files that are still streaming from the internet. I don't know about actual streaming video on the internet - sorry. --Bmk 20:29, 11 July 2006 (UTC)
- MPlayer can copy streams to file, the manual explains how. (I have only tested this with audio streams, but I see no reason why it shouldn't work with video too.) -- AJR | Talk 01:26, 12 July 2006 (UTC)
- Yes, mplayer can do it (use
-dumpstream
and-dumpfile filename
). Very useful for watching streaming media when your connection is too slow for that particular video (you can download first and then watch, instead of having the video skipping). --cesarb 06:11, 12 July 2006 (UTC)
I've downloaded Mplayer, but I have no idea what ya'll are talking about to download the streaming video/audio. I completely don't get it. I've checked out the manual thing, but it's in pc language, so I can't understand it. (I so need to start teaching myself how to understand all this computer talk... even though I've grown up with pc's it's still hard! hehe oh well).
[note to poster of the previous reply: you deleted an entire discussion when you removed the following line: {{User:Actin/Windows 98}}. I have no idea why it was done that way, it just confuses things, but I don't think you meant to remove it. ]
Oh... I don't know how I did that... sorry!
- Specifically, if you have a streaming video you want to download at
rtsp://foo.bar/stream
, for instance, you could runmplayer rtsp://foo.bar/stream -dumpstream -dumpfile stream.rm
, and you'd be able to, once it was finished and from then on, justmplayer stream.rm
. Is that more helpful, or still too technical? Or is all of this unhelpful because you're using a GUI version instead of the command-line interface everyone here assumed you were using? If so, there's some Windows-centric help here, for instance---but you should ask yourself whether it's really easier to use a bunch of crippled and/or expensive software than it is to learn to use a command line. grendel|khan 00:02, 14 July 2006 (UTC)