online advertising

Sunday, January 3, 2016

Tangent Surface?

This post is more like a question than an answer, I really just wanted to document my doubt.

To me, the tangent surface to a curve is a really strange concept.

The book defined the tangent surface as the union of all tangent lines as follow:



Suppose I take a circle and take all the tangent lines, that should give the whole plane except the interior of the circle, and that's the tangent surface of a circle?

What is so interesting about the tangent surface of a curve anyway? Except of course the surface does contain the curve itself.


Saturday, January 2, 2016

UTM Ideals Varieties and Algorithm - Chapter 1 Section 3 Exercise 12

Problem:


Solution:

For part (a), thanks to K3DSurf, see a video plot!


There are two things worth notice in the video. It starts with a view that it is symmetric in $ x $, and it ends with a view showing as $ |x| $ increases, $ y $ and $ z $ increases, and $ y $ grows slower than $ z $ does, both are normal behavior.

Last but not least, notice the curve does not pass through the origin. This does NOT make sense. That seems to be a limitation to the tool, not a math problem.

Initially I do not know K3DSurf support plotting a curve, so I tried to create a surface by wrapping the curve as a tube. Conceptually, it is a collection of circle with the center on the curve and is on the plane orthogonal to the tangent vector.

To do that, I used this solution from MathOverflow.

First, a general point on the curve has coordinate $ (u, u^2, u^4) $.

Second, the tangent vector is $ (1, 2u, 4u^3) $

Third, I pick these two unit vectors orthogonal to the tangent vector

$ \frac{(2u, -1, 0)}{\sqrt{4u^2 + 1}} $
$ \frac{(4u^3, -1, 0)}{\sqrt{16u^6 + 1}} $

Now we can represent the parametric surface as

$ (u, u^2, u^4) + \cos v \frac{(2u, -1, 0)}{\sqrt{4u^2 + 1}} + \sin v \frac{(4u^3, -1, 0)}{\sqrt{16u^6 + 1}} $

K3DSurf also plot this formula well, of course, if K3D surf support parametric curve then it is much simpler to just plot the curve.

These are the parametric equations feeding the tool, and it does plot what we want except the tube look thin as the tool auto scales.

v   + 0.3 * cos(u) * 2 * v / sqrt(4 * v^2 + 1) + 0.3 * sin(u) * 3 * v^3 / sqrt(16 * v^6 + 1)
v^2 - 0.3 * cos(u) / sqrt(4 * v^2 + 1)
v^4                                            - 0.3 * sin(u) / sqrt(16 * v^6 + 1)

Part (b) is trivial, indeed I have already do that above, $ (u, u^2, u^4) $ is the parametrization.

For part (c), we have already derived the tangent vector $ (1, 2u, 4u^3) $, so the tangent surface is

$ (u, u^2, u^4) + v(1, 2u, 4u^3) $.


Friday, January 1, 2016

The method of variation of parameter (I)

Problem:

$ y'' - 2y = x + 1 $.

Solution:

Let's discuss the method in general first, consider the differential equation:

$ y'' + p(x)y' + q(x)y = r(x) $.

Assume we can solve the homogeneous equation

$ w'' + p(x)w' + q(x)w = 0 $

and get the solution the two independent solutions $ w(x) = w_1(x) $ and $ w(x) = w_2(x) $.

Now we assume the solution to the original equation takes the form:

$ y(x) = v_1(x)w_1(x) + v_2(x)w_2(x) $.

Computing the first derivative, we get:

$ y'(x) = v_1'(x)w_1(x) + v_1(x)w_1'(x) + v_2'(x)w_2(x) + v_2(x)w_2'(x) $.

As a wishful thinking, let's assume $ v_1'(x)w_1(x) + v_2'(x)w_2(x) = 0 $. This is one of the equation that govern $ v_1'(x) $ and $ v_2'(x) $.

Next, we compute the second derivative, we get:

