Wikipedia:Reference desk/Archives/Mathematics/2017 April 29

From Wikipedia, the free encyclopedia
Mathematics desk
< April 28 << Mar | April | May >> April 30 >
Welcome to the Wikipedia Mathematics Reference Desk Archives
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


April 29[edit]

Trouble with Wolfram Alpha, calculating height of spherical cap[edit]

The volume of a spherical cap of height and sphere radius is

I want to solve for . So I plug it into Wolfram Alpha here: https://www.wolframalpha.com/input/?i=v+%3D+pi%2F3+*+h%5E2+*+(3*r-h),+solve+h

The solution is kind of ugly but can be simplified parametrically as

where

The problem is that part under radical . It's always a negative number no matter what I plug in.

For example, if then . But plugging those values in results in a negative square root argument, .

The weird thing is, I've used this before, and it worked. I'm wondering if I made a typo that I'm just not seeing. ~Anachronist (talk) 00:24, 29 April 2017 (UTC)[reply]

You apparently have an example of casus irreducibilis, in which a cubic equation with three real roots can only be solved algebraically by invoking imaginary numbers. Notice that your non-real expression a appears twice in the solution for h; while it is not obvious, the imaginary parts cancel out, and the expression for h is real. To avoid imaginary numbers, you can use the trigonometric solution in Casus irreducibilis#Non-algebraic solution in terms of real quantities. Loraof (talk) 01:14, 29 April 2017 (UTC)[reply]
  • The article you linked gives the area formula as
This doesn't seem to agree with the area formula you gave. Loraof (talk) 01:37, 29 April 2017 (UTC)[reply]
@Loraof: look further down... the formula you quoted uses r as the base radius of the cap. Further down there's a formula using the radius of the sphere, which is what I started with above. I'm trying to get the height of the cap, knowing only the volume and the sphere radius.
Thanks for the suggestion to try Casus irreducibilis#Non-algebraic solution in terms of real quantities. Unfortunately, that seems to work for problems that can be expressed as whereas the formula here has in the middle term squared. ~Anachronist (talk) 01:52, 29 April 2017 (UTC)[reply]
You just need to perform a substitution to depress the cubic, as stated in the very same article. Double sharp (talk) 05:15, 29 April 2017 (UTC)[reply]
@Anachronist: Actually if you know the sphere's radius r, the sphere is fixed; then if you know the volume of the cap, you know the height, so there is only one real solution. The presence of only one real solution is confirmed by the discriminant formula in the casus irreducibilis article, meaning that you don't have casus irreducibilis. So Wolfram's formula must be a non-conventional way of writing the solution, which normally should not involve complex numbers. I'll try to work out the conventional formula. Loraof (talk) 17:18, 29 April 2017 (UTC)[reply]
So sorry, for at least some cases there really are three real solutions, though two or them are outside the geometrically meaningful range. Loraof (talk) 01:29, 30 April 2017 (UTC)[reply]
@Loraof: Thanks. After messing with this some more, I gave up in frustration and discarded my model of partially-filled vessel as a spherical cap (or bowl, actually), and instead approximated the shape with a few stacked truncated cones. A truncated cone has a simple clean solution for height as a function of volume. That approximation will serve my purposes. ~Anachronist (talk) 09:04, 30 April 2017 (UTC)[reply]
@Anachronist: As I mentioned earlier, with three real roots, the case you have, you can get a calculator-friendly formula for h using the trig formula given in the casus irreducibilis article. Your equation is
Using h = x + r gives
Letting and using the trig formula gives
for each of k = 1, 2, 3. One of those k values will give you an answer with 0 < h < 2r, and that is the answer you are looking for. Loraof (talk) 21:03, 30 April 2017 (UTC)[reply]
That's amazing, thanks. When I looked at the casus irreducibilis formula, I wasn't sure if it was valid to create new parameters as different (and interrelated) functions of r. I appreciate the advice.
It's also amazing to me that such a simple geometry requires such a messy-looking solution. At first glance, the problem "derive a formula for the height of a spherical cap, given its volume and radius" sounds like a high school math problem, but it turns out to be quite a bit more advanced than high school math (at least, when I went to high school decades ago). ~Anachronist (talk) 00:22, 1 May 2017 (UTC)[reply]

Chain Rule for Canonical Form[edit]

I am a bit confused about the principal part of the PDE, and what its roots mean for the dy/dx = λ , and and how that came about. I understand that the sign of the discriminant b squared minus 4ac determines whether the PDE is Hyperbolic, Parabolic, or Elliptic, but as to the roots of from the related quadratic equation, I am a bit mystified. I understand that the roots are used to determine the coefficients of x in PDE's that might have general solutions such as f( m1x + y) + g(m2x + y ), where m1 and m2 are the roots, and therefore the coefficients of x in this form of solution, but as to stuff about the canonical form, I am confused. I see that for this, where we have the principal part of the PDE of second order being Auxx + Buxy + Cuyy, where for example, uxx is just the second partial derivative of u with respect to x, and so on, then we have a change of coordinates, letting xi = xi(x,t), and tau = tau(x,t), so that in terms of these new coordinates, by the Chain Rule, we have : ux = xix*Uxi + taux*Utau, and ut = xit*Uxi + taut*Utau, and that makes sense, but then I do not get why the second derivative of u with respect to x is what it is. I thought it would simply be partial d/dx of this ux expression, but done by the power rule, so that d/dt[xix*Uxi], would be in the form of f'g +g'f, with f = xix, and f' = xixx, being the its derivative with respect to x, and therefore that g = Uxi, and g' = Uxi,x, being the its derivative with respect to x, that is, partial d squared U over partial xi partial x. I hope this is clear, and I am sorry I have not been able as yet to master Latex, so I can only portray the derivatives in another way I hope can be understood. So what I do not understand is why the uxx has squared terms, and other things, and where it has come from. From this, also, what the Canonical Form means, and what it is meant to look like. Thank You. Chris the Russian Christopher Lilly 06:07, 29 April 2017 (UTC)[reply]

