Wikipedia:Reference desk/Archives/Mathematics/2015 May 26

= May 26 =

3d Rotation of Point around a Line
I feel tremendously foolish having to ask this, but it is not something I usually work with and am having an oddly hard time for some reason. I have a point (x, y, z) and want to rotate the line going through (x, y, z) and intersecting the line (t, t, t) [t variable] around (t, t, t) - if possible, is there a formula, in terms of the point being rotated and the change in angle that gives the result? (and what is the angle that xyz is at relative ttt? I was mucking around with spherical coordinates, but it seems this would be the better approach). I have a difficult time connecting geometry (pictured in my head) up with formulas for some reason, so I apologize if is this is unclear. Thank you for any help:-)Phoenixia1177 (talk) 03:16, 26 May 2015 (UTC)


 * Yes, it is unclear, at least to me. Is the point rotating about a line, or the line about the point ?  And what does (t,t,t) mean ?  Just going with the problem in the title, you could first find the plane normal to the line, through the point.  Within that plane, you could project the point (normal) onto the line (you could also do that in 3D, if you prefer).  Then find the distance between the point and it's projection, and create a circle of that radius centered on the projected point (or a sphere in 3D which you then intersect with the plane).  Quite a few steps, but each is relatively straightforward. StuRat (talk) 04:09, 26 May 2015 (UTC)


 * This is why I usually stay far away from routine geometry:p. (t, t, t) is the line specified by f(t) = (t, t, t). I have a line passing through this line and a point (x, y, z) off the line, given a parameterization of this line, I'm asking for how to express an arbitrary point on a rotation of the line in terms of the difference in angle, the point (x, y, z), and, ultimately, the parameter value of the point rotated.Phoenixia1177 (talk) 05:02, 26 May 2015 (UTC)


 * So you have a fixed line (the one parameterized by (t, t, t)) through the origin such that the angles between it and each of the positive axes are all equal. You have a point off the line, and a line through the point that intersects this line.  Where does it intersect this line?  Or is it at right angles to it? It is not clear what angles you are referring to, so perhaps you can elaborate?  There is an angle of rotation around the fixed line, but you also need to define the starting point of the rotation if you're using that.  —Quondum 06:04, 26 May 2015 (UTC)


 * I feel doubly foolish, I'm leaving something out of this! The problem is the following: Let A be the line throught the origin, p a point, g a function from the reals^3 to A, and B the line through p and g(p). Suppose B is parameterized as f(t), given s, where does f(s) go when you rotate B around A, in terms of the change in angle, p, and s? Does that make more sense?Phoenixia1177 (talk) 06:25, 26 May 2015 (UTC)


 * It might be helpful have a look at rotation group SO(3), see also rotation matrix and linked articles. YohanN7 (talk) 11:33, 26 May 2015 (UTC)
 * I get the transformation matrix
 * $$\begin{pmatrix}

{1 \over 3} + {2 \over 3}\cos \theta & {1 \over 3} - {1 \over 3}\cos \theta + {1 \over \sqrt{3}}\sin\theta & {1 \over 3} - {1 \over 3}\cos \theta - {1 \over \sqrt{3}}\sin\theta\\ {1 \over 3} - {1 \over 3}\cos \theta - {1 \over \sqrt{3}}\sin\theta & {1 \over 3} + {2 \over 3}\cos \theta & {1 \over 3} - {1 \over 3}\cos \theta + {1 \over \sqrt{3}}\sin\theta \\ {1 \over 3} - {1 \over 3}\cos \theta + {1 \over \sqrt{3}}\sin\theta & {1 \over 3} - {1 \over 3}\cos \theta - {1 \over \sqrt{3}}\sin\theta & {1 \over 3} + {2 \over 3}\cos \theta \end{pmatrix}$$
 * to rotate through angle θ while fixing (1, 1, 1). The idea is you apply rotations to move (1, 1, 1) parallel to (1, 0, 0), apply a rotation through angle θ about the x-axis, then apply the inverse of the first rotations. The general formula is in the Rotation matrix page, but it's not the kind of thing that's covered in the standard math curriculum. --RDBury (talk) 12:36, 26 May 2015 (UTC)
 * I believe the $$ \sin\theta$$ terms in your matrix should have their signs reversed (assuming standard convention of counter-clockwise rotations). Can you check? Abecedare (talk) 16:30, 26 May 2015 (UTC)
 * I wasn't keeping track of clockwise vs. anti since it depends on from which direction you're looking at the axis, but I'll take your word for it. --RDBury (talk) 19:55, 26 May 2015 (UTC)

