Wikipedia:Reference desk/Archives/Mathematics/2010 February 20

= February 20 =

Sinusoidal function of time
Its well known that if a sinusoidal function of time is squared (multiplied by itself), there will be produced a sinusoidal function at twice the original frequency. My question is: what if you try to take the square root of a sine function assuming that its instantaneous value never becomes negative? And does the answer depend upon the zero frequency offset (ie the constant) added to the sine function. Will the result be half of the original frequency? This is my personal interest and is not homework of any sort. —Preceding unsigned comment added by 79.76.244.151 (talk) 01:32, 20 February 2010 (UTC)
 * You can give it a try on a graphing calculator, such as [this online one]. Successively graph sin(x), 1 + sin(x) and sqrt(1 + sin(x)), then starting fresh, successive graph sin(x), abs(sin(x)), and sqrt(abs(sin(x))), and finally consider sin(x), (sin(x))^2  and sqrt((sin(x))^2).  Don't just look at the results, but work through what is happening in your mind so that you could make a sketch graph of the functions without a calculator.  You may then understand that the frequency is not so much due to the power (squared, square root, etc.) of the sine function as it is of how the function which originally yielded both positive and negative values was modified to yield only positive ones. (Your question was an excellent one, reflecting an inquisitive nature.  Math should be explored, not just learned.) 58.147.58.28 (talk)  —Preceding undated comment added 02:10, 20 February 2010 (UTC).
 * Also, note that sqrt(1 + sin(x)) is equal to sqrt(2) * abs( sin(0.5 * x + pi/4) ). So taking the square root of a sine function that was lifted up to just above x-axis does give the absolute value of a sinusoidal function with half the frequency.  The trouble is that the sqrt function always returns the principal square root -- the positive one.  If it somehow knew to return the negative value half the time then you would the function you originally asked about.  So I suppose that the answer to your original question is "sort of".58.147.58.28 (talk) 06:11, 20 February 2010 (UTC)

The original poster wrote:
 * Its well known that if a sinusoidal function of time is squared (multiplied by itself), there will be produced a sinusoidal function at twice the original frequency.

But that's not true. It's true if the mean value of the original sine function is zero. But it's not true more generally. Try graphing this:
 * $$ y = \left( 1 + \frac{3}{4}\sin x \right)^2 $$

The frequency is only that of the original function, and the shape differs visibly from a sinusoid. Michael Hardy (talk) 04:23, 20 February 2010 (UTC)


 * Yes I forgot to put that condition in my original statement. Sorry! —Preceding unsigned comment added by 79.76.244.151 (talk) 10:52, 20 February 2010 (UTC)