@Christopher1968: If you are not comfortable using LaTeX, then I suggest using subscript notation. Subscripts can be inserted using the <sub> tag. For example, the second partial derivative of u with respect to x is denoted as uxx. It's very hard to follow what you're saying, especially with the additional subscript i.--Jasper Deng (talk) 09:46, 29 April 2017 (UTC)[reply]

Is the following Subset Sum Problem variant NP-hard?[edit]

Is the following problem NP-hard:

Input:

Question: is there a multiset of indices , such that and ?

For example, on the input , we can take and thus we get and , as desired. 213.8.204.26 (talk) 07:28, 29 April 2017 (UTC)[reply]

@213.8.204.26: Since you are asking for a multiset, I am assuming we can only have linear combinations of members of A with nonnegative coefficients. Then this problem is known as the unbounded subset sum problem and is NP-complete. I am not sure exactly why; Knapsack Problems gives a proof of this, and that text is very reputable, but that particular proof seems to be flawed (or I am misunderstanding it). A few months ago, I asked your question to Christos Papadimitriou and he told me it's NP-complete, and that it can be founded in Computers and Intractability (although a perusal of that book by me failed to turn it up; I might have looked at the wrong edition or something). See also the coin problem, which is NP-hard and is very related to this problem.--Jasper Deng (talk) 08:44, 29 April 2017 (UTC)[reply]
@213.8.204.26: Actually I misread your original question: you are requiring that the multiset have a specific size. However, that remains NP-hard, because this is basically a decision version of the change-making problem, which is an NP-hard optimization problem.--Jasper Deng (talk) 19:24, 29 April 2017 (UTC)[reply]

Remove peaks from data/rank articles by pageviews[edit]

Let's say I want to rank Wikipedia articles by their mean pageviews (from most popular to least popular). But there are such articles as Dr. Seuss, that makes this list not so reliable (if using standart mean formula). What could you suggest to have those peaks "removed"? --Edgars2007 (talk/contribs) 21:08, 29 April 2017 (UTC)[reply]

I'm guessing the days with peaks ten times higher than the typical pageview counts were days when Dr. Suess was in the news. I would argue that that's part of the article's popularity, and that you should not remove the peaks. But if you don't like the peaks, you could compute the median number of pageviews for each article, and compare them. Loraof (talk) 22:25, 29 April 2017 (UTC)[reply]
The median, or any other robust statistics. — Preceding unsigned comment added by 2601:184:4980:7220:8985:A0E6:B3F7:E214 (talk) 00:20, 30 April 2017 (UTC)[reply]
Yes, I don't have anything much in my statistics background, so I may say something silly, but. Median doesn't sound like a good option. I was thinking about something like this: if I see some peak, that is X times higher than typical (average?) number of pageviews, remove it and recalculate average value again. Maybe somebody could translate it to mathematical expressions? I won't do it by hands/in Excel, that will done in Python programm, so it doesn't have to be something very very simple. And wouldn't standard deviation help in some way? --Edgars2007 (talk/contribs) 09:43, 30 April 2017 (UTC)[reply]
That is the sort of thing that led to scientists not noticing the Antarctic ozone hole for nearly a decade. Why do you want to completely ignore 'outliers' when calculating popularity - what exactly does it mean to you? Anyway how about doing a Moving average if you want to consider longer time periods or see Exponential smoothing. Dmcq (talk) 11:58, 30 April 2017 (UTC)[reply]
I want to remove them, because in my case I treat popularity as "notability" of subject (let's not discuss how good or bad observation is that). If article A is viewed 1,000,000 times in a year and views doesn't have any big peaks, it's more popular/notable than article B, that is viewed 1,100,000 times in a year, but with peaks for ten days, each of them is let's say 100,000. So in my list I would like to rank article A higher than article B. --Edgars2007 (talk/contribs) 15:24, 30 April 2017 (UTC)[reply]
Perhaps this is going off-topic, but Wikipedia already has well establish criteria for what should be an article and number of hits is not one of them. This isn't TigerBeat.com and we don't have an article on Rydell Lynch's night routine, though if we did it would probably get more page views than Spectral theory of ordinary differential equations. That's not to say that there's no correlation at all and a page which gets less than 100 views in a year shouldn't have its notability checked, but page views isn't, and shouldn't be imo, a criterion for inclusion. --RDBury (talk) 18:02, 30 April 2017 (UTC)[reply]
Don't get me wrong, this data/rank is only for my use, it won't get used to propose something to AfD or put some maintaince tags. If somebody else uses this data to do that, that's his problem :) --Edgars2007 (talk/contribs) 19:43, 30 April 2017 (UTC)[reply]
Smoothing should give you plenty of ideas. Or you could calculate the average and standard deviation using the full data set, then remove all points outside x number of standard deviations from the average, and then repeat until the data set and average stabilize.--Wikimedes (talk) 20:28, 30 April 2017 (UTC)[reply]
For really large spikes, median would probably be a better starting point than average; using the average might lead to throwing out the entire data set on the first iteration.--Wikimedes (talk) 21:14, 30 April 2017 (UTC)[reply]