searching for a number in an unlimited range
StuRat's answer to the base conversion question above prompts this question. Suppose I'm looking for the floor of an unknown positive real number; and my only tool is an oracle that tells me whether my guess is low or high. What's my best sequence of guesses? Start with 1, double my guess until the oracle says "high", and then do binary search? —Tamfang (talk) 08:09, 26 May 2015 (UTC)
 * What do you mean by "best"? The two most obvious options are shortest worst-case running time and shortest average-case running time, but the former is impossible and the latter requires a probability distribution on your inputs. Algebraist 09:38, 26 May 2015 (UTC)
 * Agree with Algebraist on that but if you're doing the original problem of converting to binary and take a constant time per digit once you've started your binary doubling method at least only multiplies the total conversion time by a constant amount. WIth most anything else it seems hard to get any reasonable limit when the numbers might range up to say 2 to the power of googleplex with some weird distribution. Dmcq (talk) 10:22, 26 May 2015 (UTC)
 * As mentioned it depends on the distribution and there is no generic answer. At best you can hypothesize about the distributions you are likely to encounter in practice. And for those, I suspect trying to apply your method on the logarithm of the value is a safer bet (equivalent to starting by squaring each time, etc.). You can for convenience switch to binary search on the value itself once the range is narrow enough.
 * Alternatively, you might try an optimization criterion based on regret. I haven't completely fleshed it out, but: Choose a family of distributions, and for any technique under consideration and given positive real, find the distribution for which the difference in number of steps between the optimal technique for this distribution applied to the chosen real, and what your technique did, is minimal. This minimal value is your regret. It's possible that for any possible technique, the regret over all possible real numbers is bounded; find the technique with the minimaximal regret. (This is inspired by Multi-armed bandit problems, not sure if the intuition truly applies here.) -- Meni Rosenfeld (talk) 14:34, 26 May 2015 (UTC)


 * Looks like we need a links to regret and minimax. StuRat (talk) 15:24, 26 May 2015 (UTC)

Best Buy
What is the 'best buy' out of the following.

1.	One Sachet consisting '18g' of Horlicks costing '£12'.

2.	One Sachet consisting 100g of Horlicks costing £80.

3.	On tub of Horlicks of 400/450g costing £370/380.

I believe it is number (1). Am I right?

