<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Eric Scott Barr</title><link>https://eb2.co/</link><description>Recent content on Eric Scott Barr</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><copyright>&amp;copy; 2017 Eric Scott Barr</copyright><lastBuildDate>Thu, 17 Dec 2020 04:46:16 -0600</lastBuildDate><atom:link href="https://eb2.co/index.xml" rel="self" type="application/rss+xml"/><item><title>C++ Tips and Tricks: Swap-ish</title><link>https://eb2.co/blog/2020/12/c-tips-and-tricks-swap-ish/</link><pubDate>Thu, 17 Dec 2020 04:46:16 -0600</pubDate><guid>https://eb2.co/blog/2020/12/c-tips-and-tricks-swap-ish/</guid><description>Swapping values in C++ is simple enough with the std::swap standard algorithm. But what if an operation logically requires some transformation on one or both values prior to swapping? Is there some idiomatic solution to combining a swap with transformations? Here&amp;rsquo;s a quick tip to show how to achieve this goal with a little inspiration from other languages.
The Standard Approach Given two variables of the same type, swapping and then performing some transforming operation like negating one of the values looks like the following:</description></item><item><title>Trigonometric Integrals</title><link>https://eb2.co/blog/2016/01/trigonometric-integrals/</link><pubDate>Thu, 21 Jan 2016 08:11:43 +0000</pubDate><guid>https://eb2.co/blog/2016/01/trigonometric-integrals/</guid><description>&lt;p>This week I started back to my journey in mathematics, this time tackling Calculus II. Starting out the week was the section I ended with in Calc I, integration by parts. No sweat! However, the second section for the week was Trigonometric Integrals. I&amp;rsquo;m not certain what I was expecting exactly going into the section, however, after working a few problems I realized something very interesting: I really hadn&amp;rsquo;t learned any new skills, what I had learned was a way to leverage skills I already had to solve problems that were previously unapproachable. Let me demonstrate with finding a solution for the following integration problem:&lt;/p>
&lt;link rel="stylesheet" href="https://eb2.co/katex/katex.min.css" />
&lt;script defer src="https://eb2.co/katex/katex.min.js">&lt;/script>
&lt;script defer src="https://eb2.co/katex/contrib/auto-render.min.js" onload="renderMathInElement(document.body,{&amp;#34;delimiters&amp;#34;:[{&amp;#34;display&amp;#34;:true,&amp;#34;left&amp;#34;:&amp;#34;$$&amp;#34;,&amp;#34;right&amp;#34;:&amp;#34;$$&amp;#34;},{&amp;#34;display&amp;#34;:false,&amp;#34;left&amp;#34;:&amp;#34;$&amp;#34;,&amp;#34;right&amp;#34;:&amp;#34;$&amp;#34;},{&amp;#34;display&amp;#34;:false,&amp;#34;left&amp;#34;:&amp;#34;\\(&amp;#34;,&amp;#34;right&amp;#34;:&amp;#34;\\)&amp;#34;},{&amp;#34;display&amp;#34;:true,&amp;#34;left&amp;#34;:&amp;#34;\\[&amp;#34;,&amp;#34;right&amp;#34;:&amp;#34;\\]&amp;#34;}]});">&lt;/script>&lt;span>
\[\int \frac{\sin \phi}{\cos^{3}\phi}\ d\phi \]
&lt;/span>
&lt;h3 id="what-am-i-doing-here">What am I doing here?&lt;/h3>
&lt;p>I&amp;rsquo;ve learned that the asking and answering of this question for myself is critical to solving problems. In this case, I&amp;rsquo;m trying to solve an integration problem but, truth be told, I know of know way to integrate this problem as it is. It&amp;rsquo;s not in a basic form. The only option in this circumstance is to manipulate the equation until it resembles a basic form that can be solved. So if I had to take a wild guess as to what I&amp;rsquo;m really doing here, it would be that I&amp;rsquo;m going to be manipulating this equation to get it into a basic form.&lt;/p>
&lt;h3 id="manipulating-to-integrate">Manipulating to integrate&lt;/h3>
&lt;p>To this point I&amp;rsquo;ve learned a few ways to manipulate problems:&lt;/p>
&lt;ol>
&lt;li>&lt;strong>Algebraic&lt;/strong> - Perhaps the simplest manipulation, manipulating the problem algebraically to simplify it into a basic form that can be solved.&lt;/li>
&lt;li>&lt;strong>U-Substitution&lt;/strong> - Useful for solving integrals that are composed of a function &lt;em>and its derivative&lt;/em>.&lt;/li>
&lt;li>&lt;strong>Integration by Parts&lt;/strong> - Leveraging a proven relationship to break apart an integral into a function and a, hopefully, simpler integral to solve.&lt;/li>
&lt;/ol>
&lt;p>Note that at times, these manipulation strategies can be combined in order to achieve a solution. However, in the case of the problem I am trying to solve, none of these situations directly apply.&lt;/p>
&lt;p>It should come as no surprise then, that all there is to solving trigonometric integrals is leveraging trigonometric manipulations to get an equation into a basic, solvable, form.&lt;/p></description></item><item><title>Areas Between Curves: Thinking Outside the Vertical Box</title><link>https://eb2.co/blog/2015/12/areas-between-curves-thinking-outside-the-vertical-box/</link><pubDate>Fri, 04 Dec 2015 08:11:43 +0000</pubDate><guid>https://eb2.co/blog/2015/12/areas-between-curves-thinking-outside-the-vertical-box/</guid><description>When learning a number of new math concepts in a short period of time, it can be tempting to just remember the processes and apply them unconditionally, and it often works. However, by not trying to understand a problem first and going straight for the process, we can actually make our lives much more difficult than is necessary. Lets take a look at this by considering the problem of finding the area between $ x = y^2 - 4y $ and $ x = 2y-y^2 $.</description></item><item><title>The volume of the intersection of two similar pipes</title><link>https://eb2.co/blog/2015/11/the-volume-of-the-intersection-of-two-similar-pipes/</link><pubDate>Sun, 29 Nov 2015 21:12:09 +0000</pubDate><guid>https://eb2.co/blog/2015/11/the-volume-of-the-intersection-of-two-similar-pipes/</guid><description>Thanksgiving break is here and after the feasting, when the food weighs heavy and the mind drifts into that hazy place between sleep and awake thanks to loads of carbs and tryptophan, we might find ourselves wondering what the volume is of the space created by two intersecting pipes. At least, my calculus professor seems to think that would be a good quandary to mull over. In this article we will use Thanksgiving leftovers to help visualize the space created by two intersecting pipes and then try to determine the volume of that space; first via approximating and then by getting serious with the tools we&amp;rsquo;ve learned in first year calculus.</description></item><item><title>U-Substitution? U Gotta Be Kidding</title><link>https://eb2.co/blog/2015/11/u-substitution-u-gotta-be-kidding/</link><pubDate>Wed, 25 Nov 2015 04:24:27 +0000</pubDate><guid>https://eb2.co/blog/2015/11/u-substitution-u-gotta-be-kidding/</guid><description>This week in class we&amp;rsquo;ve been learning the interesting things for which area&amp;rsquo;s under a curve provide an answer. And whats finding a definite integral but taking a couple antiderivatives and finding their difference? Nothing to it, right? Wrong!
Let me explain the situation. Currently, I&amp;rsquo;ve spent most of a semester working with the differential branch of calculus. I have a fair understanding of what derivatives are, what they represent. Having spent the first weeks of the semester using limits to find the slopes of tangent lines, I certainly have an appreciation for how powerful they are.</description></item><item><title>Reference Angles and the Fundamental Identity</title><link>https://eb2.co/blog/2015/06/reference-angles-and-the-fundamental-identity/</link><pubDate>Sat, 13 Jun 2015 02:10:45 +0000</pubDate><guid>https://eb2.co/blog/2015/06/reference-angles-and-the-fundamental-identity/</guid><description>In the previous article in the series on trigonometry, the focus was on solving right triangles using their unique properties. But what about angles that don&amp;rsquo;t fit nicely within quadrant I of the cartesian coordinate plane? This article will demonstrate how to solve these types of angles/triangles using reference angles. Finally, it will wrap up by explaining an interesting relationship between sine and cosine, also known as the Fundamental Identiy.</description></item><item><title>Trigonometry and Right Angles</title><link>https://eb2.co/blog/2015/06/trigonometry-and-right-angles/</link><pubDate>Fri, 12 Jun 2015 02:10:45 +0000</pubDate><guid>https://eb2.co/blog/2015/06/trigonometry-and-right-angles/</guid><description>Using all the tricks in the proverbial math bag that have been gathered in the course of this series on trigonometry, it is possible to determine what the measures of the sides and angles of a right triangle trigonometrically; without measuring them. This article will demonstrate how to solve a triangle but first it will start with a question. Given a right triangle, where one angle is 90° and another angle $ \alpha $, which must be $ 0° \le \alpha \le 90° $: what is the value of $ \alpha $ if the $ \text{sin}\ \alpha = \frac{\sqrt{2}}{2} $?</description></item><item><title>Trigonometric Functions</title><link>https://eb2.co/blog/2015/06/trigonometric-functions/</link><pubDate>Thu, 11 Jun 2015 06:10:45 +0000</pubDate><guid>https://eb2.co/blog/2015/06/trigonometric-functions/</guid><description>At the heart of trigonometry lies the study of the relationship between the angles of a triangle and the length of its sides. There exists 6 such relationships, known as the trigonometric functions. This article in the series on trigonometry aims to define the trigonometric functions as a set of ratios and show how they can be derived from certain common angles.
To begin consider an angle $ \alpha $ in standard position and a terminal side forming an angle between 0° and 90°, with a point $ \text{(x,y)} $ anywhere on the terminal side that is not the origin.</description></item><item><title>Angular and Linear Velocities</title><link>https://eb2.co/blog/2015/06/angular-and-linear-velocities/</link><pubDate>Wed, 10 Jun 2015 22:10:45 +0000</pubDate><guid>https://eb2.co/blog/2015/06/angular-and-linear-velocities/</guid><description>This article will look at objects that rotate around a circle and introduce two forms of velocity, which is the rate at which objects move in relation to time: angular and linear velocities. The initial article of this series on trigonometry defined an angle as one ray, the terminal side, rotating away from another ray, the initial side. In the second article, two points of those rays were fixed onto a unit circle.</description></item><item><title>Radians, Arcs, and Everything Between</title><link>https://eb2.co/blog/2015/06/radians-arcs-and-everything-between/</link><pubDate>Wed, 10 Jun 2015 02:10:45 +0000</pubDate><guid>https://eb2.co/blog/2015/06/radians-arcs-and-everything-between/</guid><description>In everyday life when most people think of angles and their measurements, they think of a measurement in degrees. However, as previously mentioned, this unit of measurement is based on a crude likening of rotations around a point to the rotation of the earth around the sun. This results in some rather complicated formulas when working with degrees. For this reason, another type of measurement was divised, one that is based in mathmatics.</description></item><item><title>Angles and Their Measurements</title><link>https://eb2.co/blog/2015/06/angles-and-their-measurements/</link><pubDate>Mon, 08 Jun 2015 02:10:45 +0000</pubDate><guid>https://eb2.co/blog/2015/06/angles-and-their-measurements/</guid><description>What are angles? How are they measured? Answering these questions is the focus of this article, part of a series on trigonometry. This article will identify all the constituants of an angle, describe several special angles, and show how angles have been measured for thousands of years.
The first step to understanding angles, is understanding what a ray is. Rays are defined by a point on a fixed line, and all the points to one side, or the other, of that point.</description></item><item><title>Driving Boost.Test with CMake</title><link>https://eb2.co/blog/2015/06/driving-boost.test-with-cmake/</link><pubDate>Tue, 02 Jun 2015 02:10:45 +0000</pubDate><guid>https://eb2.co/blog/2015/06/driving-boost.test-with-cmake/</guid><description>Boost.Test is one of the more popular C++ based test frameworks on the market. With it being a boost library, chances are its already installed in the local environment, or can be easily built. This article doesn&amp;rsquo;t aim to show how to use Boost.Test. Rather, it shows how to incorporate building and running those tests with CMake, one of the most popular build systems for C++ projects. This article assumes that a CMake based project already exists.</description></item><item><title>C++14 and SDL2: Managing Resources</title><link>https://eb2.co/blog/2014/04/c-14-and-sdl2-managing-resources/</link><pubDate>Thu, 17 Apr 2014 04:39:34 +0000</pubDate><guid>https://eb2.co/blog/2014/04/c-14-and-sdl2-managing-resources/</guid><description>Update: The final solution in this article has been updated based on feedback from nanofortnight on Hacker News. This change, while not solving the complexity of what it means to work with C++ templates, does help significantly with the readability of this solution.
Update 2: Added a final example that shows how the general make_resource helper can be used to simplify writing higher level C++ abstractions around C libraries
Update 3: In order to offer proper RAII semantics the make_resource function now throws if the resource fails to create.</description></item><item><title>Sphinx and CMake: Beautiful Documentation For C++ Projects</title><link>https://eb2.co/blog/2012/03/sphinx-and-cmake-beautiful-documentation-for-c-projects/</link><pubDate>Tue, 13 Mar 2012 00:00:00 +0000</pubDate><guid>https://eb2.co/blog/2012/03/sphinx-and-cmake-beautiful-documentation-for-c-projects/</guid><description>Let&amp;rsquo;s face it, documentation for (most) developers is boring and more often than not this is reflected in the quality of a project&amp;rsquo;s documentation. This is often a barrier that prevents adoption of otherwise well crafted projects in wide-spread production use. In this article we&amp;rsquo;ll take a look at how to integrate a documentation generator called Sphinx into an existing CMake based project for documentation that is regenerated each time you build the source.</description></item><item><title>Building Boost.Python for Python 3.2</title><link>https://eb2.co/blog/2012/03/building-boost.python-for-python-3.2/</link><pubDate>Mon, 05 Mar 2012 00:00:00 +0000</pubDate><guid>https://eb2.co/blog/2012/03/building-boost.python-for-python-3.2/</guid><description>Boost.Python is an excellent tool for exposing C++ code to Python. Building Boost with support for the latest version of Python is not that difficult but as most unix systems ship with Python 2.7 or earlier the default options are generally not sufficient.
To start out, make sure that you have the latest version of Python installed. On Ubuntu or debian based environments this is as simple as running the following command.</description></item><item><title>Installing Jenkins on Ubuntu Server</title><link>https://eb2.co/blog/2012/03/installing-jenkins-on-ubuntu-server/</link><pubDate>Sun, 04 Mar 2012 00:00:00 +0000</pubDate><guid>https://eb2.co/blog/2012/03/installing-jenkins-on-ubuntu-server/</guid><description>Jenkins is an excellent platform for managing automated builds and getting started on Ubuntu Server is a snap. This guide covers the setup of Jenkins as well as how to use the default Ubuntu Apache web-server installation as a front-end to make URL&amp;rsquo;s nicer.
Installing Jenkins Installing Jenkins itself is pretty straightforward using default package system:
sudo apt-get install jenkins After the installation completes you can access the Jenkins installation at http://SERVER_IP:8080/</description></item></channel></rss>