Pi
Why most of the programmers use 4*atan(1)as a value of pi instead of 3.14159..... ? Does not the former way takes a long calculation time? —Preceding unsigned comment added by Amrahs (talk • contribs) 03:18, 20 February 2010 (UTC)


 * It is possible that an optimizing compiler can recognize that 4*atan(1) is constant and replace it with the appropriate constant value at compile time, so that there is no effect on the run time. Also, it is easier to remember 4*atan(1) than to remember π to the necessary number of decimal places (and it is less error-prone). Finally, the specifications for the atan function probably guarantee that the returned value will be as precise as possible given the target computer's representation of real numbers. —Bkell (talk) 04:41, 20 February 2010 (UTC)


 * INot sure why and havent seen it much but it may have to do with the intel floating point implementation which internally has 80 bits but if you specified pi directly would only be 64 bits. If you use the expression and it doesn't truncate the value it will be using a higher precision value in its calculation. Actually the IEEE 754-2008 specification also lists functions with pi factors in so they would also give higher accuracy if they were used. Dmcq (talk) 13:25, 20 February 2010 (UTC)


 * Are there many situations where you would need more than 64 bits of pi? --Tango (talk) 13:59, 20 February 2010 (UTC)


 * I think Dmcq is right, why not start with 80 digits when you can do it just as easily. But the x87 already has a load pi instruction built in so I'm not sure why you'd use atan instead.--RDBury (talk) 17:59, 20 February 2010 (UTC)oogle I found [http://www.derekroconnor.net/Software/Ng--ArgReduction.pdf


 * I just had a look up about this and the chip hoilds 66 significant bits plus the exponent. On google I got this Argument Reduction for Huge Arguments as my first reponse for'argument reduction sin'. They talk about needing 1144 significant bits! Dmcq (talk) 20:54, 20 February 2010 (UTC)
 * Unless the whole calculation, up to the point of comparing it with something, is done in registers, the extra precision will be lost when it gets rounded for writing to a 64-bit location in memory. Paul Stansifer 03:17, 22 February 2010 (UTC)


 * An arctangent calculation takes on the order of 100 machine cycles on a modern x86 with floating point hardware, i.e. usually less than 1/10th of a microsecond. That adds up if you do it a lot of times in some inner loop of a program, but for initializing a static value where you only do it once when the program starts, it's insignificant.  On (say) an embedded ARM processor with no hardware floating point, the initialization would be a lot slower (several microseconds even) but still probably less significant than the possible code bloat of bringing in an arctangent routine that's not being used anywhere else.  It is of course best if the compiler recognizes the arctangent function and precomputes it (partial evaluation) but if you're developing in a context where this is an issue, you should check the generated assembly code to make sure the compiler is doing what you hope. 75.62.109.146 (talk) 23:15, 20 February 2010 (UTC)

This is the Mathematics desk, but if you don't mind, and since you did use the word "programmers" in the question, I'll give more of a Computing-desk answer.

The answer does have as much to do with programming style and Software Engineering as it does with mathematics. Consider these four expressions: Now, the first line has an obvious bug. It doesn't have enough significant digits; it will yield pretty significantly wrong answers in subsequent calculations. The second line, on the other hand, has a very non-obvious bug, one that might never be noticed. The third line is probably fine, for any reasonable application, but it might be a nuisance to type (if, for example, you didn't have Wikipedia's pi article handy, or if you were unclear on the copy of cut and paste); the third line is also a nuisance for anyone else to verify. The fourth line, however, is (with one exception) perfect: it is guaranteed to give you a value of pi which is exactly right, out to the numerical limit of whatever processor your code happens to be running on. The code is easy for you to type, and equally easy for your successor to verify. The only possible objection is efficiency, but if you're computing it just once and then assigning it to a variable (as in my example), or if you're a practitioner of "make it right before you make it fast", you can pretty easily see your way clear to going ahead and writing it that way, and changing it only if the efficiency problem is found to be significant. —Steve Summit (talk) 02:59, 23 February 2010 (UTC)


 * I've found the reason out, it's horrible. The constant  has been in most math.h include files in C since year zero but it has not been included in some of the standards. I haven't worked out why yet and it seems really silly to me, the computing desk might know. You will be able to include it if you set some compiler switch or include something in the source but it won't be standard. Using   conforms tot he standard. With a good compiler it won't be too bad because it'll evaluate it at compile time but that might only happen with a high level of optimization. Dmcq (talk) 09:55, 23 February 2010 (UTC)


 * 4 * atan(1) has two problems that I see. One is performance: even a highly optimising compiler may not eliminate the calculation at compile time if atan is provided by a library linked in at link time. Some compilers have switches to enable compile time elimination of math library functions, but not all compilers and not all functions. It's not part of the C or C++ standard so varies between implementations, and is something you need to check on each platform you're targeting.
 * The other problem might be accuracy. If you have e.g. "doubles are always floats" set, a performance option on most compilers, then all maths calculations are done with floats and so only 23 bits of accuracy. Every calculation done will introduce inaccuracies, including the above one. So 4 * atan(1) will probably be less accurate than typing out the digits.
 * So this is what I've always done, if someone hasn't already done it in the code I'm working on: define a constant (#define in C, const in C++) equal to 3.14159265358979323846, i.e. with more than enough digits (which I learned a long time ago) that it's accurate for whatever degree of accuracy is needed.-- JohnBlackburne wordsdeeds 12:16, 23 February 2010 (UTC)
 * Well, you could always put  at file scope.  Maybe it wouldn't evaluate it at compile time, but at the very least it should evaluate it only once per execution of the program.  (For anyone worried about globals, my opinion is that global variables are a problem, global constants are not.  --Trovatore (talk) 19:32, 23 February 2010 (UTC)

Composite number
Okay, my name is NumberTheorist, but think of the restriction "in training". In fact, the best I had was an independent study in number theory as an undergrad and I didn't do a whole lot. But, I really want to learn this stuff. I'm just going through some problems from William Chen's lecture notes and I am not sure what to do on this one.

Show $$n^4 + 4$$ is composite for all $$n > 1$$. I have figured out if $$n \not\equiv 0 \mod 5$$, then it's easy as $$n^4 \equiv 1$$ so that $$5 \mid n^4 + 4$$. And, clearly if $$n$$ is even, the expression is composite. But, if $$n$$ is an odd multiple of 5, I don't know where to go. If you consider the first few, $$n = 5$$ gives 629 = 17 * 37, $$n = 15$$ gives 50629 = 197 * 257, $$n = 25$$ gives 390629 = 577 * 677 so there is no small number that goes into these guys necessarily. Any ideas? This is only problem 3 in Chapter 1 of William Chen's "Elementary Number Theory" so it shouldn't be that hard. NumberTheorist (talk) 14:32, 20 February 2010 (UTC)


 * $$n^4 + 4 = (n^2 -2n + 2)(n^2 +2n + 2)$$ Gandalf61 (talk) 14:29, 20 February 2010 (UTC)


 * Yea, I just figured that out :) Thanks for your help though. NumberTheorist (talk) 14:32, 20 February 2010 (UTC)