$ y'(x) = v_1(x)w_1'(x) + v_2(x)w_2'(x) $.
$ y''(x) = v_1'(x)w_1'(x) + v_1(x)w_1''(x) + v_2'(x)w_2'(x)  + v_2(x)w_2''(x) $.

Putting these derivative back to the differential equation, we get:

$ (v_1'(x)w_1'(x) + v_1(x)w_1''(x) + v_2'(x)w_2'(x)  + v_2(x)w_2''(x)) + p(x)(v_1(x)w_1'(x) + v_2(x)w_2'(x)) + q(x)(v_1(x)w_1(x) + v_2(x)w_2(x)) = r(x) $.

A very long equation, but if we carefully group the terms we see this:

$ v_1'(x)w_1'(x) + v_2'(x)w_2'(x) + (v_1(x)w_1''(x) + p(x)v_1(x)w_1'(x) + q(x)v_1(x)w_1(x)) + (v_2(x)w_2''(x) + p(x)v_2(x)w_2'(x) + q(x)v_2(x)w_2(x)) = r(x) $.

Note that the two bracketed term is actually 0 because $ w_1(x) $ and $ w_2(x) $ is a solution to the homogeneous equation. So it simplifies to

$ v_1'(x)w_1'(x) + v_2'(x)w_2'(x) = r(x) $.

That will be our second equation that govern $ v_1'(x) $ and $ v_2'(x) $, with this two equations, we can solve the $ v_1(x) $ and $ v_2(x) $ and therefore the overall differential equation.

So much for the theory, now we solve the equation $ y'' - 2y = x + 1 $.

The homogeneous equation $ w'' - 2w = 0 $ is pretty easy to solve, it is simply $ w_1(x) = e^{\sqrt{2}x} $ and $ w_2(x) = e^{-\sqrt{2}x} $.

Next, we use the two equations to solve for the $ v $ functions

$ v_1'(x)e^{\sqrt{2}x} + v_2'(x)e^{-\sqrt{2}x} = 0 $
$ \sqrt{2}v_1'(x)e^{\sqrt{2}x} + (-\sqrt{2})v_2'(x)e^{-\sqrt{2}x} = x+1 $

Cancelling the $ \sqrt{2} $ factor from the second equation we get

$ v_1'(x)e^{\sqrt{2}x} - v_2'(x)e^{-\sqrt{2}x} = \frac{x + 1}{\sqrt{2}} $

Now the functions are trivial to solve $ v_1'(x) = \frac{x+1}{2\sqrt{2}}e^{-\sqrt{2}x} $, $ v_2'(x) = \frac{-x-1}{2\sqrt{2}}e^{\sqrt{2}x} $.

Next we integrate to find $ v_1(x) $ and $ v_2(x) $.

$ v_1(x) = \frac{-1}{8}(2x + \sqrt{2} + 2) e^{-\sqrt{2}x} $
$ v_2(x) = \frac{-1}{8}(2x - \sqrt{2} + 2) e^{\sqrt{2}x} $

Putting these back to the differential equation, we finally get

$ y(x) = v_1(x)w_1(x) + v_2(x)w_2(x) = \frac{-1}{8}(2x + \sqrt{2} + 2) +  \frac{-1}{8}(2x - \sqrt{2} + 2) = \frac{-1}{2}(x + 1) $.

And the final answer is, of course, $ y(x) = \frac{-1}{2}(x + 1) + Ae^{\sqrt{2}x} + Be^{-\sqrt{2}x} $.

To be honest to myself, I cheated. I didn't do all these integration myself. I used these simple MATLAB code. It is really troublesome to use this method.

clc
w1 = exp(sqrt(2) * x);
w2 = exp(-sqrt(2) * x);
v1d = (x + 1)/sqrt(2) /2 / w1;
v2d = -(x + 1)/sqrt(2) /2 / w2;
g = simplify(int(v1d) * w1 + int(v2d) * w2)
diff(diff(g)) - 2 * g

The method of undetermined coefficients (II)

Problem:

y'' + y' = x

Solution:

