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

= September 18 =

Factorization question
I need to simplify the expression $$(x^5-32)/(x-2)$$. I'm guessing $$x-2$$ is a factor of the numerator, so it will cancel out with the denominator. However, I have forgotten binomial expansion and therefore do not know how to determine the other factor of the numerator. One clue I can use to check any proposed answer is that I have deduced, by means of a graph and a table, that the limit of this expression as $$x$$ approaches 2 is 80. Can anyone remind me how to arrive at the other factor of the numerator? Thanks, anon. —Preceding unsigned comment added by 70.23.83.108 (talk) 00:12, 18 September 2007 (UTC)

(x^5-32) is a difference of two 5-cubes. If you don't know the formula for that, just use long division.--Mostargue 00:41, 18 September 2007 (UTC)

Having studied computer science, I know the magic sequence in computing which is {1,2,4,8,16,32,64,128,256,512,1024,...} 202.168.50.40 00:45, 18 September 2007 (UTC)

Hopefully write x5-32=(x-2)(ax4+bx3+cx2+dx+e), then solve for the coefficients; I recommend starting at one end, either a or e, and work inwards. (Of course, this is just polynomial long division.) Tesseran 01:21, 18 September 2007 (UTC)


 * It should be pointed out that the binomial expansion doesn't seem relevant here; Geometric progression, on the other hand, does. By the way, the fact that $$2^5 - 32 = 0$$ guarantees that $$x-2$$ is a factor of $$x^5-32$$. -- Meni Rosenfeld (talk) 02:24, 18 September 2007 (UTC)


 * It is true that x5−32 can be factored as (x−2)q(x), where q(x) is a polynomial of degree 4. However, it is not true that q(x) has only two terms.
 * Curiously, it is trivial to show that x−2 is a factor, yet without revealing the other factor. The reasoning is that if we substitute 2 for x we get zero, so 2 is a root and x−2 is a factor.
 * Even before finding the other factor we can expect it to show a symmetry between powers of x and powers of 2, a property inherited from the original, x5−25. Others have suggested polynomial long division, however we are dividing by a monic linear polynomial so we can take advantage of the quick and convenient method called synthetic division. Essentially, we evaluate the polynomial at 2 using Horner's rule, accumulating the intermediate values as coefficients of the new polynomial. Here's an illustration with p(x) = x3−27 factoring out x−3.
 * {| class='wikitable' style='background-color:white;text-align:center;font-family:monospace'

! style='font-family:sans-serif' | p(x) ! style='font-family:sans-serif' | ! style='font-family:sans-serif' | ! style='font-family:sans-serif' | x=3 ! style='font-family:sans-serif' | q(x)
 * 1 || ||  0  || ||  0  || || −27
 * ↓ || || 3 || || 9 || || 27
 * ↓ || ↗×3 || ↓ || ↗×3 || ↓ || ↗×3 || ↓
 * 1 || || 3 || || 9 || || 0
 * }
 * This shows that the quotient is q(x) = x2+3x+9. In fact, we can readily surmise the quotient for xn−an divided by x−a from the regular pattern seen in this example. When a is 1 and n is prime, the quotients are cyclotomic polynomials. --KSmrqT 05:11, 18 September 2007 (UTC)


 * Here's my attempt at synthetic division:

x^4 + 2x^3 + 4x^2 + 8x + 16 x-2 / x^5                           - 32 -(x^5 - 2x^4) 2x^4 -(2x^4 - 4x^3) 4x^3 -(4x^3 - 8x^2) 8x^2 -(8x^2 - 16x) 16x - 32 -(16x - 32) 0


 * Note that I wouldn't generally solve a problem for you like this, but you did seem to be genuinely trying (with the graph and all), and seemed like you needed some help learning how to do synthetic division. StuRat 04:37, 19 September 2007 (UTC)

INTEGRALS
Solve:


 * $$\int \cos{e^x}dx$$
 * $$\int \frac{dx}{\ln{x}}$$
 * $$\int \sin{x^2}dx$$
 * $$\int \frac{e^x}{x}dx $$
 * $$\int \sqrt{x^3+1}dx $$
 * $$\int \frac{\sin{x}}{x}dx$$

