peeterjoot
peeterjoot
Shameless self-promotion
662 posts
Automatically reposting stuff from my real blog
Don't wanna be here? Send us removal request.
peeterjoot · 4 days ago
Text
toycalculator, an MLIR/LLVM compiler experiment.
Over the last 8 years, I’ve been intimately involved in building a pair of LLVM based compilers for the COBOL and PL/I languages.  However, a lot of my work was on the runtime side of the story. This was non-trivial work, with lots of complex interactions to figure out, but it also meant that I didn’t get to play with the fun (codegen) part of the compiler. Over the last month or so, I’ve been…
0 notes
peeterjoot · 8 days ago
Text
A little float explorer program
Karl’s 1st year C programming course included IEEE floating point representation.  It’s good to understand that representation, but pretty silly to try to do those conversions by hand. I remember covering this in our computer organization course, but by that time I’d already figured it out for my own purposes.  I wasn’t smart enough to look it up, and figured it out the hard way by reverse…
Tumblr media
View On WordPress
0 notes
peeterjoot · 21 days ago
Text
more git-fu: reset --hard after force push
When I have a branch that I’m sharing only between myself, it’s occasionally helpful to force push and then reset all the other repo versions of the branch to the new one.  Yes, I know that’s inherently dangerous, and I’ve screwed up doing this a couple times. Here’s one way to do it: # alias gitbranch='git branch --show-current' git fetch git reset origin/`gitbranch` --hard When I do this, I…
0 notes
peeterjoot · 1 month ago
Text
git diff against previous
0 notes
peeterjoot · 1 month ago
Text
Weighted geometric series
[Click here for a PDF version of this post] Karl needed to evaluate the sum: \begin{equation}\label{eqn:weightedGeometric:20} S = \sum_{k = 0}^9 \frac{a + b k}{\lr{ 1 + i }^k} \end{equation} He ended up using a spreadsheet, which was a quick and effective way to deal with the problem. I was curious about this sum, since he asked me how to sum it symbolically, and I didn’t know. Mathematica…
Tumblr media
View On WordPress
0 notes
peeterjoot · 1 month ago
Text
Wonderful Life=Giving Radium
From “The Wide World” Magazine, June 1905 edition “This remarkable substance is absolute and quick death to the germs of cancer, tumor, consumption, malaria, blood poison, ulcers and all forms of existing disease.  When it enters the system every vestige of disease is driven out, as no germ can live in its presence.” The amusing thing is that the idea of this advertisement has a close analogue…
Tumblr media
View On WordPress
0 notes
peeterjoot · 1 month ago
Text
Impedance refresher.
[Click here for a PDF version of this post] Karl is taking his circuits course right now, which means that I get a chance to field some questions. I don’t get an excuse to think about this stuff any more. It’s fun material, since most of the ideas are all really simple, and you can figure out everything from first principles. Karl just started sinusoidal circuits, which I think is a bit exciting.…
Tumblr media
View On WordPress
0 notes
peeterjoot · 3 months ago
Text
Pascal's triangle: binomial coefficients, value and recurrence relation
[Click here for a PDF version of this post] I saw an interesting solution of an introductory programming source sample problem, showing how to display Pascal’s triangle up to a given size. For example, given input \( n = 5 \), the output should be like: \begin{equation*} \begin{array}{c} 1 \\ 1 \quad 1 \\ 1 \quad 2 \quad 1 \\ 1 \quad 3 \quad 3 \quad 1 \\ 1 \quad 4 \quad 6 \quad 4 \quad 1 \\ 1…
Tumblr media
View On WordPress
0 notes
peeterjoot · 3 months ago
Text
Electric fields for ring and disk charge distributions (along the central axis.)
[Click here for a PDF version of this post] Motivation: explain field formulas in an engineering problem set. The following equations were given in a problem set for the magnitude of the electric field strength at a point \( z \) due to symmetric ring and disk charge distributions respectively: \begin{equation}\label{eqn:ringAndDiskField:20} E = \frac{q z}{4 \pi \epsilon_0 \lr{ z^2 + R^2 }^{3/2}…
Tumblr media
View On WordPress
0 notes
peeterjoot · 3 months ago
Text
A Green's function solution to falling with resistance problem.
[Click here for a PDF version of this post] Motivation. In a fun twitter/x post, we have a Green’s function solution to a constant acceleration problem with drag. The post is meant to be a joke, as the stated problem is: “A boy drops a ball from a height \( h \). What is the speed of the ball when it reaches the floor (no drag)?” The joke is that nobody would solve this problem using Green’s…
Tumblr media
View On WordPress
0 notes
peeterjoot · 3 months ago
Text
A PV integral using contour integration.
[Click here for a PDF version of this post] Here’s the second last real-integral sub-problem from [1], problem 31(j). Find \begin{equation}\label{eqn:oscillatorKernel:20} I = P \int_{-\infty}^\infty \inv{ \lr{ \omega’ – \omega_0 }^2 + a^2 } \inv{ \omega’ – \omega } d\omega’. \end{equation} Our poles are sitting at \( \omega \), and \begin{equation}\label{eqn:oscillatorKernel:80} \alpha, \beta =…
Tumblr media
View On WordPress
0 notes
peeterjoot · 3 months ago
Text
More residue calculus: sinc squared, fractional exponent, log, pie contour
[Click here for a PDF version of this post] Sinc squared. This is problem 31(g) from [1]. Find \begin{equation}\label{eqn:sincSquared:20} I = \int_{-\infty}^\infty \frac{\sin^2 x}{x^2} dx. \end{equation} We will use the same upper half plane semicircular contour, enclosing the second order pole at the origin. This time we write \begin{equation}\label{eqn:sincSquared:40} \sin^2 x = \frac{ 1 –…
Tumblr media
View On WordPress
0 notes
peeterjoot · 3 months ago
Text
A weighted sinc function integral.
[Click here for a PDF version of this post] Here’s another real integral problem from [1] (31(f)). Find \begin{equation}\label{eqn:weightedSinc:20} I = \int_0^\infty \frac{\sin x dx}{x\lr{ x^2 + a^2 }}. \end{equation} Both Mathematica and the text state that the answer is \begin{equation}\label{eqn:weightedSinc:40} I = \frac{\pi}{2 a^2} \lr{ 1 – e^{-a}}. \end{equation} My initial attempt to…
Tumblr media
View On WordPress
0 notes
peeterjoot · 3 months ago
Text
A contour integral with a third order pole.
[Click here for a PDF version of this post] Here’s problem 31(e) from [1]. Find \begin{equation}\label{eqn:thirdOrderPole:20} I = \int_0^\infty \frac{x^2 dx}{\lr{ a^2 + x^2 }^3 }. \end{equation} Again, we use the contour \( C \) illustrated in fig. 1 fig. 1. Standard above the x-axis, semicircular contour. Along the infinite semicircle, with \( z = R e^{i\theta}…
Tumblr media
View On WordPress
0 notes
peeterjoot · 3 months ago
Text
Another real integral using contour integration.
[Click here for a PDF version of this post] Here’s (31(d)) from [1]. Find \begin{equation}\label{eqn:fourPoles:20} I = \int_0^\infty \frac{dx}{1 + x^4} = \inv{2}\int_{-\infty}^\infty \frac{dx}{1 + x^4}. \end{equation} This one is easy conceptually, but a bit messy algebraically. We integrate over the contour \( C \) illustrated in fig. 1. fig. 1. Standard above the x-axis, semicircular…
Tumblr media
View On WordPress
0 notes
peeterjoot · 3 months ago
Text
Evaluating some real trig integrals with unit circle contours.
[Click here for a PDF version of this post] Here are a couple of problems from [1]. A sine integral. This is problem (31(a)). For \( a > b > 0 \), find \begin{equation}\label{eqn:unitCircleContourIntegrals:20} I = \int_0^{2 \pi} \frac{d\theta}{a + b \sin\theta}. \end{equation} We can proceed by making a change of variables \( z = e^{i\theta} \), for which \( dz = i z d\theta \). Also let \(…
0 notes
peeterjoot · 3 months ago
Text
What will be the value of k to satisfy this integral equation
[Click here for a PDF version of this post] Another problem from x/twitter [1]: Find \( k \), where \begin{equation}\label{eqn:trigProp:20} \int_0^{2 \pi} \sin^4 x dx = k \int_0^{\pi/2} \cos^4 x dx. \end{equation} I initially misread the integration range in the second integral as \( 2 \pi \), not \( \pi/2 \), in which case the answer is just 1 by inspection. However, solving the stated problem,…
Tumblr media
View On WordPress
0 notes