Wikipedia:Reference desk/Archives/Mathematics/2007 September 11

= September 11 =

Rotations
So, I have a vector in 3d space, the initial point at the origin. The terminal point can be rotated around the world's Z axis and around another vector, which would lie along the X-axis except it is rotated around the Z axis the same amount as the vector; a sort of internal x-axis, wingtip-to-wingtip on an airplane as it rolls.

In truth, this is an object in a game-engine and these rotations are easily achieved using "SetAngle, Z" and "SetAngle, X". For some reason SetAngle X does operate on the object's own X axis and SetAngle Z on the world axis. I have no idea why, but it does make it easier to have one object point toward another.

I have another point sitting somewhere else; I want to transform it along with the original object so it stays in the same angle relative to the object as it rotates. Somewhat like someone sitting on an airplane that can pitch and roll (rolling around an axis perpendicular to the ground).

Trig functions are relatively costly (or at least annoying, I have to approximate them myself) so an answer that minimizes them or answers in terms of sin(or cos)(θ or Φ), (θ and Φ being how much to rotate around the Z and internal-X axes) would help because I can hard-code those. -=BungaDunga 01:50, 11 September 2007 (UTC)


 * Well, the reason it rotates about the objects "own" X axis is that if you are doing two separate rotations, one has to be done first. In this case, the X rotation is done first (at the time, it is in world space), and then the Z rotation is done afterward, which also rotates that original X axis.
 * Now, if you want an object B to be attached to object A, you can apply object A's rotation to its position... so keep track of B's position relative to A (position and two angles), and use that combined with A's position/rotation to find the position in world space:
 * B's world position = A's world position + ( B's relative position rotated by A's rotation )
 * B's world rotation = B's local rotation rotated by A's world rotation.
 * The second step is trickier than it looks if you're just learning about rotations; if both X and Z axes are used by A, the rotation isn't going to be easy to specify in terms of X and Z (this is hard to explain in words, it's easier with something physical to show you, but you take a look at Rotation, Euler angles, and Rotation matrix perhaps). If you don't know the math involved yet, you might want to stick to just Z for now. If you are using just the rotation about Z, it is much simpler:
 * B's world Z angle = B's local Z angle + A's world Z angle.
 * A note about optimization though: in a game situation, unless you are needing to use "sin" or some other trig functions a thousand or so times in a frame, it's not generally worthwhile trying to speed it up--it might be better to keep the accuracy. Usually it's best to get it working correctly first, and then afterwards try to figure out what can be sped up, rather that trying to do them both at once (it's very often not obvious where the speed bottleneck is going to be). How many objects do you actually have to rotate? - Rainwarrior 06:22, 11 September 2007 (UTC)


 * Okay, so I think I've figured out how to do it. I can already rotate around the Z axis like this:
 * x' = x cos Ø - y sin Ø  (x and y are relative to the "driving" object)
 * y' = x sin Ø + y cos Ø
 * So I figure that I should rotate the point around A's Z axis so that y' is zero, then rotate around the new local X axis (parallel to the world X) and rotate around the Z axis back. Would that work?


 * It depends on where the number is going and what you're trying to figure out. I'm not sure why you'd want y' to be zero, but again I don't know exactly what you're trying to do. I suppose the best way to answer the question "would that work" is try it. If it doesn't do what you want, well, maybe post a some of the code you're writing so I can see what's going on. - Rainwarrior 05:59, 12 September 2007 (UTC)


 * Also, unless the rotation is by some special angle (e.g. 90 degrees), you need to do at least two trig calculations (one sine, one cosine, or something equivalent) per rotation. What language are you writing in that you need to write your own trig functions anyway? - Rainwarrior 07:08, 11 September 2007 (UTC)
 * It's a Morrowind mod; the scripting is much like Oblivion's, except Oblivion doesn't even have a square root function. Arcsin looks like this:
 * set asin1 to ( 1 - asin ) ; Arcsin approximation
 * set asin1 to GetSquareRoot, asin1
 * set asin2 to asin2 * 57.2957795
 * set asin3 to 1.5707288 - 0.2121144 * asin + 0.0742610 * asin * asin
 * set asin3 to asin3 - 0.0187293 * asin * asin * asin
 * set asin2 to ( asin2 * ( 1.5707963 - asin1 * asin3 ) )
 * That's actually more than accurate enough but looks really ugly. I can't even call it as a function: any time I want to take the inverse sine of anything I have to paste that chunk of code in. With the xcosØ etc currently I'm rotating two degrees a frame so I can just hard code in the cosine and sine of 2.


 * Oh, I didn't realize you were working in a scripting language like that. I have no idea how well anything would perform in that language (but I'd still recommend: go for correctness first, optimize later). - Rainwarrior 05:59, 12 September 2007 (UTC)

Square bracket or small bracket
This is really embarassing but I needed to ask you something for my friend. Can you tell me which bracket to use for 0<=x<=5 is it a. (0, 5) or is it b. [0, 5] ?

I appreciate your swift and honest answer. (this is really an emergency) Thank you.

Regards, Kushal --Click me! write to me 01:24, 11 September 2007 (UTC)


 * Our article on interval notation has the answer, but I'll just outline it here. When writing an interval, [ means the element is included in the interval, whereas ( means that it is not included. I'll be kind and say the latter expression you wrote is correct. Splintercellguy 01:32, 11 September 2007 (UTC)

Thanks a lot. --Click me! write to me 02:01, 11 September 2007 (UTC)

average value of a function's derivative

 * 1) Is it just (f(b)-f(a)) / (b-a)? I'm really confused because this doesn't work for normal functions (just slicing the antiderivative in half with a secant line is a terrible approximation), but it seems like when you do (1/(b-a))*IntegralFromAtoB(f'(x)) then it all comes back to that first equation. So is the slope of the secant line the average derivative of the function after all? I'm talking myself in circles here :(
 * 2) Also is there anything weird going on with the integral of (dy/dx)(dx)? Like do they cancel or something and end up with just Integral(1dy)? Or is that dx not a real differential dx?
 * 3) Finally, do you really think that anyone who's trying to figure out the average value of a function will understand this? Can't you guys just use english instead of solid mathematical notations? What does "G : [a, b] → R" mean? I understand that theorem perfectly but if I was trying to learn it by your explanations I can't for the life of me tell what φ(t) is. I've only ever learned it with φ(t)=t (shouldn't it be =t, not =1 as the article says? Or do I not understand the concept of φ?

Thanks —Preceding unsigned comment added by 65.161.73.250 (talk) 18:21, 11 September 2007 (UTC)
 * I have taken the liberty of enumerating your paragraphs.
 * Yes, the average value of $$f'(x)\,\!$$ from a to b is $$\frac{f(b)-f(a)}{b-a}$$. This looks extrememly intuitive to me, perhaps you can explain again why this seems confusing.
 * This is an example that "Leibniz notation works". You can say that $$\int\frac{dy}{dx}dx$$ is just the integral of the derivative of y, which is y itself (plus constant of integration, as some would say), and you can say that the dx's cancel out and you get $$\int dy = y$$.
 * It is expected that someone who reads an article about calculus would know a little bit about notation for functions. The notation $$f:A \to B$$ means "f is a function from A to B". $$[a,b]$$ is the interval of all points from a to b, and $$\mathbb{R}$$ is the set of all real numbers. So the translation of $$G:[a,b] \to R$$ to English is: "G is a function, the domain of which is the set of all real number greater than a or equal to it and smaller than b or equal to it, and the codomain of which is the set of all real numbers". I do not think it is better than the clear, concise and universally understood $$G:[a,b] \to R$$. $$\varphi$$ can be any function you want. Whatever function you plug in for it you will get a correct statement. You can get a more specific, yet simpler and suitable for most application, statement by taking $$\varphi(t)=1$$, as is explained in the following sentence (I doubt you have learnt it with $$\varphi(t)=t$$).
 * -- Meni Rosenfeld (talk) 19:07, 11 September 2007 (UTC)


 * If you think of the argument as being time, and the function value as being the position of a car measured along a straight road, and you read derivative = (instantaneous) speed, then you're asking if the formula gives the average speed. Yes, that's how you would compute it, and perhaps this example makes it more intuitively acceptable. --Lambiam 20:07, 11 September 2007 (UTC)
 * I've never heard of the codomain, and your article on it is terrible- it defines it: "the codomain of a->b is b" and has a little diagram showing that there is more b than there are actual y values. Helpful. Anyway thanks for the answer, I don't know why I can't see that intuitively. And I don't mean to take out my frustration on you guys, it's just that the math pages on wikipedia are always so unhelpful- always using the most utterly general cases that are totally useless or far beyond my understanding. Math is one big truism, it doesn't make sense to hammer out relationships within the system since you've done nothing, you've just proved 1=1. The point is to explain it to people, and your articles aren't written that way at all :( --65.161.73.250 20:30, 11 September 2007 (UTC)
 * Math articles in Wikipedia are tailored to suit what the reader of that article is expected to know. If some concept or notation is believed to be so fundamental, relative to the article, that a reader who is not familiar with it has nothing to look for in the article in the first place, will generally not be explained. If some conept is necessary for understanding but the reader might not be familiar with it, it will get a brief explanation and a link to an article with more information. When reading math articles it is important to follow such links. If you are unable to understand an article even after following the relevant links, consider that you might be trying to bite more than you can chew.
 * As for Codomain, it indeed provides little information to someone who knows nothing about functions - but it does supply a link to Function (mathematics), which provides a friendlier introduction to this concept and the notation involved. -- Meni Rosenfeld (talk) 20:51, 11 September 2007 (UTC)


 * I'd add a caveat to Meni's remarks. They're quite correct in the sort of situation you're probably thinking of. But they do need to be qualified a little bit -- to say that the average value of the derivative is thus and such, you first need to make sure that "the average value of the derivative" actually makes sense. For example, the derivative might not even exist on the whole interval from a to b.
 * Even if the derivative doesn't exist everywhere on the interval, you still may be able to save the result, in some cases at least, by reinterpreting the statement a little bit. The notion of a "delta function" is relevant here. But that's maybe getting more involved than you want to know about right now. If you are interested, just ask. --Trovatore 20:35, 11 September 2007 (UTC)


 * (triple edit conflict) Perhaps we can say a little more.
 * (1) The average value of a function g over the interval [a,b] is the sum of all the values divided by the size of the interval, if we're careful to interpret this properly. We take the integral
 * $$ \int_{a}^{b} g(x) \, dx \,\!$$
 * and divide it by the integral
 * $$ \int_{a}^{b} dx, \,\!$$
 * the latter simplifying to b−a. Since we are asking for the average value of a function defined as a derivative, g(x) = f&prime;(x), the first integral simplifies to f(b)−f(a). But rather than blindly churn through formulas, let's think about what this means. The derivative of f tells us how it moves, how the value of f rises and falls over the interval. Starting from the value f(a), the accumulation of all those moves brings the function value to f(b). So it should seem reasonable that the "average" move is captured by the slope of a straight line from one end to the other, which is precisely
 * $$ \frac{f(b)-f(a)}{b-a}, \,\!$$
 * the accumulation of all the moves divided by the length of the interval.
 * (3) A reader who is just beginning to learn calculus may well have seen intervals, like [a,b], but never have seen the colon notation. Another English phrasing of
 * $$ G \colon [a,b] \to \R \,\!$$
 * is "Let G be a (continuous) real-valued function defined over the interval [a,b]". (The colon notation does not imply continuity, notated G &isin; C0, but we need to stipulate that for the theorem.) Similarly, we can say "Let &phi; be an positive integrable function over the same interval." (Here "positive" means &phi;(x) &gt; 0, and integrable means the integral of &phi; over the interval is defined and finite.) We do not need to say that &phi; is real-valued because that is implied by "positive".
 * As for codomain, here "real-valued" says that all the values are real (the codomain is R) without implying that the function will produce any real value we choose; the range of the function is, in all likelihood, not the set of real numbers.
 * (2) As for Leibniz notation, we should admit that while it is extremely convenient and works well, it is not so easy to explain rigorously. One reason it is convenient is because it hides details; but that's also why it's tricky to explain. --KSmrqT 20:48, 11 September 2007 (UTC)


 * I've never seen that φ function thrown in there.. why does it have to be positive? Say φ(t)=-1.

(integral from a to b of -t^2dt) = (x^2 * integral from a to b of -1dt) (integral from a to b of -t^2dt) = (x^2 * -(b-a))

certainly gives the same solution for x as

(integral from a to b of -t^2dt) = (-x^2 * (b-a))
 * Man that φ has me all mixed up, is there actually a way to visualize it like there is for φ(t)=1? I was taught that the G(x) is the height of a rectangle stuck between a and b, that has the same area as the function does in that interval. It's not so easy with the width of the rectangle being the area of part of the function.. argh I can't visualize it! grr grumble roommate keeping me up all night can't think --⁪frotht 21:14, 11 September 2007 (UTC)
 * The important thing is that $$\varphi$$ shouldn't change signs (that is, it can be either all positive or negative), but it's simpler to request that it be positive (think, for example, about $$[a,b]=[-1,1]$$ and $$\varphi(t)=t$$. You can think about $$\varphi$$ as a weight, or density, function. Then the left hand side is just a weighted average of G, and the integral on the RHS is the total weight of the interval. -- Meni Rosenfeld (talk) 21:53, 11 September 2007 (UTC)
 * [remarkably similar edit conflict] Consider $$G(x)=\varphi(x)=\cos x$$: then $$\int_0^\pi G(t)\varphi(t)\,dt=\frac\pi2$$, but $$\int_0^\pi \varphi(t)\,dt=0$$, so no luck finding a suitable $$G(x) \;(x\in[0,\pi])$$ by which to multiply it. As far as visualizing it, it's just a weighted average: $$\langle G\rangle_\varphi=G(x)=\frac{\int_a^b G(t)\varphi(t)\,dt}{\int_a^b \varphi(t)\,dt}$$.  Wouldn't you expect the weighted average of a continuous function to be one of the values it takes on over the interval?  --Tardis 22:00, 11 September 2007 (UTC)
 * Yeah I "got" it on the walk to dinner. I understood that it's the idea of a weighted average (or something like that, it's really more like density as mentioned above) but I couldn't figure out what the area of φ had to do with it.. it's all good now --⁪frotht 22:26, 11 September 2007 (UTC)

Acceptable Point-of-Service Survey Response Rates
At our medical office we distribute patient satisfaction surveys, and ask patients to fill them out before they leave. I'd like to know what kind of return rate is acceptable - what I should be aiming for. I've Googled and researched on Wikipedia, and so far haven't found any good information with those kind of statistics...does anyone else know of anything? Thank you. Kingerrd 19:01, 11 September 2007 (UTC)


 * I can't give you an exact answer ... but, I remember that I was told if you get a return of, say, 30%, then that is a great return rate. However, the parameters for me were different --  in my project, it was more like sending out a mass mailing and asking people to mail me back (with a completed survey or questionnaire).  In your case, you essentially have a "captive" audience.  If you hand it to them right there in the office, and ask them to complete it before they leave, you should be able to approach 100%.  As long as the survey is not too burdensome (in terms of time, etc.).  So, take that for what it's worth.  Good luck.  (Joseph A. Spadaro 23:15, 11 September 2007 (UTC))


 * Acceptable on what criterion? One would be that the return rate is adequate from a PR viewpoint, another would be that the sample size of returned surveys is large enough statistically to make reasonable statements of overall patient satisfaction…62.136.191.212 11:59, 14 September 2007 (UTC)

Zeros of the Riemann Zeta Function location of Riemann zeta functions zeros.
There is a formula there with 57.54 a constant in the denominator and i've noticed that it changed over the past 6 months since i've first noticed it at that time it was 57.45 then i noticed in Aug it was 57.34. Now it is 57.54.My Question is what is the actual value?RFS —Preceding unsigned comment added by 209.212.5.67 (talk) 20:53, 11 September 2007 (UTC)


 * The OP is asking about this; here is a relevant diff. I guess the only way to know for sure is to check the referenced article, to which I don't believe I currently have access but here is a Google scholar link for those that do. -- Meni Rosenfeld (talk) 21:01, 11 September 2007 (UTC)


 * I believe the revised value, 57.54, is correct. See these papers, especially Kevin Ford's Zero-free regions for the Riemann zeta function, found here.
 * For future reference, such questions should be raised on the talk page of the article in question. --KSmrqT 02:05, 12 September 2007 (UTC)

Differentiating
How would you differentiate this function?

$$2^x$$

I tried using the difference quotient but I can't get past this point:

$$ \lim_{h \to 0}\frac{2^{x+h}-2^x}{h} $$

$$ \lim_{h \to 0}\frac{2^x(2^h-1)}{h} $$

Now I just need to find $$\lim_{h \to 0}\frac{2^h-1}{h} $$ but I don't know how. --Yanwen 21:35, 11 September 2007 (UTC)
 * Do you know how to differentiate $$e^x\,\!$$? If so, can you show that $$2^x = e^{x \mathrm{ln}2}\,\!$$ and use that to find the result? -- Meni Rosenfeld (talk) 21:47, 11 September 2007 (UTC)
 * Yeah it's different when the base is a constant. Psst, try:

=(d/dx)(a^x) =(d/dx)e^ln(a^x) =(d/dx)e^(x*ln(a)) =(d/dx)(e^(x*ln(a)) =e^(x*ln(a)) * (d/dx)(x*ln(a)) =(a^x) * ln(a)
 * --⁪frotht 22:34, 11 September 2007 (UTC)
 * Perhaps it would have been better to leave some of the details to the reader? -- Meni Rosenfeld (talk) 22:50, 11 September 2007 (UTC)

Alternatively, you can do this numerically
 * $$\lim_{h \to 0}\frac{2^h-1}{h}$$
 * using a computer program
 * f[h_]=(2^h-1)/h
 * f[1]=1
 * f[0.1]=0.717735
 * f[0.01]=0.695555
 * f[0.001]=0.693387
 * f[0.0001]=0.693171
 * f[0.00001]=0.69315

Of course, a closed form ("closed form" means EXACT) solution would be much much better than a numerical solution. 202.168.50.40 00:38, 12 September 2007 (UTC)


 * Also(now that you know the answer) notice that $$\lim_{h \to 0}\frac{2^h-1}{h}$$ is equivalent to ln(2). —Cronholm144 03:37, 12 September 2007 (UTC)


 * Now, for extra credit, define a function f(x) by
 * $$f(x)=\lim_{h \to 0}\frac{x^h-1}{h}$$
 * for all values of x for which this limit exists and show that f(x) has the following properties:
 * f(x) is well defined (i.e. the limit exists) for all x>0.
 * f(x) is a continuous, montonically increasing function of x for x>0.
 * f(x)=1 for some value of x between 2 and 3.
 * f(x)+f(y)=f(xy) for all x,y>0.
 * df/dx = 1/x for all x''>0.
 * i.e. show that f(x) has the properties of a logarithm with base between 2 and 3. Gandalf61 08:16, 12 September 2007 (UTC)


 * I think 202.168.50.40's comment kind of misses the point - not due to falling back to numerical approximations, which is a valid path to try when all else fails, but because of the suggestion to use a computer program. This is a calculation that can hardly be done manually without familiarity with tools more advanced than the question, and if you are using a program then you might as well ask it to just differentiate the function. -- Meni Rosenfeld (talk) 09:14, 12 September 2007 (UTC)


 * I'm sorry if I gave the impression that the numerical solution can only be done with a computer program. I can calculate the numerical solution using only pencil and paper. However that would take time and since I'm not paid to solve the problem, I deliberately choose to use a computer program to save myself time. You do not need to use a computer to calculate the numerical solution. PS. On the other hand, you would be crazy to do it by hand. 202.168.50.40 00:51, 13 September 2007 (UTC)
 * Enlighten me. How would you numerically calculate $$2^x$$ manually - again, assuming that you are at the level where you don't know how to differentiate it symbolically? -- Meni Rosenfeld (talk) 08:03, 13 September 2007 (UTC)


 * I do not understand. Why do I need to calculate $$2^x$$ when all I want to do is to calculate
 * $$\lim_{h \to 0}\frac{2^h-1}{h}$$
 * Which I can do with this
 * $$\lim_{n \to \infty}\frac{2^\frac{1}{2^n}-1}{\frac{1}{2^n}}$$
 * and
 * $$2^\frac{1}{2} = \sqrt{2}$$
 * $$2^\frac{1}{4} = \sqrt{\sqrt{2}}$$
 * $$2^\frac{1}{8} = \sqrt{\sqrt{\sqrt{2}}}$$
 * 202.168.50.40 00:38, 12 September 2007 (UTC)
 * By $$2^x$$ I didn't mean the x from the original calculation, but rather just some small (not necessarily general) x, as you have done here for 1/2, 1/4 etc. Indeed, your method of calculation is good, but as I said, is more advanced than the question itself. In particular, much fewer people know an algorithm for calculating square roots than the way to differentiate $$2^x$$. -- Meni Rosenfeld (talk) 14:46, 13 September 2007 (UTC)

I remember this problem. Here's the way my math book explains:


 * $$f(x) = 2^x$$


 * $$f'(x) = \lim_{h \to 0}\frac{2^{x+h}-2^x}{h}$$

As you simplified:


 * $$f'(x) = \lim_{h \to 0}\frac{2^x(2^h-1)}{h}$$

But notice the 2^x term in the derivative. That is:


 * $$f'(x) = (2^x) \lim_{h \to 0}\frac{2^h-1}{h}$$

But 2^x is our function, so we can rewrite that as:


 * $$f'(x) = f(x) \lim_{h \to 0}\frac{2^h-1}{h}$$

That is, the derivative of our function is a constant (the limit is a constant) multiple of the function.

But notice that the limit we are looking for, is also the value of the derivative at zero. That is:

But f(0) is one, because two raised to the power of zero is one.
 * $$f'(0) = f(0) \lim_{h \to 0}\frac{2^h-1}{h}$$

So


 * $$f'(0) = \lim_{h \to 0}\frac{2^h-1}{h}$$

Putting it all together:
 * $$f'(x) = f(x) f'(0)$$

So how to find f'(0)? Well, let's try to get an estimate first. Let h=0.1 and we get about .7177. h=0.01 and we get 0.6956. h=0.001 and we get 0.6934. It appears to be approaching a number, so it seems plausible that the limit exists. And in fact solving for f'(0) in the equation above we get:

$$ \frac{f'(x)}{f(x)} = f'(0)$$

And since 0 f'(x).

I hope this helps.--Mostargue 21:38, 12 September 2007 (UTC)

Umm... actually I don't really know how to differentiate $$e^x$$. Could someone show me how to do that? --Yanwen 22:41, 12 September 2007 (UTC)


 * There's really not much to do. —Ilmari Karonen (talk) 00:20, 13 September 2007 (UTC)
 * Also take a look at the obvious article, derivative. Anyway, as was mentioned, $$\lim_{h \to 0}\frac{2^h-1}{h} = \ln{2}$$ so for $$f(x)=2^x$$ we have $$f'(x)=\ln 2\cdot2^x\,\!$$. -- Meni Rosenfeld (talk) 08:03, 13 September 2007 (UTC)

The way I was first shown how to do this is, let


 * $$y = 2^x$$


 * $$\ln{y} = x\ln{2}$$


 * $$\frac{1}{y}\, \frac{dy}{dx} = \ln{2}$$


 * $$\frac{dy}{dx} = y\ln{2}$$


 * $$\frac{dy}{dx} = 2^x \ln{2}$$

Product rule and log derivative. — metaprimer (talk) 04:50, 16 September 2007 (UTC)


 * How did you get from
 * $$\ln{y} = x\ln{2}$$


 * to


 * $$\frac{1}{y}\, \frac{dy}{dx} = \ln{2}$$?--Yanwen 18:19, 16 September 2007 (UTC)
 * Better late than never, I guess... You take the derivative of both sides. the derivative of the LHS is calculated using the chain rule (the outer derivative is $$\frac{1}{y}$$ and the inner derivative is $$\frac{dy}{dx}$$). -- Meni Rosenfeld (talk) 23:11, 21 November 2007 (UTC)