Getting to the South Pole
Assume that the earth is a perfect sphere. It is intuitively obvious that if one starts on the equator and maintains a constant bearing with a southwards component, one will eventually reach an arbitrarily small distance from the South Pole. If the bearing is 0.1° south of west, say, there will be a spiral path with many "circuits" of the southern hemisphere. For a bearing of 0.1° west of south, I've difficulty in visualising the path but think that it won't go too far from the line of original longitude - but will it again spiral round the pole, this time starting much closer to it? Is it possible to derive an explicit function of longitude in terms of latitude for a path of constant bearing? 81.131.164.207 (talk) 16:12, 20 February 2010 (UTC)


 * Yes, it will spiral round the pole. Since the bearing is closer to south than north, each step you take will take you closer to the pole, but since you aren't travelling due south you will never actually get to the pole. That results in a spiral. Of course, in real life you would eventually get closer to the pole than can be meaningfully distinguished from being at the pole. The best way to find the function would be to use something like the Mercator projection where Rhumb lines (which the line you are talking about is) are straight lines. The formula for a straight line is easy, so you just need to compose it with the projection and its inverse (see the projection's article for those formulae). --Tango (talk) 16:24, 20 February 2010 (UTC)
 * It's not the case that you never get to the south pole. The rate at which your latitude changes is constant and so the path length is finite. Rckrone (talk) 17:14, 20 February 2010 (UTC)
 * The rate at which your latitude changes as a function of time is constant, but not as a function of longitude, which is what we are talking about. If the path is finite in space, then what longitude would you have just before you reach the south pole? The time taken to reach the south pole is finite, so to say you never get there isn't really accurate (since "never" usually refers to time), you are right, but the path is not finite - the south pole is some kind of singularity. --Tango (talk) 17:30, 20 February 2010 (UTC)
 * Well, that's not right either... the length is finite, but the path doesn't have an end-point. My use of language leaves something to be desired... --Tango (talk) 17:33, 20 February 2010 (UTC)


 * Another way of representing the path might be as a logarithmic spiral round the south pole on a stereographic projection round there. Dmcq (talk) 17:57, 20 February 2010 (UTC)

You would wind infinitely many times around the pole, but the length of the path to the pole is still finite. Michael Hardy (talk) 18:09, 20 February 2010 (UTC)


 * (please WP:INDENT; this is a response to the OP) From a basic differential equation treatment, I get that $$\frac{d\phi}{d\theta}=\frac{\tan a}{\sin \theta}$$, where θ is colatitude (π at the south pole), φ is longitude, and a is your angle east of south. We can directly integrate this to get $$\phi(\theta)=\phi_0-\tan a\,\ln(\csc \theta+\cot \theta)$$.  This is of course equivalent to the statements in the articles Tango mentioned, but I thought this different approach interesting.  --Tardis (talk) 18:36, 20 February 2010 (UTC)

