Wikipedia:Reference desk/Archives/Mathematics/2011 July 22

= July 22 =

Runge's phenomenon
I have a set of (X, Y) points, equally spaced on the X axis. These are measurements with a bit of noise on the Y part. I want to fit a curve to this, amongst other things to get a filtered position and slope at the one end of my set. I know what Runge's phenomenon is, but even when I use some of the proposed solutions (using B-Splines or lower order least squares polynomials) I still see a phenomenon that behaves similar: The end point and the fit at that point almost never match perfectly.

I think this is the least squares algorithm trying to "spread the error" out equally over X which means that it will almost always be a little bit off at the very ends. If I had the option of re-sampling then I could have used the Chevyshev nodes to samples denser at the ends.

I'm wondering if I could use weighting of points towards the ends to achieve a similar goal? That is, use a weight of 1 / sqrt(1 - sqr(x)) if the interval was (-1, 1). Of course, I would choose my interval to extend beyond the edge points by half a sample to avoid division by zero. 41.164.7.242 (talk) 12:37, 22 July 2011 (UTC) Eon
 * If you require the curve to go through the end points you could try a different type of spline, Non-uniform rational B-spline might be a good choice. --Salix (talk): 13:21, 22 July 2011 (UTC)
 * Not sure that NURBS is the answer here, especially since the data are equally spaced. Any least squares approximation can be tweaked to give different weights to the data points. the 1 / sqrt(1 - sqr(x)) weighting is interesting because it will give results similar to Chebyshev approximation for a least squares polynomial approximation. I'd say much depends on what type of data is being analyzed and how much of the Y measurements is noise, e.g. you'd data from the stock market differently than data from a chemistry experiment.
 * If the values at one or both of the endpoints is given rather than measured then you can apply a transformation to remove those points from the data. For example, if y(0) is known to be 1, then create a new set of data given by Z=(Y-1)/X, find a best approximation for Z, and write Y=1+ZX as your approximation for Y. In effect this gives different weights to the remaining data but you are considering non uniform weighting anyway.--RDBury (talk) 16:12, 22 July 2011 (UTC)


 * I realize after posting this that another way would be to redefine the measure of the "error" I'm trying to minimize with my set. The kind of errors I dislike are the low frequency trends and not so much high frequency noise. In fact, if I know the points are noisy then I would hope to have a noisy error in my fit. I almost could say I'm trying to minimize a filtered residual vector. Otherwise put, I want to assign weights in the frequency domain, not in the X domain. I'm indifferent about the point weighting technique - a very unequal weighting would mean I end up not really filtering and any noise present in the first point would probably dominate my estimate of the filtered Y value at the start of the interval. This is in contrast with resampling in a Chebyshev fashion where each sample is likely to have a similar noise. — Preceding unsigned comment added by Eonzo (talk • contribs) 21:08, 22 July 2011 (UTC)

Secret sharing with 32-bit arithmetic
I was reading this article on secret sharing: http://www.smartarchitects.co.uk/news/9/15/Partial-Passwords---How.html

Will this work as described with plain 32-bit arithmetic? Or does the algorithm require a finite field? 77.86.30.4 (talk) 12:50, 22 July 2011 (UTC)

Paradox?
I came across this problem while practising for a recreational maths competition: 2 real numbers are selected independently and at random from the closed interval [-2,1]. What is the probability that their product is positive? Their product will be positive if both from the interval [-2,0) or (0,1] and negative if one comes from each. P(+)=(2/3)^2+(1/3)^2=5/9 and P(-)=2(2/3)(1/3)=4/9. However this implies that P(+)+P(-)=1, or in otherwords that there is no possibility that the product is neither (i.e., 0), but as 0 is within the interval [-2,1] this is clearly not true. What is going on here? 24.92.88.206 (talk) 16:47, 22 July 2011 (UTC)


 * You've included the possibility of 0 in both your probabilites. If, as you say, I choose two numbers from say [-2, 0] I could do -2 x 0 = 0. So, it's not correct to say the product will be positive if both come from [-2, 0]. Of course, the same reasoning applies to the other sets. DavidB601 (talk) 17:21, 22 July 2011 (UTC)

