<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mathematics &#8211; Henry Poon&#039;s Blog</title>
	<atom:link href="https://blog.henrypoon.com/blog/tag/mathematics/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.henrypoon.com</link>
	<description></description>
	<lastBuildDate>Mon, 26 Aug 2019 00:57:00 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
<site xmlns="com-wordpress:feed-additions:1">83044199</site>	<item>
		<title>Numerical Methods for Non-Linear Optimization</title>
		<link>https://blog.henrypoon.com/blog/2011/01/29/numerical-methods-for-non-linear-optimization/</link>
					<comments>https://blog.henrypoon.com/blog/2011/01/29/numerical-methods-for-non-linear-optimization/#comments</comments>
		
		<dc:creator><![CDATA[hp]]></dc:creator>
		<pubDate>Sat, 29 Jan 2011 17:55:33 +0000</pubDate>
				<category><![CDATA[computer stuff]]></category>
		<category><![CDATA[Algebra]]></category>
		<category><![CDATA[Calculus]]></category>
		<category><![CDATA[Chan]]></category>
		<category><![CDATA[COM]]></category>
		<category><![CDATA[Computer]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[Contents]]></category>
		<category><![CDATA[D]]></category>
		<category><![CDATA[Dime]]></category>
		<category><![CDATA[EAR]]></category>
		<category><![CDATA[Equation solving]]></category>
		<category><![CDATA[Equations]]></category>
		<category><![CDATA[Fields of mathematics]]></category>
		<category><![CDATA[Final]]></category>
		<category><![CDATA[Find]]></category>
		<category><![CDATA[Go]]></category>
		<category><![CDATA[Gradient descent]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[IME]]></category>
		<category><![CDATA[Introduction]]></category>
		<category><![CDATA[It]]></category>
		<category><![CDATA[Lie]]></category>
		<category><![CDATA[Mathematical optimization]]></category>
		<category><![CDATA[Mathematics]]></category>
		<category><![CDATA[MATLAB]]></category>
		<category><![CDATA[Motivation]]></category>
		<category><![CDATA[Numerical analysis]]></category>
		<category><![CDATA[Numerical partial differential equations]]></category>
		<category><![CDATA[Partial differential equation]]></category>
		<category><![CDATA[Plan]]></category>
		<category><![CDATA[Plug]]></category>
		<category><![CDATA[Rolling]]></category>
		<category><![CDATA[STR]]></category>
		<category><![CDATA[Thou]]></category>
		<category><![CDATA[Time]]></category>
		<category><![CDATA[Travel]]></category>
		<category><![CDATA[tuna]]></category>
		<category><![CDATA[UNC]]></category>
		<category><![CDATA[Unification]]></category>
		<category><![CDATA[Variable]]></category>
		<category><![CDATA[Vol]]></category>
		<category><![CDATA[Z]]></category>
		<guid isPermaLink="false">http://henrypoon.mooo.com/blog/numerical-methods-for-non-linear-optimization</guid>

					<description><![CDATA[Contents Introduction Motivation Newton’s Method Steepest Descent Method Limitation Sources Introduction In many sciences, the problem of non-linear optimization appears quite often.&#160; What happens if they’re non-linear?&#160; Sometimes, the system of equations remains easy to solve even given non-linearity, but other times, the possibility of solving the problem analytically may not exist if the algebra [&#8230;]]]></description>
										<content:encoded><![CDATA[<h1>Contents</h1>
<ul>
<li>Introduction</li>
<li>Motivation</li>
<li>Newton’s Method</li>
<li>Steepest Descent Method</li>
<li>Limitation</li>
<li>Sources</li>
</ul>
<h1>Introduction</h1>
<p>In many sciences, the problem of non-linear optimization appears quite often.&nbsp; What happens if they’re non-linear?&nbsp; Sometimes, the system of equations remains easy to solve even given non-linearity, but other times, the possibility of solving the problem analytically may not exist if the algebra gets too complicated.&nbsp; The solution lies in using numerical methods (approximations).&nbsp; Here, I present two common methods: Newton’s Method, and the Steepest Descent Method.&nbsp;</p>
<p>Each method has its own limitations and the choice of which method to use depends on the problem.&nbsp; These methods involve using iterative computation in order to reach a solution.&nbsp; Luckily, computers can prove useful in providing solutions very quickly due to its quick processing power for numerical computation.</p>
<p>In order to understand some of the concepts and terms used in this article, the reader has knowledge in multivariable calculus.&nbsp; Also, equations in picture form made the line spacing look funny, so I’m going to do my best write the equations as text.&nbsp; I should also point out that I couldn’t write the vector arrow on top of the variables in text form so vectors are written in bold.</p>
<h1>Motivation</h1>
<p>In calculus, the idea of optimization involves taking the derivative of the function and equating it to zero.&nbsp; In multivariable calculus, the same idea applies except, we set all the partial derivatives to zero and solve the system.</p>
<p>So in general, if we are given a function:</p>
<p align="center"><em>ƒ(<strong>x</strong>)</em>, where <strong>x</strong> = [x<sub>1</sub>, x<sub>2</sub>, … x<sub>n</sub>]<sup>T</sup></p>
<p>The maximum or minimum can be found by taking a partial derivative with respect to the vector <strong><em>x</em></strong>.&nbsp; This gives the following equations:</p>
<p align="center"><em>∂<em>ƒ</em>/dx<sub>1</sub> = 0</em></p>
<p align="center"><em>∂<em>ƒ</em>/dx<sub>2</sub> = 0</em></p>
<p align="center">…</p>
<p align="center"><em>∂<em>ƒ</em>/dx<sub>n</sub> = 0</em></p>
<p>A short-hand way of expressing the above equations is by using the gradient vector, giving<em>∇ƒ(<strong>x</strong>) = <strong>0</strong></em>.&nbsp; By definition, the gradient is defined by:</p>
<p align="center"><em>∇ƒ(<strong>x</strong>) = [<em>∂<em>ƒ</em>/dx<sub>1</sub>, ∂<em>ƒ</em>/dx<sub>2</sub></em>, … , <em>∂<em>ƒ</em>/dx<sub>n</sub></em>].</em></p>
<p>An analytical solution is not always possible, hence the motivation for approximating the solution using numerical methods.</p>
<h1>Newton’s Method</h1>
<p>In general, this method is written below.&nbsp; Explanation of each step will follow.</p>
<ol>
<li>Given the equations to solve, derive equations for the approximating line or plane, depending on whether the problem is 2D, 3D, nD, etc.</li>
<li>Using the linearized equations, solve the system of equations</li>
<li>Using the results from step 2, generate new equations for a new approximating line or plane, and repeat step 2.</li>
</ol>
<p>This method also involves starting with a guess, denoted by a variable with a subscript of 0.&nbsp; A guess is required, because this is the starting point for this method.&nbsp; Using this guess, each successive solution <em>should</em> converge (more on that later).</p>
<h2>Step 1</h2>
<p>In order to solve the equations <em>∇ƒ(<strong>x</strong>) = <strong>0</strong></em> (see Motivation for more information), we can apply multivariate Newton’s method to approximate the solution.&nbsp; Like the single-variate (two-dimensional) version, a linear approximation is required.&nbsp; However, instead of having an approximation in the form of a line, the approximation is a plane instead.</p>
<p align="center">2D (line): <em>ƒ(x) ≈ ƒ(x<sub>0</sub>) + ƒ’(x<sub>0</sub>)(x &#8211; x<sub>0</sub>)</em></p>
<p align="center">3D (plane): <em>ƒ(x, y) ≈ ƒ(x<sub>0</sub>, y<sub>0</sub>) + ƒ<sub>x</sub>(x<sub>0</sub>, y<sub>0</sub>)(x &#8211; x<sub>0</sub>) + ƒ<sub>y</sub>(x<sub>0</sub>, y<sub>0</sub>)(y &#8211; y<sub>0</sub>)</em></p>
<p align="center">nD (nD plane): <em>ƒ(<strong>x</strong>) ≈ ƒ(<strong>x<sub>0</sub></strong>) + <em>∇ƒ(<strong>x<sub>0</sub></strong>)(<strong>x</strong> &#8211; <strong>x<sub>0</sub></strong>)</em></em></p>
<p>Since we are trying to optimize, we have the partial derivatives of the function we are trying to optimize, but in order to apply Newton’s Method, we need a linear approximation of the partial derivatives.&nbsp; This means that in order to approximate the partial derivatives, we need to take another derivative in order to get the slopes of the approximating planes.&nbsp; If that description didn’t make sense, try the following.&nbsp; For an equation with two independent variables, there will be two equations for the partial derivatives, one for x and one for y.&nbsp; Taking partial derivatives from each of those equations again will give the slopes of the plane that approximate the first partial derivative.&nbsp; So if we have two independent variables, we end up getting four equations: ƒ<sub>xx</sub>, ƒ<sub>xy</sub>,ƒ<sub>yy</sub>, and ƒ<sub>yx</sub> (ƒ<sub>xy </sub>and ƒ<sub>yx</sub> should be the same).&nbsp; In general, for n partial derivatives, we would have <em>n²</em> equations if we took another set of derivatives.&nbsp; The approximations for both of the partial derivatives would be:</p>
<p align="center"><em>ƒ<sub>x</sub>(x, y) ≈ <em>ƒ<sub>x</sub></em>(x<sub>0</sub>, y<sub>0</sub>) + ƒ<sub>xx</sub>(x<sub>0</sub>, y<sub>0</sub>)(x &#8211; x<sub>0</sub>) + ƒ<sub>xy</sub>(x<sub>0</sub>, y<sub>0</sub>)(y &#8211; y<sub>0</sub>)</em></p>
<p align="center"><em>ƒ<sub>y</sub>(x, y) ≈ <em>ƒ<sub>y</sub></em>(x<sub>0</sub>, y<sub>0</sub>) + ƒ<sub>yy</sub>(x<sub>0</sub>, y<sub>0</sub>)(x &#8211; x<sub>0</sub>) + ƒ<sub>yx</sub>(x<sub>0</sub>, y<sub>0</sub>)(y &#8211; y<sub>0</sub>)</em></p>
<p align="left">Plug in the values for the second derivatives, and the values from the initial guess (the x y values and what function value you get using those values).</p>
<h2>Step 2</h2>
<p>Although the equations generated from step 1 is yet another system of equations, the main difference is that the equations from step 1 are <strong>linear</strong>.&nbsp; This means that the system can be solved analytically.&nbsp; Solve for the solution of the system using <a href="http://en.wikibooks.org/wiki/Linear_Algebra/Row_Reduction_and_Echelon_Forms" target="_blank" rel="noopener noreferrer">row reduction methods</a>, or other methods.&nbsp; The solution from solving the system will be the values used for the next iteration and will replace the guessed values.&nbsp; The solution may or may not be close to the actual solution.&nbsp; More iterations need to be done to see if the answer changes with each iteration.&nbsp; Usually if the guess is really far away, then it takes a lot of iterations to get it really close.&nbsp; However, sometimes, a bad guess may cause the solution to diverge, meaning that the solution will be further and further off.</p>
<h2>Step 3</h2>
<p>Generate new equations for the approximating planes using the solution from step 2.&nbsp; Using these equations, go back to step 2 and solve it again.&nbsp; This method is super tedious if done on paper.&nbsp; Matlab can help, but then again, Matlab can do the entire approximation with just a few commands, but not everyone has access to it unfortunately.</p>
<p>Hopefully after a few iterations, the solution stops changing.&nbsp; When that happens, you can substitute the final solution back into the original equation to see if it works!</p>
<h1>Steepest Descent Method</h1>
<p>Here is the general method:</p>
<ol>
<li>Find the direction of the maximum or minimum directional derivative</li>
<li>Follow it until a maximum or minimum is reached</li>
</ol>
<p>Newton’s Method is sufficient in a lot of cases, but sometimes it may be too hard to go beyond first derivatives.&nbsp; This main idea of this method is to use the first derivative and follow the direction in which the function gets larger/smaller.&nbsp; A fundamental concept used in this method is the directional derivative.&nbsp; Since in 3D (or higher dimensions), we are not restricted to movement along the x axis.&nbsp; This means we could move in any random direction, and in each direction the rate of change is going to be different.&nbsp; To calculate the max or min, we need to calculate where the directional derivative is largest or smallest.&nbsp; Just like a boulder rolling down the steepest slope on the hill.</p>
<p>Starting with a guess, we can find out the value of the function at the point and the direction to travel in.&nbsp; Take a step in that direction and see how the value of the function changed.&nbsp; Keep doing that until a max or min is reached.</p>
<h2>Step 1</h2>
<p>The definition of the directional derivative is the dot product of the gradient and the unit vector specifying the direction.&nbsp; Here is the definition of the directional derivative:</p>
<p align="center"><em>D<sub>u</sub>ƒ = ∇ƒ(<strong>x</strong>)<strong>·u</strong></em></p>
<p align="left">Since the definition involves a dot product, it is true that if the two vectors are orthogonal, the resulting dot product is zero.&nbsp; The direction that this derivative is in is called the <em>level direction</em>.&nbsp; But if the two vectors are parallel, we get the highest value of the directional derivative.&nbsp; For a vector that is parallel in the same direction, the directional derivative will be a maximum, but if the vector is antiparallel (parallel but both pointing opposite ways), the directional derivative will be a minimum.</p>
<p align="left">Since the maximum value of the directional derivative is parallel to the gradient, we can calculate the unit vector of the gradient and use it as the unit vector <strong><em>u.&nbsp; </em></strong>In order to get the minimum, simply flip the direction of the vector by multiplying it by –1.</p>
<p align="center"><em><strong>u = </strong>∇ƒ(<strong>x</strong>)/|∇ƒ(<strong>x</strong>)|</em></p>
<p align="left">Although not necessarily required, substituting this value into the definition of the directional derivative, and doing some simplification with algebra, the maximum and minimum directional derivative is given by:</p>
<p align="center"><em>Max D<sub>u</sub>ƒ = |∇ƒ(<strong>x</strong>)|</em></p>
<p align="center"><em>Min D<sub>u</sub>ƒ = -|∇ƒ(<strong>x</strong>)|</em></p>
<p align="left">Using the initial guess, calculate the direction of to travel in at that point.</p>
<h2>Step 2</h2>
<p>Knowing the direction to travel choose a desired step size “h”.&nbsp; This means that if the equation will be traversed in a particular direction, we need to know exactly <em>how</em> far to go.&nbsp; Choosing smaller step sizes gives better computational accuracy but increases computation time.</p>
<p>To get to the maximum, use the direction for the maximum directional derivative.&nbsp; To get the minimum, use the direction for the smallest directional derivative.</p>
<p>Starting with a guess, calculate the function value at that point.&nbsp; Then take a step in the direction given by Step 1 using the step size.&nbsp; The variable “u” here is a component of the unit vector</p>
<p align="center"><em>x<sub>n+1</sub> = x<sub>n</sub> + u<sub>x</sub>h</em></p>
<p align="center">y<em><sub>n+1</sub> = y<sub>n</sub> + u<sub>y</sub>h</em></p>
<p align="left">At this new value, calculate the function value again.&nbsp; Keep repeating this until the maximum or minimum is reached.</p>
<h1>Limitation</h1>
<p>The approximation is generally only as good as the initial guess.&nbsp; Sometimes, a bad guess can lead to a solution that never converges.&nbsp; In that case, a different value must be used in order to find a converging solution.&nbsp; For example, if we have a fourth order polynomial function, a local extreme will exist.&nbsp; As x approaches –∞ or ∞, y will do the same.&nbsp; If I use the steepest descent and give a bad guess, my solution will go to ∞ instead of the local extreme.</p>
<h1>Sources</h1>
<ol>
<li>Calculus by Gilbert Strang</li>
<li>Applied Regression Analysis by Norman Draper and Harry Smith</li>
</ol>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.henrypoon.com/blog/2011/01/29/numerical-methods-for-non-linear-optimization/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">763</post-id>	</item>
		<item>
		<title>Polyphasing +1:15 hr</title>
		<link>https://blog.henrypoon.com/blog/2010/02/02/polyphasing-115-hr/</link>
					<comments>https://blog.henrypoon.com/blog/2010/02/02/polyphasing-115-hr/#respond</comments>
		
		<dc:creator><![CDATA[hp]]></dc:creator>
		<pubDate>Tue, 02 Feb 2010 13:16:24 +0000</pubDate>
				<category><![CDATA[health]]></category>
		<category><![CDATA[Arithmetic]]></category>
		<category><![CDATA[Binary arithmetic]]></category>
		<category><![CDATA[COM]]></category>
		<category><![CDATA[Computer]]></category>
		<category><![CDATA[D]]></category>
		<category><![CDATA[Find]]></category>
		<category><![CDATA[Go]]></category>
		<category><![CDATA[Hex]]></category>
		<category><![CDATA[Hexadecimal]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[IME]]></category>
		<category><![CDATA[It]]></category>
		<category><![CDATA[Lexicology]]></category>
		<category><![CDATA[Linguistics]]></category>
		<category><![CDATA[Mathematics]]></category>
		<category><![CDATA[Nap]]></category>
		<category><![CDATA[Sleep]]></category>
		<category><![CDATA[Time]]></category>
		<category><![CDATA[Two's complement]]></category>
		<category><![CDATA[Vol]]></category>
		<category><![CDATA[Woke]]></category>
		<category><![CDATA[Z]]></category>
		<guid isPermaLink="false">http://henrypoon.mooo.com/blog/polyphasing-115-hr</guid>

					<description><![CDATA[The previous day, I had only slept about my usual six and a half hours and I stayed up until 3:15 AM about.&#160; I took a nap in my computer chair for about 30 minutes and woke up.&#160; I knew that if I had slept in my bed, I would&#8217;ve slept like I normally would.&#160; [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>The previous day, I had only slept about my usual six and a half hours and I stayed up until 3:15 AM about.&nbsp; I took a nap in my computer chair for about 30 minutes and woke up.&nbsp; I knew that if I had slept in my bed, I would&#8217;ve slept like I normally would.&nbsp; After waking up at 3:45 AM, I felt the same kind of feeling that I always did when I got up from a nap.&nbsp; It was that familiar drowsiness that always remained minutes after waking up.&nbsp; After that feeling passed, I decided to get started on some classwork that I should have finished a long time ago.&nbsp; The assignment involved binary and hex number arithmetic.&nbsp; There was lots of conversion between hex, decimal and binary.&nbsp; There was also usage of the Two&#8217;s Complement.&nbsp; At this point, I feel no different than usual in terms of my arithmetic ability.&nbsp; The amount of mistakes I made is about the same as usual.&nbsp; However, when it came to reading, I find that I have a harder time concentrating to the text.&nbsp; I can&#8217;t quite tell if it&#8217;s just me not wanting to read, or that it was a result of the nap.</p>
<p>EDIT:&nbsp; I also realize that my prose has also been somewhat affected.&nbsp; The average length of sentences seems to have decreased.</p>
<p>EDIT2: My eyes also feel like they&#8217;re on fire.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.henrypoon.com/blog/2010/02/02/polyphasing-115-hr/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">211</post-id>	</item>
	</channel>
</rss>