Thanks to all. 81.131.164.207 (talk) 19:30, 20 February 2010 (UTC)

Complex Radius of Convergence
Hi all.

On the 'radius of convergence' page, it says that "The radius of convergence of a power series f centered on a point a is equal to the distance from a to the nearest point where f cannot be defined in a way that makes it holomorphic". Can anyone direct me to a proof of that? Now with say, tan(z) for example, obviously the function is well-behaved until we hit pi/2, but how do we show that f 'can't be defined to make it holomorphic'? I think the very concept of this confuses me - surely the function is defined erm... by its definition. Is this the same as saying we just can't define any power series which agrees with f on every point of radius R from a? How can it 'agree with f' anyway if that is the case - surely if we can't define f as a power series, then how can we define it in cases like tan(z), etc? In that case, how do we show that? Perhaps if I saw a proof of whatever theorem they're referring to then things would be clearer - any insight would be great - thanks very much.

Estrenostre (talk) 18:34, 20 February 2010 (UTC)


 * See holomorphic functions are analytic. The fact being proved there is different but the same method of proof is applicable to your question.  Also see Lars Ahlfors' book on the topic (or any of a few dozen others.... Michael Hardy (talk) 21:47, 20 February 2010 (UTC)


 * ...as for your other questions (besides where to find a proof): One cannot extend the tangent function by defining its value to be some particular complex number at &pi;/2 in such a way that the new function extending the tangent function is holomorphic at that point (nor even continuous, in this case). Michael Hardy (talk) 21:51, 20 February 2010 (UTC)


 * Yes. I would like to add that just because tan has a power series around 0 doesn't mean the value of that series agree with tan everywhere; its only valid in the maximal open disc containing 0 at which tan is differentiable. Money is tight (talk) 21:53, 20 February 2010 (UTC)
 * For your question of how do we define tan; first define the exponential function exp(z) as the standard power series, then define sin(z)=(exp(iz)-exp(-iz))/2i, cos(z)=(exp(iz)+exp(-iz))/2, tan(z)=sin(z)/cos(z). Money is tight (talk) 21:58, 20 February 2010 (UTC)
 * Ah, that makes sense, the definition is much clearer in the article you suggested - thankyou! Estrenostre (talk) 21:12, 21 February 2010 (UTC)

Probability Question
Consider an urn with 6 red balls and 3 blue balls. There are three people (A,B,C) who will each draw one ball from the urn. What is the probability of drawing a blue ball for each individual?