You should ask yourself: What is the probability that a random number from a uniform distribution on a real interval is exactly one specific value (like 0)? For a subinterval of length x of an interval of total length l the probability of the number being in the subinterval is obviously x/l; if you want just a single number you have to shrink the length of the subinterval to 0, hence the probability will be 0. The relevant Wikipedia article is Almost surely. Icek (talk) 19:55, 22 July 2011 (UTC)


 * The "paradox" is explained if you remember that most real numbers need an infinite number of decimal places to express them. If you round your "real numbers" to (say) three decimal places before multiplying them, then the probabilities change, and there is a finite probability (about 0.0667% for 3 d.p.) that the product will be zero, and if you round to the nearest whole number then the product is more likely to be zero than not.     D b f i r s   11:34, 23 July 2011 (UTC)
 * The original poster didn't mention anything about decimal places, so I'm not sure why you bring them up. It is really true; the outcome whereby the product is exactly zero has probability exactly zero, and yet it is not impossible.  This refutes a misconception that many people have internalized, namely that probability-zero events are always impossible.
 * The word paradox is broad enough to cover such situations. Once you've made terms with them, though, they cease to be paradoxical, at least to you. --Trovatore (talk) 22:46, 23 July 2011 (UTC)
 * Yes, in mentioning decimal places, I was trying to explain that the source of the apparent paradox is the fact that nearly all real numbers require infinite decimal places, whilst nearly all of the ones that we meet in everyday life are represented by terminating decimals. Calculation of the probability of a zero product for rounding to increasing decimal places produces a sequence tending to zero.  I agree that the simplest explanation is Icek's (above) that there is zero probability of choosing zero from the interval, but this might seem counter-intuitive to non-mathematicians.    D b f i r s   06:41, 24 July 2011 (UTC)
 * While this is getting a little off the original point, I don't really agree that just "nearly" all real numbers have infinitely many decimal places. All real numbers have infinitely many decimal places.  The so-called "terminating" ones are really followed by infinitely many zeroes (or nines, as you prefer, with the exception of the real number zero itself, of course).  A real number is infinitely much information all rolled up in a tidy package; that's true even for the cases where the information is a bit repetitive.
 * The terminating decimal expansions we "meet in everyday life" are not really real numbers represented exactly by that expansion. They are more like "fuzzy" real numbers, representing an approximate range where the true value may lie.  They're not anything as precise as an exact interval where it must lie, more like a probability distribution &mdash; but not even as precise as that, because the probabilities don't have exact values either.  Exactly what sort of thing they are could no doubt be (and I expect has been) the subject of many a philosophy Ph.D. dissertation. --Trovatore (talk) 08:17, 24 July 2011 (UTC)
 * Yes, we could have a long argument about whether a terminating decimal is a real number, but this is not the place for it!  D b f i r s   16:47, 24 July 2011 (UTC)

Dipole field lines
Given a positive and a negative electric charge of equal magnitude, at positions $$\vec{r_0} = (-a, 0, 0)$$ and $$\vec{r_1} = (a, 0, 0)$$ in cartesian coordinates, I would like to know if there is a closed form solution for a (nontrivial) field line, i.e. a function y(x) or a parametric curve so that the tangent vector is always in the direction of the electrical field.

The electrical field is a vector field, and it is (disregarding the prefactors):

$$\vec{E}(\vec{r}) = \frac{\vec{r} - \vec{r_0}}{\left\vert\vec{r} - \vec{r_0}\right\vert^3} - \frac{\vec{r} - \vec{r_1}}{\left\vert\vec{r} - \vec{r_1}\right\vert^3}$$

For the function y(x) I get the rather cumbersome differential equation

$$y\prime = \frac{y \cdot ((y^2 + (x - a)^2)^{\frac{3}{2}} - (y^2 + (x + a)^2)^{\frac{3}{2}})}{(x + a) \cdot (y^2 + (x - a)^2)^{\frac{3}{2}} - (x - a) \cdot (y^2 + (x + a)^2)^{\frac{3}{2}}}$$