Mr. Prophet (talk) 11:09, 26 May 2015 (UTC)
 * You are - but how did you arrive at that conclusion? 196.213.35.146 (talk) 12:05, 26 May 2015 (UTC)
 * 1) You have to be broke as a joke, and 2) think of what Stu said thereafter if your brain doesn't function... -- Mr. Prophet (talk) 18:29, 26 May 2015 (UTC)


 * You divide the price by the quantity to get the price per quantity. Of course, there are also other factors, like not wanting to buy more of something you can use before it spoils, loses potency, etc., and, as mentioned above, larger quantities may have better packaging, come with free shipping, etc.  (I'd just add all the shipping, handling, taxes, etc., in, then divide by the quantity, to find the total price per quantity.)


 * There is some strange pricing going on with your examples, where the more you buy the more expensive it seems to get. StuRat (talk) 12:59, 26 May 2015 (UTC)


 * It's also the world's most overpriced Horlicks: you can get 500g for £3.50. Maybe "Horlicks" is some kind of euphemism . AndrewWTaylor (talk) 13:05, 26 May 2015 (UTC)


 * I should've stated 'Say for Example:'; I'm in a different country... -- Mr. Prophet (talk) 18:29, 26 May 2015 (UTC)


 * The thing is, those Horlick tubs are mighty useful for storing things, so it may be worth the extra money to get them instead of the sachets where you just throw away the empties. --RDBury (talk) 12:44, 26 May 2015 (UTC)


 * I agree but I don't have anywhere to keep it... Maybe when I go back home. Thank you for the reminder! -- Mr. Prophet (talk) 18:29, 26 May 2015 (UTC)


 * One use for such jars is for food you intend to toss out. I find that sealing it up like that prevents fruit flies from breeding there, and the stench of rotting food doesn't get out as much.  To make it even more effective, put it in the freezer until garbage collection day.  (A garbage disposal and/or flushing food scraps down the toilet and/or composting them are other approaches.) StuRat (talk) 19:16, 26 May 2015 (UTC)


 * To be honest, the idea does not sound mind blowing, guessing that it concludes with the words 're-clean', 'reuse' or 'recycle' the tub. Since you mentioned, I've used 'disposable plastic containers' and the 'toilet' many times, I still ask you for an opinion since I'm not happy, "where and or how do I throw 'hot' 'boiling' 'fat'?" -- Mr. Prophet (talk) 18:26, 27 May 2015 (UTC)


 * You definitely don't want to flush that or pour it down the drain, as it can cool and harden in the pipes and cause a nasty clog. I'd let it cool a bit, then pour it into the tub and seal it (if the top of the fat has hardened, use a paper towel to wipe it out of the pan, after breaking through it to pour out the liquid underneath).  You could leave it out until trash day, as it probably won't stink (it might even smell good), until it goes rancid, which could take months.  If you don't like the smell, then freeze it until trash day.  Of course, many cooks like to save fat for a later recipe, but I assume you're not one of them. StuRat (talk) 00:18, 28 May 2015 (UTC)


 * Yeah I know, it clogs up the kitchen sink... I'll save it from now just in case if I ever have to deal with uninvited guests. The smell of the fat is okay, no complaints, I did for the 'off' food, but I still think I won't use a tub, cause I will have to throw it because its a plastic tub that costed £3.50/its hard to clean and the stain stays/the fact of re-cleaning and the smell/I'll use a disposable plastic container and probably pretend its a takeaway container and either throw it outside somewhere in the bin or keep it at home if it doesn't stink/keep it in the fridge until the right time... Thanks Stu; I think I'll pour it into another pan and wait until the fat warms up or something, or double/treble the disposable plastic container (I never thought of this). -- Mr. Prophet (talk) 07:29, 28 May 2015 (UTC)


 * I get more than enough of those plastic tubs (coffee cans, in my case) from work. You might ask for the extras from your job, too.  It seems silly to be wasting a new container (even a disposable one), when you don't need to.  Take home containers from restaurants are another option. StuRat (talk) 17:33, 29 May 2015 (UTC)


 * (Lol) You sound like an environmental friendly guy, well so am I, I can't kill a fly. I understand what you are saying and I appreciate your advice; I may do so if I ever need one, probably get a glass tub. I hope you know why a glass one is preferred than a plastic one. You can search for it yourself if you have a good enough internet service or let me know if you don't have a reliable internet access or if you can't be bothered, I'll explain it in simple terms. My brain is not working right now, I am sleepy right now, just typing with my fingers, not with my brain... Gonna check WP then off to bed! Speak to you soon buddy. -- Mr. Prophet (talk) 19:44, 29 May 2015 (UTC)


 * Yes, I'm quite aware of how the plasticizers leach out into the food. But since I'm only using them to hold garbage for trash day, it's not a problem.  As for the environmental impact, those plastic jugs would have been tossed out anyway, so me taking them home and adding garbage to them doesn't add to the landfill.  I go out of the way to find food in glass jars.  I used to buy applesauce in them, but then they switched to plastic, and I stopped eating applesauce.  I also collect old liquor bottles I use to store water for an emergency (I had to use that water once when our water was cut off). StuRat (talk) 04:10, 30 May 2015 (UTC)
 * You sound like my twin with discrepancies. -- Mr. Prophet (talk) 18:16, 30 May 2015 (UTC)

Thanks friends, love you all! (not in a gay way ) -- Mr. Prophet (talk) 18:29, 26 May 2015 (UTC)