Jump to content

Wikipedia:Reference desk/Archives/Mathematics/2007 January 8

From Wikipedia, the free encyclopedia
Mathematics desk
< January 7 << Dec | January | Feb >> January 9 >
Welcome to the Wikipedia Mathematics Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


January 8

[edit]

Correlation between two binary variables

[edit]

Is r an appropriate correlation coefficient to use when the values of both variables are limited to 0 and 1 and represent membership (1) or non-membership (0) in two sets? If not, what coefficient would be better? NeonMerlin 01:08, 8 January 2007 (UTC)[reply]

Is there some hypothesis you're testing? While Pearson's correlation coefficient is probably not unreasonable in practice, it lacks theoretical underpinnings for this case. Depending on the outcomes of the pair of values, you have four counts: N00, N01, N10 and N11. A reasonable measure of agreement is then (N00−N01−N10+N11)/(N00+N01+N10+N11), which runs between −1 when all values disagree, and 1 when all agree. This can yield values that are very different from Pearson's r; for example, when N00 = 0, N01 = N10 = 17 and N11 = 66, you have r = −0.20, while the above agreement measure yields the value 0.32. If you have some hypothesis and a reasonable "null hypothesis" model for the process underlying the variables, it might, perhaps, be possible to base the choice on some theoretical argument. If your purpose is to gain insight in the data, just try which fits your intuition best.  --LambiamTalk 05:42, 8 January 2007 (UTC)[reply]
Suppose that the total N = 100, the two sets are independent, and each has p = 0.1. Then the expected values would be N00 = 81, N01 = N10 = 9, N11 = 1. Your measure would give .64, indicating a strong positive correlation. What I like about something like r is that when the two sets are independent, I should always get a value of around zero. NeonMerlin 08:17, 8 January 2007 (UTC)[reply]
Pearson's r has that property, so unless there is something more to it we don't know, it is probably reasonable to use it. You should be aware that the distribution of the coefficient under the assumption of independence is rather different from what you get for normally distributed variables.  --LambiamTalk 12:50, 8 January 2007 (UTC)[reply]
I think what you have is a contingency table and you want to find if there is a contingency (i.e. non-independence) between two categorical variables. I think you can use something like Pearson's chi-square test, G-test, or Fisher's exact test. --Spoon! 07:50, 17 January 2007 (UTC)[reply]

complex numbers

[edit]

the profit, P, for manufacturing a wireless device is given by the equasion P= -10Superscript text + 750x - 9,000, where x is the selling price, in dollars, for each wireless device. What range of selling prices allows the manufacturer to make a profit on this wireless device?

And how do you grapf the above equasion? —The preceding unsigned comment was added by 207.69.139.150 (talk) 03:32, 8 January 2007 (UTC).[reply]

