Closed-form solutions to nonlinear PDEs
John D. Cook | Singular Value Consulting
by John
4h ago
The traditional approach to teaching differential equations is to present a collection of techniques for finding closed-form solutions to ordinary differential equations (ODEs). These techniques seem completely unrelated [1] and have arcane names such as integrating factors, exact equations, variation of parameters, etc. Students may reasonably come away from an introductory course with the false impression that it is common for ODEs to have closed-form solutions because it is common in the class. My education reacted against this. We were told from the beginning that differential equations ra ..read more
Visit website
Choosing a Computer Language for a Project
John D. Cook | Singular Value Consulting
by Wayne Joubert
4h ago
Julia. Scala. Lua. TypeScript. Haskell. Go. Dart. Various computer languages new and old are sometimes proposed as better alternatives to mainstream languages. But compared to mainstream choices like Python, C, C++ and Java (cf. Tiobe Index)—are they worth using? Certainly it depends a lot on the planned use: is it a one-off small project, or a large industrial-scale software application? Yet even a one-off project can quickly grow to production-scale, with accompanying growing pains. Startups sometimes face a growth crisis when the nascent code base becomes unwieldy and must be refactored or ..read more
Visit website
On greedy algorithms and rodeo clowns
John D. Cook | Singular Value Consulting
by John
3d ago
This weekend I ran across a blog post The Rodeo Clown Theory of Personal Development. The title comes from a hypothetical example of a goal you don’t know how to achieve: becoming a rodeo clown. Let’s say you decide you want to be a rodeo clown. And let’s say you’re me and you have no idea how to be a rodeo clown. … Can you look at the possibilities currently available to you and imagine which of them might lead to an overall increase of rodeo clowndom in your life, even infinitesimally? Each day you ask yourself what you can do that might lead you closer to your goal. This is a greedy algo ..read more
Visit website
Finding strings in binary files
John D. Cook | Singular Value Consulting
by John
5d ago
There’s a little program called strings that searches for what appear to be strings inside binary file. I’ll refer to it as strings(1) to distinguish the program name from the common English word strings. [1] What does strings(1) consider to be a string? By default it is a sequence of four or more bytes that correspond to printable ASCII strings. There are command options to change the sequence length and the character encoding. There are 98 printable ASCII characters [2] and 256 possible values for an 8-bit byte, so the probability of a byte being a printable character is p = 98/256 = 0.38281 ..read more
Visit website
Extract text from a PDF
John D. Cook | Singular Value Consulting
by John
5d ago
Arshad Khan left a comment on my post on the less and more utilities saying “on ubuntu if I do less on a pdf file, it shows me the text contents of the pdf.” Apparently this is an undocumented feature of GNU less. It works, but I don’t see anything about it in the man page documentation [1]. Not all versions of less do this. On my Mac, less applied to a PDF gives a warning saying “… may be a binary file. See it anyway?” If you insist, it will dump gibberish to the command line. A more portable way to extract text from a PDF would be to use something like the pypdf Python module: from pypd ..read more
Visit website
Length of a general Archimedean spiral
John D. Cook | Singular Value Consulting
by John
5d ago
This post ties together the previous three posts. In this post, I said that an Archimedean spiral has the polar equation r = b θ1/n and applied this here to rolls of carpet. When n = 1, the length of the spiral for θ running from 0 to T is approximately ½ bT² with the approximation becoming more accurate [1] as T increases. In this post we want to look at the general case where n might not be 1. In that case the arc length is given by a hypergeometric function, and finding the asymptotic behavior for large T requires evaluating a hypergeometric function at a large argument. Here’s an example w ..read more
Visit website
How big will a carpet be when you roll or unroll it?
John D. Cook | Singular Value Consulting
by John
5d ago
If you know the dimensions of a carpet, what will the dimensions be when you roll it up into a cylinder? If you know the dimensions of a rolled-up carpet, what will the dimensions be when you unroll it? This post answers both questions. Flexible carpet: solid cylinder The edge of a rolled-up carpet can be described as an Archimedian spiral. In polar coordinates, this spiral has the equation r = hθ / 2π where h is the thickness of the carpet. The previous post gave an exact formula for the length L of the spiral, given the maximum value of θ which we denoted T. It also gave a simple approximat ..read more
Visit website
Approximating a spiral by rings
John D. Cook | Singular Value Consulting
by John
1w ago
An Archimedian spiral has the polar equation r = b θ1/n This post will look at the case n = 1. I may look at more general values of n in a future post. The case n = 1 is the simplest case, and it’s the case I needed for the client project that motivated this post. In this case the spacing between points where the spiral crosses an axis is constant. Call this constant h. Then h = 2πb. For example, when rolling up a carpet, h corresponds to the thickness of the carpet. Suppose θ runs from 0 to 2πm, wrapping around the origin m times. We could approximate the spiral by m concentric ..read more
Visit website
Hypergeometric function of a large negative argument
John D. Cook | Singular Value Consulting
by John
1w ago
It’s occasionally necessary to evaluate a hypergeometric function at a large negative argument. I was working on a project today that involved evaluating F(a, b; c; z) where z is a large negative number. The hypergeometric function F(a, b; c; z) is defined by a power series in z whose coefficients are functions of a, b, and c. However, this power series has radius of convergence 1. This means you can’t use the series to evaluate F(a, b; c; z) for z < −1. It’s important to keep in mind the difference between a function and its power series representation. The former may exist where the latte ..read more
Visit website
Precise answers to useless questions
John D. Cook | Singular Value Consulting
by John
1w ago
I recently ran across a tweet from Allen Downey saying So much of 20th century statistics was just a waste of time, computing precise answers to useless questions. He’s right. I taught mathematical statistics at GSBS [1, 2] several times, and each time I taught it I became more aware of how pointless some of the material was. I do believe mathematical statistics is useful, even some parts whose usefulness isn’t immediately obvious, but there were other parts of the curriculum I couldn’t justify spending time on [3]. Fun and profit I’ll say this in partial defense of computing precise answers t ..read more
Visit website

Follow John D. Cook | Singular Value Consulting on FeedSpot

Continue with Google
Continue with Apple
OR