Categories

Numerical Methods

  • Jun 10, 2010

    Objective-C era

    Sorting an NSMutableArray with a random comparison method

    If you sorted an NSMutableArray with a comparison method that randomly returns either higher or lower, would the result be an even, random distribution? Spoiler: no it won't but the actual distribution is interesting nonetheless. I'll show you what would happen if you did sort this way (and also show you how to correctly randomize an array if you did want an even distribution).

    Read article

  • Sep 9, 2008

    Objective-C era

    Parametric acceleration curves in Core Animation

    CAMediaTimerFunction is used to control basic acceleration along a path in Core Animation but is very limited in what in can do. In this post, I look at the mathematics behind CAMediaTimerFunction and present a sample application that simulates some functions that CAMediaTimerFunction can't achieve by using parametric CAKeyframeAnimation values.

    Read article

  • May 9, 2008

    Objective-C era

    Square Root: Numerical fun with NSDecimalNumber

    NSDecimalNumber is a powerful Foundation class that holds high precision base 10 numbers. The default class only provides basic arithmetic operators, leaving you to write any advanced operations that you need. This is an example that implements a square root using NSDecimalNumber.

    Read article