# Posts Tagged ‘ Math ’

## How many perfect riffle shuffles are required to restore a deck to its initial order?

September 24, 2018
By

Last week I compared the overhand shuffle to the riffle shuffle. I used random operations to simulate both kinds of shuffles and then compared how well they mix cards. The article caused one my colleague and fellow blogger, Rob Pratt, to ask if I was familiar with a bit of

Tags: , ,
Posted in SAS | Comments Off on How many perfect riffle shuffles are required to restore a deck to its initial order?

## Distances on rectangular grids

September 10, 2018
By

Given a rectangular grid with unit spacing, what is the expected distance between two random vertices, where distance is measured in the L1 metric? (Here "random" means "uniformly at random.") I recently needed this answer for some small grids, such as the one to the right, which is a 7 x 6

Tags: , , ,
Posted in SAS | Comments Off on Distances on rectangular grids

## The continued fraction representation of a rational number

September 6, 2018
By

Continued fractions show up in surprising places. They are used in the numerical approximations of certain functions, including the evaluation of the normal cumulative distribution function (normal CDF) for large values of x (El-bolkiny, 1995, p. 75-77) and in approximating the Lambert W function, which has applications in the modeling

Tags: ,
Posted in SAS | Comments Off on The continued fraction representation of a rational number

## Offset regions: Find all points within a specified distance from a polygon

July 16, 2018
By

My colleague Robert Allison recently blogged about using the diameter of Texas as a unit of measurement. The largest distance across Texas is about 801 miles, so Robert wanted to find the set of all points such that the distance from the point to Texas is less than or equal

Tags: , ,
Posted in SAS | Comments Off on Offset regions: Find all points within a specified distance from a polygon

## The intersection of two line segments

July 9, 2018
By

Back in high school, you probably learned to find the intersection of two lines in the plane. The intersection requires solving a system of two linear equations. There are three cases: (1) the lines intersect in a unique point, (2) the lines are parallel and do not intersect, or (3)

Tags: , ,
Posted in SAS | Comments Off on The intersection of two line segments

## Visualize a torus in SAS

November 9, 2016
By

This article uses graphical techniques to visualize one of my favorite geometric objects: the surface of a three-dimensional torus. Along the way, this article demonstrates techniques that are useful for visualizing more mundane 3-D point clouds that arise in statistical data analysis. Define points on a torus A torus is

Tags: , , ,
Posted in SAS | Comments Off on Visualize a torus in SAS

## Cantor sets, the devil’s staircase, and probability

July 5, 2016
By

Last week I blogged about how to draw the Cantor function in SAS. The Cantor function is used in mathematics as a pathological example of a function that is constant almost everywhere yet somehow manages to "climb upwards," thus earning the nickname "the devil's staircase." The Cantor function has three

Tags: , ,
Posted in SAS | Comments Off on Cantor sets, the devil’s staircase, and probability

## What is a moving average?

January 25, 2016
By

A moving average (also called a rolling average) is a satistical technique that is used to smooth a time series. Moving averages are used in finance, economics, and quality control. You can overlay a moving average curve on a time series to visualize how each value compares to a rolling

Tags: , , ,
Posted in SAS | Comments Off on What is a moving average?

## Welcome!

SAS-X.com offers news and tutorials about the various SAS® software packages, contributed by bloggers. You are welcome to subscribe to e-mail updates, or add your SAS-blog to the site.