Tag Archives: mathematics

Understand probabilities of unrelated events (and escaping zombies)

Given some event with a relatively low probability, what is the probability that the event will occur if you perform many trials? For example, suppose the zombie apocalypse has arrived and there’s a 1% chance that the zombies will get … Continue reading

Posted in mathematics | Tagged , , , , , , , , , | Leave a comment

Use the yield statement in C#

An enumeration is a sequence of values that a program can enumerate over, for example, by using a foreach loop. In C# you can use the yield statement to make a method that returns an enumeration. The method that builds … Continue reading

Posted in algorithms, mathematics | Tagged , , , , , , , , , , , , | Leave a comment

Make a sunburst chart in C#, Part 4

The previous post showed how to make a sunburst chart with curved text. This example extends that one so it can draw multi-line text. The previous post used the DrawTextOnArc method to draw curved text. The text is a distance … Continue reading

Posted in drawing, graphics, mathematics | Tagged , , , , , , , , , , , , , , , , , , , , | Leave a comment

Make a sunburst chart in C#, Part 3

The post Make a sunburst chart in C#, Part 1 shows how to build a basic sunburst chart. The post Make a sunburst chart in C#, Part 2 enhances that example by drawing each node’s text at an angle so … Continue reading

Posted in drawing, graphics, mathematics | Tagged , , , , , , , , , , , , , , , , , , , | 1 Comment

Make a sunburst chart in C#, Part 2

The post Make a sunburst chart in C#, Part 1 explained how to build a simple sunburst chart. Unfortunately the node labels used by that chart didn’t fit their wedges very well because the text was all drawn horizontally. This … Continue reading

Posted in drawing, graphics, mathematics | Tagged , , , , , , , , , , , , , , , | 2 Comments

Make a sunburst chart in C#, Part 1

A sunburst chart displays hierarchical data in a circular diagram. The hierarchy’s root is drawn in the center. Its children sit in a ring around the root. After that, each node’s wedge in a ring is divided among its children … Continue reading

Posted in drawing, graphics, mathematics | Tagged , , , , , , , , , , , , , | 3 Comments

Use digits of Pi to draw a picture in C#

The article 10 stunning images show the beauty hidden in pi shows several ways to use Pi to generate pictures. This example demonstrates one of them. The program starts drawing at the origin (0, 0). It then scans through the … Continue reading

Posted in algorithms, drawing, graphics, mathematics, strings | Tagged , , , , , , , , , , , , , , , , , | Leave a comment

Look for dates in the digits of Pi in C#

The example Find patterns within pi in C# looks for patterns within the digits of Pi. You can use that example to look for dates such as 4/1. This example determines whether the first 100 thousand digits of Pi contains … Continue reading

Posted in algorithms, mathematics, strings | Tagged , , , , , , , , , , , , | Leave a comment

Find patterns within Pi in C#

March 14 is known as Pi Day because its numeric representation 3/14 includes the first three digits of Pi: 3.14. (At least in the United States. In Europe where they usually write dates month first, Pi Day is July 22 … Continue reading

Posted in algorithms, mathematics, strings | Tagged , , , , , , , , , , , , , | 1 Comment

Use an improved extension method to calculate standard deviation in C#

The example Calculate standard deviation in C# makes an extension method that calculates standard deviation for an IEnumerable of integers. Unfortunately because that example works with integers, it cannot work with other data types. Rian Meier showed me this method, … Continue reading

Posted in algorithms, extension methods, mathematics | Tagged , , , , , , , , , , | Leave a comment