
Recent Posts

Recent Comments
Archives
 October 2017
 September 2017
 August 2017
 July 2017
 June 2017
 May 2017
 April 2017
 March 2017
 February 2017
 January 2017
 December 2016
 November 2016
 October 2016
 September 2016
 August 2016
 July 2016
 June 2016
 May 2016
 April 2016
 March 2016
 February 2016
 January 2016
 December 2015
 November 2015
 October 2015
 September 2015
 August 2015
 July 2015
 June 2015
 May 2015
 April 2015
 March 2015
 February 2015
 January 2015
 December 2014
 November 2014
 October 2014
 September 2014
 August 2014
 July 2014
 June 2014
 May 2014
 March 2014
 February 2014
 January 2014
 December 2013
 November 2013
 October 2013
 September 2013
 August 2013
 July 2013
 June 2013
 May 2013
 April 2013
 March 2013
 February 2013
 January 2013
 December 2012
 September 2012
 August 2012
 July 2012
 June 2012
 May 2012
 April 2012
 January 2012
 December 2011
 November 2011
 May 2011
 April 2011
 February 2011
 December 2010
Categories
 .NET
 ADO.NET
 algorithms
 animation
 API
 arrays
 attributes
 audio
 books
 C#
 C# programming
 calculations
 challenges
 classes
 clipboard
 coding
 combinatorics
 console
 controls
 cryptography
 curve fitting
 database
 debugging
 dialogs
 directories
 Drag and Drop
 drawing
 drawings
 enums
 Event
 events
 Excel
 extension methods
 extensions
 files
 finance
 fonts
 formatting
 forms
 fractals
 ftp
 games
 GDI+
 generic
 geometry
 globalization
 graphics
 html
 IDE
 image processing
 inheritance
 interfaces
 internationalization
 internet
 interoperability
 LINQ
 lists
 localization
 mathematics
 memory
 menus
 MessageBox
 methods
 miscellany
 multimedia
 network
 Office
 OOP
 operators
 parsing
 performance
 phone
 PowerPoint
 printers
 printing
 productivity
 programs
 puzzles
 recursion
 reflection
 registry
 regular expressions
 serialization
 settings
 SQL
 stories
 strings
 syntax
 system
 threading
 tips
 tools
 transformations
 Uncategorized
 user interface
 variables
 VBA
 web
 Windows Forms programming
 WMI
 Word
 wpf
 XAML
 XML
Meta
Category Archives: mathematics
Draw a picturefilled histogram in C#
The example Make a simple histogram in C# shows how to draw a histogram. This example shows how to fill the histogram’s bars with pictures. The following TileRectangle method fills a rectangle with an image. // Tile an area from … Continue reading
Linkback to the Secret Santa Problem
Tom left a comment to my post Calculate the number of secret Santa permutations in C#. He used that example to build a site in JavaScript explaining how the algorithm works. It’s a pretty cool little page. Drop by and … Continue reading
Make a dicerolling simulation in C#
This example performs a simulation of rolling two sixsided dice. It’s related to my book Interview Puzzles Dissected, which includes several examples that involve rolling dice. When you enter a number of trials and click Roll, the program uses the … Continue reading
Posted in algorithms, graphics, mathematics
Tagged algorithms, C#, C# programming, dice rolls, die rolls, example, example program, graphics, mathematics, probability, simulation, statistics, Windows Forms programming
Leave a comment
Draw the Weierstrass function in C#
The Weierstrass function was discovered by Karl Weierstrass in 1872. It’s an odd function that is continuous everywhere but differentiable nowhere. I’ll explain what that means shortly. Here’s the function: Here: The following two sections explain what it means to … Continue reading
Posted in algorithms, drawing, fractals, graphics, mathematics
Tagged algorithms, C#, C# programming, continuous function, differentiable function, discontinuous function, drawing, example, example program, fractals, graphics, mathematics, nondifferentiable function, Weierstrass curve, Weierstrass function, Windows Forms programming
Leave a comment
Calculate Fibonacci numbers in several ways in C#
For some background on Fibonacci numbers and φ, see Examine the relationship between the Fibonacci sequence and phi in C#. This example shows several ways to calculate Fibonacci numbers. While this is mostly for curiosity’s sake, this example does demonstrate … Continue reading
Find random prime numbers in C#
The example Probabilistically determine whether a number is prime in C# explains an algorithm for determining whether a number is prime with any desired level of certainty. After you add that method to your algorithmic toolkit, finding large prime numbers … Continue reading
Determine whether a number is prime in C#
This is a cool little algorithm that uses some clever mathematics. This algorithm and several related algorithms are described in my book Essential Algorithms: A Practical Approach to Computer Algorithms. I think it’s a really good book (and it’s gotten … Continue reading
Animate rainbow colors in C#
The example Map numeric values to and from colors in a color gradient in C# draws a color gradient that uses rainbow colors. This example animates that one. When you click on the color gradient, the following code starts or … Continue reading
Animate exploding 3dimensional pie slices in C#
The example Draw 3dimensional pie slices in C# shows how to highlight one or more 3D pie slices by “exploding” them. This example draws even more attention to the exploded pie slices by animating their explosion. The program controls the … Continue reading
Posted in algorithms, animation, graphics, mathematics, multimedia
Tagged 3D pie slice, 3dimensional pie slice, algorithms, animated pie slices, animation, C#, C# programming, DrawPie, example, example program, FillPie, graphics, mathematics, multimedia, pie chart, pie graph, pie slice, threedimensional pie slice, Windows Forms programming
Leave a comment
Calculate where a line segment and an ellipse intersect in C#
Finding the intersection between a line segment and an ellipse requires a lot of mathematics. It’s not particularly hard mathematics, but if you’d rather skip it, you can use the following links to jump to the other parts of this … Continue reading
Posted in algorithms, drawing, geometry, graphics, mathematics
Tagged algorithms, C#, C# programming, drawing, ellipse, ellipse line intersection, ellipse/line intersection, example, example program, geometry, graphics, intersection, line, line ellipse intersection, line segment, line/ellipse intersection, mathematics, Windows Forms programming
5 Comments