Category Archives: mathematics

Graph the gamma function in C#

The post Calculate the gamma function in C# uses numerical integration to calculate the gamma function. (See my book Essential Algorithms, Second Edition for information on numerical integration.) That method works fairly well for calculating Γ(x) where x ≤ 1. … Continue reading

Posted in algorithms, graphics, mathematics | Tagged , , , , , , , , | Comments Off on Graph the gamma function in C#

Calculate the gamma function in C#

The gamma function, represented by the capital Greek letter gamma Γ, was derived by Daniel Bernoulli for complex numbers with a positive real part. The interesting thing about the gamma function is that &Gamma(n + 1) = n! for integers … Continue reading

Posted in algorithms, mathematics | Tagged , , , , , , , | 3 Comments

Simulate a doubling betting strategy in C#

Casinos love customers who have a betting strategy because those customers always end up losing. As long as the game’s events are independent of each other (for example, one roll of the dice does not depend on the previous rolls), … Continue reading

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

Automatically set camera distance in WPF and C#

This example extends the post Build a geodesic sphere with WPF and C# to let you automatically set the camera distance to make the scene fill the viewport. Making a 3D scene fill the viewport nicely can be tricky. The … Continue reading

Posted in 3D graphics, algorithms, graphics, mathematics, wpf | Tagged , , , , , , , , , , , , , , , , | 6 Comments

Enlarge a polygon that has colinear vertices in C#

The example Enlarge a polygon in C# shows how you can expand a polygon. The basic idea is to offset each of the polygon’s edges away from the polygon’s center and then see where adjacent edges intersect as shown in … Continue reading

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

Pingback: Code Project post “Clipping Plane in WPF 3D”

The Code Project post Clipping Plane in WPF 3D by charles922 references a couple of my WPF 3D posts. His post explains several WPF 3D concepts including; Manger sponges (refers to my post Use a dictionary to draw a 3D … Continue reading

Posted in 3D, 3D graphics, algorithms, books, drawing, graphics, mathematics, wpf, XAML | Tagged , , , , , , , , , , , , , , | 4 Comments

Sprialize an image in C#

This example shows how to spiralize an image. By spiralize I mean shade pieces of the picture with different colors so the colored areas for a spiral as shown in the picture. This could be a difficult problem. Fortunately I’ve … Continue reading

Posted in algorithms, drawing, graphics, image processing, mathematics | Tagged , , , , , , , , , , , | Comments Off on Sprialize an image in C#

Fill a target area found by trilateration in C#

The post Perform trilateration in C# explains how a C# program can use trilateration to find an area where a target point lies. This post explains how you can draw that area. The Target Area The target area found by … Continue reading

Posted in algorithms, geometry, mathematics | Tagged , , , , , , , , | Comments Off on Fill a target area found by trilateration in C#

Perform trilateration in C#

This post explains how a C# program can use trilateration to locate a point that is known distances from three other points. Trilateration is somewhat similar to triangulation, so following two sections begin by explaining what triangulation and trilateration are. … Continue reading

Posted in algorithms, geometry, mathematics | Tagged , , , , , , , , | 7 Comments

Draw many circles that intersect two points in C#

As I mentioned in my earlier post Connect two points with elliptical arcs in C#, an infinite number of circles (or ellipses) can pass through two points. This example draws some of them to produce an interesting pattern. This example … Continue reading

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