My thought is that each one has the same probability regardless of order, and my calculations seem to show this to be true. However, I have trouble explaining why this is the case. I know this seems like a homework question, but it actually has to do with simplification of a computer algorithm. 199.111.191.177 (talk) 19:51, 20 February 2010 (UTC)
 * If they draw with replacement, you just cube the probability of one of them doing it (because they're independent). If they draw without replacement, the order still doesn't matter (they are exchangeable events), but they're not independent, so you have to handle it differently.  Here it's just that one of the many ways to pick 3 objects from 9 is a success, and all the others are failure.  Either way, this experiment is a simple random sample.  --Tardis (talk) 20:15, 20 February 2010 (UTC)


 * To convince yourself, you may wish to consider the conditional probabilities. P(B draws red) = P(A draws red) * P(B draws red given A draws red) + P(A draws blue) * P(B draws red given A draws blue).  Knowing what A drew tells you how may balls of each color are available for B to draw from. 58.147.58.28 (talk) 20:57, 20 February 2010 (UTC)

Thanks for the links. However, I seem to have found something even more puzzling. Let's return to the original example and instead of using the given urn, we used a basket containing 8 red balls and 1 blue ball. If each of three people (A,B,C) draw one ball (without replacement) from the basket, it seems to be intuitively true that whoever draws first has a higher chance of drawing the blue ball. Yet, when computing the probabilities, they all worked out to be the same once again! Assuming, A draws first, his chances are obviously (1/9). Then, if B draws second, B's chances are (8/9)*(1/8)=(1/9). Lastly, C's chances are (8/9)(7/8)(1/7)=(1/9). I have come to understand this to mean that even though B will only have a chance 8 out of 9 times of drawing the blue ball, his overall chance is the same due to his improved odds due to the presence of one less red ball in each of those 8 times. This is also similarly true for C.

I tried one last case, which is the same as the last example with the exception that the first two people get to draw four times without replacement. After going through the calculations, A has a (4/9) chance, B has a (4/9) chance and C has a (1/9) chance. I think I am beginning to understand this. 199.111.191.177 (talk) 23:06, 20 February 2010 (UTC)
 * I don't think the intuition is valid. Say you write a number on each ball, so the blue ball is #5 and the other numbers are on red balls.  Then you permute the balls at random.  The blue ball will end up in position 1, 2, 3, etc. with equal probability.  The drawing-without-replacement process just means permuting the balls, then giving the ball in position 1 to A, the ball in position 2 to B, and the ball in position 3 to C.  Each has equal probability of getting the blue ball. 75.62.109.146 (talk) 23:23, 20 February 2010 (UTC)


 * I have come to understand this to mean that even though B will only have a chance 8 out of 9 times of drawing the blue ball, his overall chance is the same due to his improved odds due to the presence of one less red ball in each of those 8 times. Right!  I would think that it would be intuitive that A's draw has a certain probability of increasing B's chances and a certain probability of decreasing (in this case ruining) B's chances.  What might not be intuitive is that when you do the calculations the fractions work their way to give equal probabilities for all three players.  I would think that the general presence (or lack) of an intuitive sense of equal probabilities here is important to the tradition of drawing lots.  We do not read of Jonas first drawing lots to determine the order of drawing lots.  Psychologically, the impact of going last could depend on whether the drawn lots are concealed until all have been drawn.   I'd hate to be the sixth man and receive the revolver in a game of Russian roulette where the cylinder is not spun between tries.  It only had a 1/6 chance of occurring, but I know what is going to happen when I pull the trigger. 58.147.58.28 (talk) 03:07, 21 February 2010 (UTC)
 * I was just thinking that some of the same issues of intuition are involved in the Monty Hall problem. I am convinced that the majority of its controversy was due to the ill defined problem where it is not explicitly stated that the host intentionally chooses a goat to draw out the tension of the contest.  (The mathematicians who wrote in objecting to vos Savant's answer assumed that the door which happened to reveal a goat was chosen at random, as most such problems which are presented in the study of probability explicitly state the bias where it exists.  The revealed door chosen on the game show is almost certainly not chosen at random, but it is possible that the show is running over budget that week, and the host will intentionally open the door with the car if the contestant had not initially chosen correctly.  In that case a goat is only revealed to attempt to lead the contestant away from the prize, and the best strategy is to stand pat.)  I am shocked that our Monty Hall problem article (a featured article, nonetheless) says in its lead Some critics pointed out that the Parade version of the problem leaves certain aspects of the host's behavior unstated, for example, whether the host must open a door and must make the offer to switch. However, such possible behaviors had little or nothing to do with the controversy that arose, and the intended behavior was clearly implied by the author.  That may be verifiable, but it is patently false.  (It would be better to concentrate on the motivation of the host's choice in choosing which door to reveal, that is, whether it was a random choice or not.) 58.147.58.28 (talk) 03:35, 21 February 2010 (UTC) I'd be thrilled to win a goat.  I love goats!

Exhaust sound
Hello

I've been dealing with honda bike for more than 2 decades

I'm currently designing sports bike as a result.

One of the huge challenges I'm facing, is about exhaust sound.

I need help.

I look forward to your response

IBRAHIM ABDOULLAHI from Cameroon —Preceding unsigned comment added by 195.24.193.34 (talk) 20:13, 20 February 2010 (UTC)


 * Well you'll already know more than anybody here I'd guess but have you seen the muffler article. I'd have though nowadays one could do active noise cancellation as well. Dmcq (talk) 21:08, 20 February 2010 (UTC)