This is not homework, for obvious reasons.--Mostargue 00:55, 18 September 2007 (UTC)


 * have you tried the Wolfram Integrator? &mdash;Tamfang 01:28, 18 September 2007 (UTC)


 * Also, (a) have you already tried you hand at any of these? (b) Is there a specific context for them, or did they just pop into your head? Depending on the context, it may be possible to evaluate some of these for specific limits, but not produce a general closed form solution to the indefinite integral. Confusing Manifestation 01:58, 18 September 2007 (UTC)

My math book says the integrals cannot be expressed in elementary functions. I'd like to see what they CAN be expressed as.--Mostargue 02:02, 18 September 2007 (UTC)
 * Not much. You can try the Wolfram integrator, which is based on Mathematica. It will express such integrals using non-elementary functions like the exponential integral, Fresnel integral and elliptic integrals. But if you check the definitions of those, you might find some to be defined exactly as those integrals. This is, again, because those integrals are as simple as they are going to get - you just can't simplify them any further.
 * Of course, you can try to represent them as a power series; for example, $$\int\frac{\sin x}{x}\ dx = \sum_{k=0}^{\infty}\frac{x^{2k+1}}{(2k+1)!(2k+1)}$$. -- Meni Rosenfeld (talk) 02:19, 18 September 2007 (UTC)

Thanks Meni =). Is there any algorithm for determining whether or not a function has an elementary antiderivative? --Mostargue 05:24, 18 September 2007 (UTC)


 * Also, $$\int \frac{e^x}x dx$$ and $$\int \frac{\sin x}x dx$$ are related, especially if you think of these as complex analytic functions. I don't know if any other pairs integrals you've given are related.  &#x2013; b_jonas 06:00, 18 September 2007 (UTC)
 * I think the Risch algorithm might be capable of that, but I don't understand it well enough to tell for sure. -- Meni Rosenfeld (talk) 09:07, 18 September 2007 (UTC)
 * Don't know about algorithms, but the area you want is differential Galois theory. Algebraist 12:49, 19 September 2007 (UTC)

What do you call this shape?
A rectangle attached to a semicircle. —Preceding unsigned comment added by 166.121.36.232 (talk) 03:00, 18 September 2007 (UTC)


 * I've heard a rectangle attached to two semicircles called a slot, so maybe you could call your case a half-slot ?:

____ (____) 2 semicircles = "slot"

__ (__| 1 semicircle = "half-slot" ?

could be gravestone


 * StuRat 04:19, 19 September 2007 (UTC)

Depending on context, it could be called a round arch or Roman arch. —David Eppstein 04:25, 19 September 2007 (UTC)

Recursive integral
Hello, I've been trying to calculate something in the case where, in a game, two groups of units are attacking each other, to see how the damage per second changes according to the two groups.

I've managed to find a simple solution when one groups attacks another but the other group doesn't attack something else, but I can't really see how to find the solution now when both groups attack each other.

The equation I'd like a solution for is

$$x_{\Sigma A}(t) = x_A \left (n_A(0)- \left \lfloor \frac{x_{\Sigma D}(0) \cdot t_1}{y_A} \right \rfloor - \left \lfloor \frac{\int _{t_1} ^t x_D \left ( n_D(0) - \left \lfloor \frac{\int _{t_1}^t x_{\Sigma A} (\tau)\; d \tau}{y_A} \right \rfloor \right ) d\tau }{y_A} \right \rfloor \right )$$

I know the formula is quite messy, but that's what I ended up with. (I'd really prefer if the solution was analytic and not numerical, but well...)

So, I know everything except $$x_{\Sigma A}(t)$$ (which represents the damage per second of the group of A units with respect to time.).

I tried to put it in different programs but they didn't help me (I also noticed that they couldn't even figure out $$ \int_a^b \lfloor c x\rfloor \; dx$$, I'd like to understand why, I've been using $$ \int_a^b \lfloor c x\rfloor \; dx = \left [\frac{1}{2c}\lfloor cx \rfloor(2cx-\lfloor cx \rfloor - 1) \right ]_a^b $$ and came to the correct solution for my first case, what is wrong with that ?)