I think something went wrong when editing the equation, because the bit about "Superscript text" does not make sense. Also, read what is written at the top of this page about posting entire homework questions.  --LambiamTalk 05:46, 8 January 2007 (UTC)[reply]
Also, I take it by "complex numbers" you mean complicated numbers, as opposed to the usual math meaning, which is "numbers with a combination of real and imaginary components". StuRat 08:57, 8 January 2007 (UTC)[reply]
Perhaps the money involved is partly imaginary. (Seriously though, assuming the superscript text is supposed to be x squared, you should probably take a look at Quadratic equation or Quadratic polynomial. The range where you may make a profit is the range where the profit is greater than zero.) - Rainwarrior 09:13, 8 January 2007 (UTC)[reply]
To graph P as a function of x, you need a piece of paper on which you have drawn an x-axis and a y-axis. The ordinate (reading on the y-axis) will represent P. (For this case, I suggest you let the scale of the x-axis run from 0 to 75, and that of the y-axis from −9000 to +6000. So they are very different scales. Then you take various values for x and compute P for each one. I suggest you let x go up from 0 by steps of 15 to 75. For good measure, also do the case x = 37.5. Then, for each combination (x, P), put a dot at the corresponding point (x, y) on the piece of paper. Finally, connect the dots with a smooth curve. In some ways the curve should look similar to what you see in the graphs in the article Quadratic equation, but in one important respect it should be quite different.  --LambiamTalk 13:08, 8 January 2007 (UTC)[reply]

see Completing the square. 202.168.50.40 03:04, 9 January 2007 (UTC)[reply]

Area inside various curves

[edit]

Hello,

I was wondering how to calculate the area bounded by different curves (for example, polar or parametric).

I found the article area (geometry) to give the answers, such as the area bounded by a function r(θ) expressed in polar coordinates is and the formula .

But I haven't got a clue where these formulas come from (one part suggests the ready of Green's Theorem but I don't really understand that either).

Could someone possibly explain where these formulas come from (and how to use them) ? An example would be perfect (maybe the area inside the curve defined in polar coordinates as r = 1 + cos(θ) (or whatever else).

Thanks --Xedi 21:51, 8 January 2007 (UTC)[reply]

I have but a minute, so I can only answer the polar one, but at least it's something. Okay, you have the formula for the polar one up. Here's how we will do it. Draw a nice big circle on a piece of paper. Then make two radii right near each other. The length of each one is r, the radius. Now what we do is move them closer and closer to eachother, so that the arc bounded by them approaches 0. This has two affects. First, the arc length approaches the length of the segment connecting radius 1 and radius 2. As a result, the arc area can be approximated as 1/2 r2 times the length of the segment connecting them, which approaches zero. So you basically pull out the 1/2, the d\theta represents the arc/segment length, and you integrate that portion and evaluate from x to y, the bounds of the problem. I wish I could import a picture, but I am computer challenged. ;) Maybe someone else can(?) In any case, I hope that helped clear the fog, if only a little. Ask questions if I wasn't clear, I'll check back later. --AstoVidatu 23:03, 8 January 2007 (UTC)[reply]

Your formula for polar coordinates should integrate one-half r2, as AstoVidatu referenced but didn't explicitly say. (Consider the unit circle: r=1, but the area is but π, not 2π.) --Tardis 00:26, 9 January 2007 (UTC)[reply]
See Polar coordinate system#Integral calculus. —Mets501 (talk) 03:08, 9 January 2007 (UTC)[reply]
Thanks, now I'm clear about the polar integral.
I found the area inside the curve r = 1 + cos(θ) to be 3π/2, hope it is the good result.
But what about the parametric form ? This time I don't really know where to start (I mean, with cartesian you have rectangles and with polar, sectors, not so with parametric).
Thanks again --Xedi 17:49, 9 January 2007 (UTC)[reply]
Hmm, another thing, what about self intersecting curves ? For example, r = 0.5 + cos(θ) ? Is the inside "half lemniscate" counted twice (I suppose it is, it wouldn't be difficult to just take some area away after, between 2π/3 and 4π/3) ? --Xedi 18:36, 9 January 2007 (UTC)[reply]
For a self-intersecting curve like your limaçon with an inner loop that twirls around in the same direction, the inner part is indeed counted twice. An outer loop, which reverses direction, is counted with a weight of −1, but that cannot happen if the curve has a polar representation.
For the parametric form, the following is not a proof, but a sketch of why this holds. Assume we have a parametrically represented closed curve, which, with increasing parameter, goes around in the positive direction (at the top it is moving to the left left and at the bottom to the right). Let us furthermore assume it is very smooth; it does not wiggle around but keeps its curvature always non-negative. Then, for some value of parameter t, say at t = tmax, the value of x attains its maximum x = xmax, and likewise at t = tmin we have the minimum x = xmin. For each value of x between these two extremes there are two possible values for y, a high one and a low one. The area inside the curve is then
Without loss of generality we can take t0 = tmax < tmint1. Then at t = t1 the value of x is back again to the starting value xmax. With a change of variables, we can rewrite the formula as
Use to obtain the other forms.  --LambiamTalk 20:58, 9 January 2007 (UTC)[reply]
Ok, thank you very much ! All understood. --Xedi 21:12, 9 January 2007 (UTC)[reply]
If you have ever worked very much with integrals, you probably know that (for humans, not computer algorithms) solving them is often an art acquired by experience. We look at the specific instance and decide how best to attack it.
Let's take a look at your cardioid, r = 1+cos θ, which our article claims should have area 32π. Not given there is the cartesian equation, (x2+y2−x)2 = (x2+y2). This shape is a simple closed curve, which makes our job reasonable.
Better still, we can slice it up with radial slivers from the origin, as AstoVidatu and Mets501 suggest. Most shapes are not so accommodating, but let's take advantage of our good fortune. The idea of integrating an area with a complicated boundary is to approximate it with a partition into simple pieces whose area we can easily state. Here, each radial sliver looks like a very thin sector of a circle, but for each sector we have a circle of a different radius. In fact, we simplify further still, and just use the triangle whose side opposite the origin is the sector chord. This is an isosceles triangle, whose height is r and whose base is our differential angle dθ at distance r, r dθ. (Of course, r depends on θ, so varies from sliver to sliver.) Thus the area of a sliver is 12r2 dθ, and the area of the cardioid accumulates all the slivers in an integral:
So for this curve, a quick and relatively painless polar integration approach works well.
But let's try using Green's theorem, which is much more powerful and general. It says that instead of trying to accumulate little pieces of a function over an area, we can accumulate little pieces of a related function along the boundary of that area. In this case the area function is trivial: it is the constant 1. Green's theorem says we should write that as the difference of two partial derivatives (of one function, M, with respect to x and of another, L, with respect to y). Fine, we'll use something trivial:
Then the idea is that we integrate along the boundary (the cardioid curve itself) like so:
How can we do this? One approach is to split the full shape into top and bottom (which are mirror images), then write y as a function of x. Because the curve "folds under" itself from −14 to 0, we actually need to split the top into two sections, the main arc and the small folded under piece:
We can make this work if we must, but the integrals get nasty.
A less demanding approach is to write x and y as functions of a parameter t:
Noting that
we can expand −y dx in terms of t and simplify to get our integral,
Comparing our polar integration with our two variations using Green's theorem, clearly in this example we would choose the former. But when that is not available, perhaps these alternatives give some idea of how we may proceed. --KSmrqT 04:59, 10 January 2007 (UTC)[reply]
Thank you very much for the example. I did the same calculation to get the area, with the polar coordinates. It is true that the other formulations are quite more complicated to work with in this case. --Xedi 13:13, 10 January 2007 (UTC)[reply]

Identities

[edit]

i have tried to work this out for a long time, and i can't figure out how to prove this equation: cos²x-sin²x = 2cos²x-1 im really more of a right-brain person, so sorry if this question seems kind of simplistic compared to some of the other questions in this section.--Technofreak90 23:13, 8 January 2007 (UTC)[reply]

You know that cos²x + sin²x = 1, right? That's the pythagorian identity, and it's directly derived from the pythagorean theorem. This obviously means that cos²x+sin²x-1=0. Since that equals zero, we can easily add it to the right side (since we are just adding a zero). Observe:
cos²x-sin²x = cos²x-sin²x + (cos²x + sin²x - 1) = 2cos²x - 1
And by the way, at one point or another everyone hates trigonometric identities, it's not a stupid question at all :) Oskar 23:49, 8 January 2007 (UTC)[reply]
The most interesting part of this was omitted:
If we know about 2D rotation matrices, we can use matrix multiplication to show the angle doubling.
That is, we use the same rotation twice, which gives a rotation by twice the angle.
If we set x = cos θ, then cos 2θ is given by 2x2−1. No obvious cause for excitement? Perhaps not. But we can show that there is a polynomial, denoted by Tn(x) for every non-negative integer n, such that Tn(cos θ) = cos nθ.
These Chebyshev polynomials prove to be surprisingly useful. For example, they are often helpful in numerical analysis. --KSmrqT 06:03, 9 January 2007 (UTC)[reply]

Automatic equation numbering in wiki

[edit]

Hi,

We are writing a maths intensive wiki page and were wondering if there is an automatic equation numbering capability in wiki. Some of the maths that we want to number is not necesssarily a latex equation, but we would still like to number it. Could you please let me know how to handle equation numbering for math intensive wiki pages.

Thanks —The preceding unsigned comment was added by 216.180.72.14 (talk) 02:10, 9 January 2007 (UTC).[reply]

So far as I know, the MediaWiki software has no facility for automatically numbering equations or anything else, except for the horrid cite.php machinery recently introduced to mangle footnotes. (Numbered lists are a part of HTML and CSS.) There are some tricks for putting a chosen number with an equation (which I might be able to find in our archives, on request), but nothing like what you would expect in a LaTeX document.
Furthermore, I would suggest that if you must number so many equations that you feel the need for automation, you probably have larger problems with the structure of the article. --KSmrqT 10:18, 9 January 2007 (UTC)[reply]

Hi KSMRq,

Thanks for your reply. We actually have atleast 10-15 pages of wiki where we need to number and reference equations consistently. It will be very helpful to us if you can look in your archives and tell us how to put a chosen number with an equation. Will we be able to create an internal link to the equation also?

Thanks

So far, no joy. I dug through all the WikiProject Mathematics talk archives, which is where I thought some methods had been discussed, and found nothing. I'll try elsewhere; but meanwhile, here are some observations. The first important decision is whether to put the equation number inside <math> tags or not. If we do, then we depend on our limited version of the TeX machinery, and will find it awkward to get at from outside. If we do not, then we depend on wiki/HTML/CSS machinery, which is more flexible but perhaps more work for us. Honest HTML has some facilities for "ids" and "hrefs", which form the core of the "hypertext" part of "HyperText Markup Language" (HTML). We are able to write a sentence referring to, say, Equation (3), and have that link to the equation. For example, we could write the equation as
  • Markup: <math id="eq.3">e^{\bold{i}\pi} = -1 , \qquad \text{(3)} \,\!</math>
and write the link as
  • Many believe Equation 3 is the most beautiful equation in mathematics.
    Markup: Many believe [[#eq.3|Equation 3]] is the most beautiful equation in mathematics.
But I know of no way within Wikipedia to have the numbering and linking done automatically.
Genuine LaTeX can have a multiline equation with all or selected lines numbered; but this becomes one big PNG image so there is no way to label a selected line from outside, nor to link to it alone.
When the PNG is generated, there is no way to know the width of the display, so no way to float a TeX equation number farther to the right. This is one advantage of using CSS and HTML markup. (And it also gives us the freedom to use wiki markup for an equation if we prefer.)
  • eiθ = cos θ + i sin θ(2)
    Markup: ''e''<sup>'''i'''θ</sup> = cos θ + '''i''' sin θ<span style="position:relative;right:-10em">(2)</span>
Hope this helps. --KSmrqT 14:58, 10 January 2007 (UTC)[reply]
It should be possible to automate much of this using Templates, right? Something like <math>xxxxx</math>{{eqlabel 4}} .... {{eqref 4}... Jdpipe (talk) 07:54, 22 July 2008 (UTC)[reply]
If you put the equation numbers to the left, as in Latex's \fleqno – which actually is my style of preference – you can directly write things like
If you have someone with good programming skills around, it should be a matter of one hour's labour or so to produce a preprocessor in a language like Python for turning markup using symbolic names, as in (NR:foo) and (REF:foo), into proper numbering. While it is awkward to insert this into the edit–display loop (but note that the suggested markup syntax is designed to be parseable also without preprocessing), it beats doing the numbering by hand.  --LambiamTalk 21:26, 9 January 2007 (UTC)[reply]