Again, we solve the homogeneous equation $ z'' + z' = 0 $, the solution is $ z = Ae^{-x} + B $.

Next we guess the particular solution to $ w'' + w' = x $ is a quadratic polynomial $ w(x) = Px^2 + Qx + R $, the derivatives are

$ w'(x) = 2Px + Q $
$ w''(x) = 2P $.

Therefore we have $ 2P + 2Px + Q = x $, so we get $ P = \frac{1}{2} $ and $ Q = -1 $.

The final answer is therefore $ y = Ae^{-x} + \frac{1}{2}x^2 - x + B $.

The method of undetermined coefficients (I)

Problem:

$ y'' - y = \cos x $

Solution:

Let's first solve $ z'' - z  = 0 $, using the characteristic polynomial method, we know the answer is $ z = Ae^x + Be^{-x} $.

It remains to find just one function that fits $ w'' - w = \cos x $, then we know $ y = w + z $ and have the degree of freedom we need.

At this point, the so called "method of undetermined coefficients" is really just about guessing the solution, let's guess our solution is $ w = \cos x $ and see

$ (\cos x)'' - \cos x = -2 \cos x $.

So now the solution is obviously $ w = \frac{-1}{2}\cos x $

The full solution is then $ Ae^x + Be^{-x} - \frac{1}{2}\cos x $.

Second order constant coefficients (III)

Problem:

2y'' - 3y' + 6y = 0

Solution:

The solutions to the characteristic polynomial are $ \frac{3 \pm \sqrt{39}i}{4} $

Skipping all the derivation we have already done in the last post, the answer is

$ y = Ae^{\frac{3}{4}}\cos\frac{\sqrt{39}}{4}x + Be^{\frac{3}{4}}\sin\frac{\sqrt{39}}{4}x $

Second order constant coefficients (II)

Problem:

$ y'' + y' + y = 0 $

Solution:

The characteristic polynomial is $ x^2 + x + 1 = 0 $, the solution is $ \frac{-1 \pm \sqrt{1^2 - 4(1)(1)}}{2(1)} = \frac{-1 \pm \sqrt{3} i}{2} $

Therefore the answer is

$ y = Ae^{\frac{-1 + \sqrt{3} i}{2}x} + Be^{\frac{-1 - \sqrt{3} i}{2}x} $

Separating out the real and imaginary parts, we get

$ y = Ae^{\frac{-1}{2}x} e^{\frac{\sqrt{3} i}{2}x} + Be^{\frac{-1}{2}x}e^{\frac{- \sqrt{3} i}{2}x} $

Next we can apply the Euler's formula

$ y = Ae^{\frac{-1}{2}x} (\cos\frac{\sqrt{3}}{2}x + i\sin\frac{\sqrt{3}}{2}x) + Be^{\frac{-1}{2}x}(\cos\frac{\sqrt{3}}{2}x - i\sin\frac{\sqrt{3}}{2}x) $

Grouping the real and imaginary gives:

$ y = Ae^{\frac{-1}{2}x} \cos\frac{\sqrt{3}}{2}x  + Be^{\frac{-1}{2}}\cos\frac{\sqrt{3}}{2}x + Ae^{\frac{-1}{2}}\sin(\frac{\sqrt{3}}{2}x)i - Be^{\frac{-1}{2}x}\sin(\frac{\sqrt{3}}{2}x)i $

Factorize, we get:

$ y = (A + B) e^{\frac{-1}{2}x} \cos\frac{\sqrt{3}}{2}x + (A-B)e^{\frac{-1}{2}}\sin(\frac{\sqrt{3}}{2}x)i $

There are two ways we can make the expression real, either we set $ A = B $, that get rid of the imaginary part, or we can set $ A = -B $ be a pure imaginary number, that essentially get rid of the real part and make the imaginary part real. That gives the answer as:

$ y = C e^{\frac{-1}{2}x} \cos\frac{\sqrt{3}}{2}x + D e^{\frac{-1}{2}}\sin\frac{\sqrt{3}}{2}x $