Thanks in advance for answers. Icek (talk) 20:37, 22 July 2011 (UTC)
 * You might try cross-posting at the Science help desk since this seems like more of a physics question. I'm probably not the person who should try to answer but my first instinct is to translate the problem into complex variables. Then the potential function is 1/|z-a|-1/|z+a| and the task is to find curves orthogonal to the level curves of that function. As I recall, the case with parallel wires can be done in closed form; the potential is ln|z-a|-ln|z+a|=ln(|z-a|/|z+a|)=Re(ln((z-a)/(z+a)) so the orthogonal curves have the form Im(ln((z-a)/(z+a)) = Arg((z-a)/(z+a)) = c. For point charges I don't think there is a closed form solution but there is if you let the distance between the points approach 0 while keeping the dipole moment a constant.--RDBury (talk) 22:56, 22 July 2011 (UTC)


 * If I understand you correctly then you have a vector field on R3 given explicitly by the expression
 * $$E({\mathbf r}) = \frac{{\mathbf r}-{\mathbf r}_0}{||{\mathbf r}-{\mathbf r}_0||^3} - \frac{{\mathbf r} - {\mathbf r}_1}{||{\mathbf r} - {\mathbf r}_1||^3} \, . $$
 * Where r0 and r1 are known and fixed, i.e. are initial conditions. It seems that you want to integrate this vector field. I don't understand why you write your solution as $$y'_a(x)$$. This implies that you have one independent and one dependent variable, and so you are working over R2 (with a as a fixed parameter). However, your initial conditions for r0 and r1 imply that you are working over R3. Once we've worked out the dimension of the space, we still need to know what r is. As far as I can see, r can be totally random. It depends upon the medium through which the electricity passes. I think you might need to add some hypotheses, e.g. a homogeneously conductive medium, etc. — Fly by Night  ( talk )  23:11, 22 July 2011 (UTC)
 * In lieu of further details, I recommend our article on the Frobenius theorem. If you have any more information to give us then please do so. RDBury is right that this might be a physics question, but that just because there seem to be many unspoken assumptions. If you give us all of the hypotheses then we will be able to help you. — Fly by Night  ( talk )  01:48, 23 July 2011 (UTC)
 * The reason the OP writes y'(x) is that the problem is radially symmetric around the first coordinate so one of the coordinate directions (such as z) can be ignored. Conductivity is not involved in any sense.  There are 2 point charges in a vacuum.  But you can really totally ignore the physics if you want to since he/she supplied the vector field explicitly.  Unfortunately I'm useless at differential equations. Rckrone (talk) 02:56, 23 July 2011 (UTC)

@Fly by Night: You can consider it as a purely mathematical problem of finding a curve of which the tangent at any point is parallel to the value of the vector field at that same point. I am working over R3.

r0 and r1 are just (vectorial) constants used to specify the vector field, and a is a real positive constant used to specify r0 and r1.

I said I try to find a nontrivial solution, but we can say more specifically that a condition is that $$\mathbf{r_c}$$ lies on the curve and $$\mathbf{r_c} = (0, b, 0)$$ with some real constant $$b \neq 0$$. It would be the trivial case if $$b = 0$$.

What follows now is not part of the problem, but of an attempt at solving it:

As Rckrone has said, the problem has cylindrical symmetry so we can ignore one dimension. I call the 3 cartesian coordinates x, y and z, and I choose to ignore z. If I describe the curve by expressing the y coordinate as a function of the x coordinate, then $$\frac{dy}{dx}$$ is equal to the ratio of the components of the vector field in y and x direction, for short:

$$y\prime = \frac{E_y}{E_x}$$

Substituting the components of the vector field leads to the differential equation that I expressed in my original question. The initial condition for this differential equation is y(0) = b.

Icek (talk) 20:53, 23 July 2011 (UTC)
 * Mathematica is unable to find a solution to this equation. Note, however, that it is straightforward, although computationally cumbersome, to find a series representation to arbitrarily many terms (for $$a=1$$):
 * $$y(x)=b-\frac{3b}{2(b^2+1)}x^2-\frac{21b(3b^2-1)}{24(b^2+1)^3}x^4-\frac{495(13b^5-10b^3+b)}{720(b^2+1)^5}x^6+\cdots$$
 * I think it should be possible, and perhaps more useful, to express this as a series in $$x^2-1$$. -- Meni Rosenfeld (talk) 09:33, 24 July 2011 (UTC)
 * It may be interesting to expand this in powers of b and write:
 * y(x) = y1(x) b + y3(x) b^3 + y5(x) b^5 + ...
 * and then see if one can get closed form expressions for the functions y_r(x). Count Iblis (talk) 15:33, 24 July 2011 (UTC)