サクサク読めて、アプリ限定の機能も多数!
トップへ戻る
アメリカ大統領選
www.johndcook.com
The Book of Common Prayer contains the confession … we have left undone those things which we ought to have done, and we have done those things which we ought not to have done. The things left undone are called sins of omission; things which ought not to have been done are called sins of commission. In software testing and debugging, we focus on sins of commission, code that was implemented incorr
A few weeks ago I started a series of posts on various things you could do with a functional fold. In the first post I mentioned that the idea came from a paper by Brian Beckman on Kalman filters and folds: This post was inspired by a paper by Brian Beckman (in progress) that shows how a Kalman filter can be implemented as a fold. From a Bayesian perspective, the thing that makes the Kalman filter
Presentation order People best understand computer programs in a different order than compilers do. This is a key idea of literate programming, and one that distinguishes literate programs from heavily commented programs. Traditional source code, no matter how heavily commented, is presented in the order dictated by the compiler. The computer is the primary audience. Literate programming is more h
Phil Webb had an insightful tweet the other day. What would you like to complain about? [ ] Too much magic [ ] Too much boilerplate — Phil Webb (@phillip_webb) March 5, 2016 Programming environments oscillate between boilerplate and magic. APIs tend to start out with all the wires exposed. Programming is tedious, but nothing is hidden. Development is hard, but debugging is easy. See, for example,
Here’s an insightful paragraph from James Hague’s blog post Organization skills beat algorithmic wizardry: When it comes to writing code, the number one most important skill is how to keep a tangle of features from collapsing under the weight of its own complexity. I’ve worked on large telecommunications systems, console games, blogging software, a bunch of personal tools, and very rarely is there
Here’s a nice quip from Luke Gorrie on Twitter: Monads are hard because there are so many bad monad tutorials getting in the way of finally finding Wadler’s nice paper. Here’s the paper by Philip Wadler that I expect Luke Gorrie had in mind: Monads for functional programming. Here’s the key line from Wadler’s paper: Pure functional languages have this advantage: all flow of data is made explicit.
I tried typesetting music in LaTeX some time ago and gave up. The packages I found were hard to install, the examples didn’t work, etc. This weekend I decided to try again. I tried plowing through the MusiXTeX documentation and got no further than I did last time. I posted a note on StackOverflow and got some good responses. Nikhil Chelliah suggested I look at LilyPond. I had looked at LilyPond be
Here I list some the symbols that come up frequently in math and describe how to represent them in TeX, HTML, XML, and Unicode. HTML provides a mnemonic form for 252 of the most common symbols. (See a full list from the W3C.) These are called "character entities." You can simply put Unicode characters directly into an HTML page as long as you have an input method and the content-type of your HTML
Gilad Bracha’s presentation on Dart is interesting even if, like me, you do not intend to learn Dart. He has some good one-liners, especially digs at JavaScript, and some interesting ideas about programming language design. (JavaScript comes up frequently in presentation because of its popularity and because Dart compiles to JavaScript.) Application programmers, unless they’ve committed serious cr
R programming for those coming from other languages Introduction Assignment and underscore Variable name gotchas Vectors Sequences Types Boolean operators Lists Matrices Missing values and NaNs Comments Functions Scope Misc. Other resources Ukrainian translation Other languages: Introduction I have written software professionally in perhaps a dozen programming languages, and the hardest language f
No Starch Press sent me a copy of The Art of R Programming last Fall and I wrote a review of it here. Then a couple weeks ago, Manning sent me a copy of R in Action (ISBN 1935182390). Here I’ll give a quick comparison of the two books, then focus specifically on R in Action. Comparing R books Norman Matloff, author of The Art of R Programming, is a statistician-turned-computer scientist. As the ti
David Jacobs has written a long blog post Ruby is beautiful (but I’m moving to Python). [Update: link no longer available.] Here’s my summary. Ruby is much better than Java, but the Ruby community is too focused on web development and the language has no scientific library. Python has a lot of the same advantages as Ruby, is used for more than web programming, and has SciPy. Update: There is now a
Here’s an answer I gave on Stack Overflow to someone asking when it’s OK to use global variables. Here’s a cheap way to get rid of all global variables: put all your code in one big fat class and change the global variables to member variables. Nothing has changed as far as the maintainability of your code, but technically it no longer has global variables. It’s better to talk about size of scope
IEEE floating-point exceptions in C++ This page will answer the following questions. My program just printed out 1.#IND or 1.#INF (on Windows) or nan or inf (on Linux). What happened? How can I tell if a number is really a number and not a NaN or an infinity? How can I find out more details at runtime about kinds of NaNs and infinities? Do you have any sample code to show how this works? Where can
People who write Python choose to write Python. I don’t hear people say “I use Python at work because I have to, but I’d rather be writing Java.” But often I do hear people say they’d like to use Python if their job would allow it. There must be someone out there writing Python who would rather not, but I think that’s more common with other languages. My point isn’t that everyone loves Python, but
The most obvious way to compute the soft maximum can easily fail due to overflow or underflow. The soft maximum of x and y is defined by g(x, y) = log( exp(x) + exp(y) ). The most obvious way to turn the definition above into C code would be double SoftMaximum(double x, double y) { return log( exp(x) + exp(y) ); } This works for some values of x and y, but fails if x or y is large. For example, if
The new C++ standard includes a couple Python-like features that I ran across recently. There are other Python-like features in the new standard, but here I’ll discuss range-based for-loops and raw strings. In Python you loop over lists rather than incrementing a loop counter variable. For example, for p in [2, 3, 5, 7, 11]: print p Range-based for loops now let you do something similar in C++11:
Functional programming emphasizes “pure” functions, functions that have no side effects. When you call a pure function, all you need to know is the return value of the function. You can be confident that calling a function doesn’t leave any state changes that will effect future function calls. But pure functions are only pure at a certain level of abstraction. Every function has some side effect:
We help companies solve hard problems in mathematics, statistics, and computing. Let’s explore how we might work together. Given a hash value, can you determine what algorithm produced it? Or what algorithm probably produced it? Obviously if a hash value is 128 bits long, then a 128-bit algorithm produced it. Such a hash value might have been produced by MD5, but not by SHA-1, because the former p
Getting started with C++ TR1 regular expressions Overview Header and namespace C++ regular expression flavor Matching Retrieving matches Replacing matches Escape sequences Case-sensitivity Troubleshooting Overview This article is written for the benefit of someone familiar with regular expressions but not with the use of regular expressions in C++ via the TR1 (C++ Standards Committee Technical Rep
There is hardly ever a good reason to invert a matrix. What do you do if you need to solve Ax = b where A is an n x n matrix? Isn’t the solution A−1 b? Yes, theoretically. But that doesn’t mean you need to actually find A−1. Solving the equation Ax = b is faster than finding A−1. Books might write the problem as x = A−1 b, but that doesn’t mean they expect you to calculate it that way. What if you
Probability distributions have a surprising number inter-connections. A dashed line in the chart below indicates an approximate (limit) relationship between two distribution families. A solid line indicates an exact relationship: special case, sum, or transformation. Click on a distribution for the parameterization of that distribution. Click on an arrow for details on the relationship represented
Diagram of distribution relationships Probability distributions have a surprising number inter-connections. A dashed line in the chart below indicates an approximate (limit) relationship between two distribution families. A solid line indicates an exact relationship: special case, sum, or transformation. Click on a distribution for the parameterization of that distribution. Click on an arrow for d
In applications you often want to take the maximum of two numbers. But the simple function f(x, y) = max(x, y) can be difficult to work with because it has sharp corners. Sometimes you want an alternative that sands down the sharp edges of the maximum function. One such alternative is the soft maximum. Here are some questions this post will answer. What exactly is a soft maximum and why is it call
Here are some notes on how to work with probability distributions using the SciPy numerical library for Python. Functions related to probability distributions are located in scipy.stats. The general pattern is scipy.stats.<distribution family>.<function> There are 81 supported continuous distribution families and 12 discrete distribution families. Some distributions have obvious names: gamma, cauc
Conjugate prior relationships The following diagram summarizes conjugate prior relationships for a number of common sampling distributions. Arrows point from a sampling distribution to its conjugate prior distribution. The symbol near the arrow indicates which parameter the prior is unknown. These relationships depends critically on choice of parameterization, some of which are uncommon. This page
Outline Introduction Assignment and underscore Variable name gotchas Vectors Sequences Types Boolean operators Lists Matrices Missing values and NaNs Comments Functions Scope Misc. Other resources Introduction I have written software professionally in perhaps a dozen programming languages, and the hardest language for me to learn has been R. The language is actually fairly simple, but it is unconv
このページを最初にブックマークしてみませんか?
『Expert consulting in applied mathematics & data privacy』の新着エントリーを見る
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く