Thanks. --Xedi 04:23, 18 September 2007 (UTC)

Do you really need instantaneous "attacking each other"? Why not use approximate integration?--Mostargue 05:28, 18 September 2007 (UTC)


 * I have done such a calculation myself in the past (for Heroes II), but I think you won't be getting far if you express it using the floor function - being discontinuous, it's not very closed-form friendly. Even when a closed form exists, most integrators just weren't meant to deal with such nonsmooth, let alone discontinuous, functions (and you probably won't have much luck manually for anything nontrivial). What I have done is assume that the number of units is continuous (which isn't too bad if the number is above, say, 10). Then if N represents the number of units at a given time, a represents the attack power (damage dealt per attacking unit per unit time) and d represents the defense power (hit points per unit), you have the differential equations:
 * $$\frac{dN_1}{dt} = \frac{-N_2a_2}{d_1}$$
 * $$\frac{dN_2}{dt} = \frac{-N_1a_1}{d_2}$$
 * To which the solution is (denoting $$r=\sqrt{\frac{a_1d_1}{a_2d_2}}$$ and $$q=\sqrt{\frac{a_1a_2}{d_1d_2}}$$:
 * $$N_1(t) = n_1 \mathrm{Cosh}(qt)-\frac{n_2}{r} \mathrm{Sinh}(Qt)$$
 * $$N_2(t) = n_2 \mathrm{Cosh}(qt)-n_1r \mathrm{Sinh}(Qt)\;\!$$
 * See hyperbolic functions. For armies too small for this approximation to be acceptable, you might have to resort to simulating the battle (by calculating at each step how much time it will take for one unit to be eliminated). -- Meni Rosenfeld (talk) 09:24, 18 September 2007 (UTC)

You might want to look at this patent http://patimg2.uspto.gov/.piw?Docid=06729954&homeurl=http%3A%2F%2Fpatft.uspto.gov%2Fnetacgi%2Fnph-Parser%3FSect1%3DPTO1%2526Sect2%3DHITOFF%2526d%3DPALL%2526p%3D1%2526u%3D%25252Fnetahtml%25252FPTO%25252Fsrchnum.htm%2526r%3D1%2526f%3DG%2526l%3D50%2526s1%3D6,729,954.PN.%2526OS%3DPN%2F6,729,954%2526RS%3DPN%2F6,729,954&PageNum=&Rtype=&SectionNum=&idkey=NONE&Input=View+first+page which calculates damages on groops of soldiers off screen based on various parameters, including formations, supporting units etc. Like all patents there's a lot of useless stuff to read, but there are some good ideas in there if you can be bothered. It's just a model though if you want a continuous solution the use the method given above.87.102.7.192 10:14, 18 September 2007 (UTC)

By the way could you tell us what each symbol in your expression meant - it wasn't immediately apparent.87.102.7.192 10:15, 18 September 2007 (UTC)

(Your differential equation aside.) If you want to use this for a computer simulation I'd really recommend calculating individual combats and using BSP trees or similar to kill the comutation complexity stone dead. (Quadtree is a better link than BSP tree.)87.102.7.192 11:11, 18 September 2007 (UTC)

Thanks a lot, this has been very helpful. For a quick explanation of my equation, x generally means damage per second, y means hitpoints and n the number of units.

This equation came from $$x_{\Sigma A}(t) = x_A \left (n_A(0)- \left \lfloor \frac{x_{\Sigma D}(0) \cdot t_1}{y_A} \right \rfloor - \left \lfloor \frac{\int _{t_1} ^t x_{\Sigma D}(\tau) d\tau }{y_A} \right \rfloor \right )$$ and $$x_{\Sigma D}(t) = x_D \left (n_D(0) - \left \lfloor \frac{\int _{t_1} ^t x_{\Sigma A}(\tau) d\tau }{y_D} \right \rfloor \right )$$

In this case, ΣA starts getting attacked by ΣD at t=0, and ΣA starts attacking ΣD at t=t1

Basically, the total damage per second of the group A is the damage per second at t=0 (equal to the number of units time the DPS of each unit), minus the damage per second lost between t=0 and t=t1 (that is, the DPS of one unit times the number of units lost) minus the damage per second lost between t=t1 and t, that is the integral on the third part. For the total damage of group B, it's the same except for not losing any DPS between t=0 and t=t1

All this was from some basic assumptions, like every shot hits instantly, no damage is lost (no overkills), and the full group starts attacking at the same time.

I like your method, Meni Rosenfeld, but as you pointed out, it isn't very accurate for small numbers of units (I would of like to compare how well one single unit with DPS 1000 and 1000 HP would have done compared to 20 units with DPS 50 and HP 50 (obviously, with no overkill, it should win, but it would be nice to have the full solution.)

And again, why is the floor function so bad to integrate ? What is wrong with $$ \int_a^b \lfloor c x\rfloor \; dx = \left [\frac{1}{2c}\lfloor cx \rfloor(2cx-\lfloor cx \rfloor - 1) \right ]_a^b $$ ? (Well, I suppose this equation wouldn't suffice to resolve the equation I gave...)
 * Checked it - I'm 90% certain you are right (touch wood) note - you don't need the "-1" at the end - it cancels.87.102.7.192 15:28, 18 September 2007 (UTC)

Finally, how can I obtain numerical solutions here, with the integral in an integral ? Would it be better to start with the two separate equations for ΣA and ΣD ?

Thanks a lot. --Xedi 14:14, 18 September 2007 (UTC)
 * Here's what I'd do to simplify. Split the equation into before and after t1 - since there's a boundary in the behaviour here. First make an equation for the damage up to t1 - this should be simple. If the unit survives these 'free shots' from the 'defender', then use a second equation with the start values coming from the remaining hit points after time t1 - the differential equations given above should be right for this part.
 * So for your first part up to t1 the damage seems to be "'Defender number' x time x 'defence factor'" .. if this value exceeds the 'hit points' for A(ttacker) then terminate. If it doesn't just subtract from the original attacker 'hit points' and finish the battle (without the difficult boundary condition) as per Meni Rosenfeld or another model of your choice.87.102.7.192 14:49, 18 September 2007 (UTC)
 * The floor function doesn't (isn't) look difficult to integrate at all - I get f(b+1)2/2 + f(a)2/2 - f(b)2 -f(b) +b f(b) -a f(a) f(a)2/2 - f(b)2/2  +b f(b) -a f(a) (correcting - take with pinch of salt if you haven't checked..) for the integral between b and a of f(x) = floor(x) .. I haven't checked your result but I'd bet it's right (it's easy to verify anyway).87.102.7.192 15:04, 18 September 2007 (UTC)


 * It's not that $$ \int_a^b \lfloor c x\rfloor \; dx = \left [\frac{1}{2c}\lfloor cx \rfloor(2cx-\lfloor cx \rfloor - 1) \right ]_a^b $$ is wrong (though I haven't checked it), but rather that I don't think it can be generalized to more complicated integrands, and that the algorithms used by typical integration software only know how to deal with smooth functions.
 * The best way to obtain accurate numerical results is the simulation I alluded to above, which I will explain in more detail. You start at time t=0. You calculate the time it will take for a unit in group 1 to be eliminated, and the time it will take for a unit in group 2. You take the smaller value; you jump to that time, remove 1 unit from the appropriate group and do the appropriate amount of damage to the other group. You calculate again the times for elimination, and so on. The time it will take is linear in the number of units, so you can easily handle myriads of units. You can also use all sorts of hybrid algorithms - If both groups have many units, you can use the continuous version until you get to 1000's of units, and then switch to the discrete version. If group 1 consists of a few big units and group 2 consists of many little units, you can have each time step be whenever a unit from group 1 is destroyed, and treat group 2 as a continuous variable. The equations for calculating the time step will be similar to my differential equations above, with the difference that damage to group 2 is constant in each step.
 * For the simple case of 1 big unit versus many little ones, you can do something similar - try to solve the equations and see what you get. A useful approximation is that the power of a group of n units with attack a and defense d is $$adn(n+1)$$; the difference in power between two combating groups will always be roughly constant. See where that gets you. This easily gives that in your example of $$n_1=1,a_1=1000,d_1=1000,n_2=20,a_2=50,d_2=50$$, the 2nd group will be defeated after dealing roughly 500 damage to the first (this makes sense - they will survive one second, in which they do an average damage of roughly 500 per second).
 * In short, I suggest you take these ideas, try to implement them and experiment with the results. You will get a better understanding by doing so. -- Meni Rosenfeld (talk) 15:14, 18 September 2007 (UTC)


 * Thanks a lot. I just finished using this method, it seems to be working great. Surely a lot easier than those integrals, but a bit less charming as it is only numeric (my fault for liking analytic expressions too much.). It really helped. --Xedi 17:01, 18 September 2007 (UTC)

Physics momentum question
If I have two masses m/2 connected by a rigid rod of length 2r (at angle A to the horizontal) that is struct by a mass of M, velocity V0 moving horizontally (assuming elastic collisions) at an offset x from the centre of mass of the mass connected rod..

1.Must the impulse be normal to the rod?

2.Will the collision result in any rotation of the mass connected rod?

3.I'm having diffucultly factoring in any resultant rotation of the rod - though it looks like the rod should rotate if x<>0 because the impulse (change of momentum) occurs at a point off the centre of mass

4.Please explain where and why my reasoning is going wrong in (3.) - and please could someone either explain what I should be doing and maybe give a link.. Thanks.87.102.7.192 12:35, 18 September 2007 (UTC)

5. I could refactor the question to ask what if an impulse H acts normally at distance x from the centre of mass of a body of rotational moment inertia I.. the answer seems to be that no rotational movement is given because of the conservation of angular momentum.. Is this right? If so why am I totally unable to reproduce this result eg pushing a brick off axis with a pen - the brick always starts to rotate..?87.102.7.192 13:49, 18 September 2007 (UTC)
 * I feel like there's a more clever way to solve this problem, but there's certainly a very straightforward way that works. Write $$\vec v_0,\vec v',\vec v,\vec v_1,\vec v_2$$ for the initial incoming velocity (with no y component), the outgoing velocity, and the velocities immediately after impact of the bar and the masses that are away from and close to the impact, respectively.  Write $$\vec x$$ for the vector from the center of the bar to the impact point, $$\hat n$$ for the normal to the bar (that points up if $$A=0$$), and $$\omega$$ for the angular velocity of the bar.  Assuming a pure, instantaneous elastic collision with no friction, the force on the bar must be perpendicular to it, so $$\vec v\|\hat n\Rightarrow v_x=v_y\tan A,\,v=v_y\sec A$$.  From the rigidity of the bar we have $$\vec v_{12}=\vec v\mp r\omega\hat n$$.  Now conservation of linear momentum gives us $$M\vec v_0=M\vec v'+\frac m2(\vec v_1+\vec v_2)=M\vec v'+m\vec v$$; conservation of kinetic energy gives us $$Mv_0^2=Mv'^2+\frac m2(v_1^2+v_2^2)=M(v_x'^2+v_y'^2)+\frac m2(v^2-2r\omega\vec v\cdot\hat n+r^2\omega^2+v^2+2r\omega\vec v\cdot\hat n+r^2\omega^2)=M(v_x'^2+v_y'^2)+m(v^2+r^2\omega^2)$$.  Conservation of angular momentum about $$\vec x$$ (chosen because the projectile then never has any) gives us $$\vec v_1\times(-(x+r)\hat x)+\vec v_2\times((r-x)\hat x)=0$$ (where $$\hat x\ne\hat\imath$$), or (noting that $$\vec v,\hat n\perp\hat x$$ and $$x\omega<0$$) $$-2vx+2r^2\omega=0$$ or $$vx=r^2\omega$$, so our quantity $$r^2\omega^2=\frac{v^2x^2}{r^2}$$.  From the linear momentum equation we have $$v_y=\frac Mmv_y'$$ and then (using $$\vec v\|\hat n$$) $$v_x'=v_0-v_y'\tan A$$, so combining everything into the kinetic energy equation gives us (using $$v=v_y\sec A$$) $$Mv_0^2=M(v_0^2-2v_0v_y'\tan A+v_y'^2\tan^2A+v_y'^2)+mv_y^2\sec^2A\left(1+\frac{x^2}{r^2}\right)=Mv_0^2-2Mv_0v_y'\tan A+Mv_y'^2\sec^2A+\frac{M^2v_y'^2}m\sec^2A\left(1+\frac{x^2}{r^2}\right)$$.  This is a quadratic in $$v_y'$$: collecting terms gives $$\left(1+\frac Mm\left(1+\frac{x^2}{r^2}\right)\right)\sec^2Av_y'^2-2v_0\tan Av_y'=0$$, with the obvious solution $$v_y'=0$$ that corresponds to no collision occuring.  Throwing it away, we have $$v_y'=\frac{2v_0\tan A}{\left(1+\frac Mm\left(1+\frac{x^2}{r^2}\right)\right)\sec^2A}$$; the other quantities of interest follow immediately (and $$\omega\ne0$$ unless $$0\in\{\frac Mm,\frac xr,v_0,A\}$$).  Note that I have assumed $$A\ne\frac\pi2$$ here, although I imagine that continuity guarantees that the results equal their limits in that case. --Tardis 16:49, 18 September 2007 (UTC)


 * The bit I always get confused about is the 'conservation of angular momentum' which initially total angular momentum is zero. But if ω<>0 (which occurs when x<>0 etc according to the above) - then the system after collision would have angular momentum (mωr).. So that seems contradictory to me.. I'm not sure where the error lies here - in my reasoning or what?87.102.7.192 18:34, 18 September 2007 (UTC)


 * The law of conservation of angular momentum only applies to a closed system. Whatever delivers the impulse isn't part of the system, so it isn't closed. — Daniel 22:14, 18 September 2007 (UTC)


 * Of course, if you include the impacting particle in your system then the angular momentum of the whole system is conserved. Note that the solution provided by Tardis implicitly assumes this, but he cleverly calculates angular momentum about the point of impact. As the paths of the impacting particle both before and after impact pass through this point, the angular momentum of the impacting particle about this point is 0, both before and after impact. So calculating angular momentum about this point allows Tardis to ignore the angular momentum of the impacting particle. Gandalf61 12:24, 19 September 2007 (UTC)


 * I think taking the angular moment about the impact point to be zero was the bit I was missing - so v1(r-x)=v2(r+x) (as I finally worked out at 4am yesterday morning) - and so the collision if off centre will result in the thing rotating.. (I could also separate x and y axis components it seems - to simplify the problem..) Can some one just confirm that's right?87.102.116.240 16:11, 19 September 2007 (UTC)

Worked out and solved nwo. Thanks everyone.87.102.116.240 19:09, 19 September 2007 (UTC)

Inverse Trig Equations
I have a homework question that says "simplify the following : tan(arcsin(x))"

how do i even go about trying to solve that? —Preceding unsigned comment added by 76.78.16.35 (talk) 20:57, 18 September 2007 (UTC)
 * You can write tangent in terms of sine and cosine. Cosine, in turn, can be written in terms of sine. The rest should be pretty simple remembering that $$f(f^{-1}(x))=x$$ for x in the range of f. Donald Hosek 22:14, 18 September 2007 (UTC)


 * $$\theta = \arcsin{x}$$
 * $$x = \sin{\theta}$$

Thus, $$\sin{\theta} = \frac{a}{h}$$
 * [[Image:Trigonometric_Triangle.svg]]
 * Proofs_of_trigonometric_identities
 * $$a = x, h = 1$$
 * Therefore:
 * $$b = \sqrt{1-x^2}$$
 * Finally,
 * $$\tan{\arcsin{x}} = \tan{\theta} = \frac{a}{b} = \frac{x}{\sqrt{1-x^2}}$$

--Mostargue 22:32, 18 September 2007 (UTC)
 * Mostargue, you're new here so I'll fill you in that we don't generally provide complete answers to homework problems here. Providing a good hint is harder (for us!), but in the long run is much more helpful to the questioner. -- Meni Rosenfeld (talk) 00:01, 19 September 2007 (UTC)

oh... lol sorry I got a little carried away. --Mostargue 07:02, 19 September 2007 (UTC)