Tag Archives: graphing

Animate a point on a polar coordinate curve in C#

The example Graph a curve in polar coordinates in C# explained how to draw the flower-like curve on the right. Once you know how to draw such a curve, it’s not too hard to animate points moving along it. The … Continue reading

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

Graph a curve in polar coordinates in C#

In Cartesian coordinates, a point is specified by X and Y values. In polar coordinates, a point is specified by r and θ where: r is the point’s radial distance from the origin θ is the angle that gives the … Continue reading

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

Graph historical stock prices in C#

The key to this example is the GetStockPrices method shown in the following code. // Get the prices for this symbol. private List GetStockPrices(string symbol) { // Compose the URL. string url = “http://www.google.com/finance/” + “historical?output=csv&q=” + symbol; // Get … Continue reading

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

Graph mosquito populations in C#

The example Simulate mosquito populations in C# simulates a mosquito population. This example draws a graph showing the population during each generation. When it calculates the populations for a new generation, it stores them in the following lists. // Data … Continue reading

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

Make a simple histogram in C#

This example displays a histogram showing the distribution of random values that simulate rolling two 6-sided dice. At design time I gave the program’s form two groups of Label controls across the bottom of the form. The bottommost group displays … Continue reading

Posted in algorithms, controls, graphics, mathematics | Tagged , , , , , , , , , , , , | 4 Comments

Plot a heart-shaped function in C#

This example is similar to Plot a smiley face function in C# except it shows how to plot a heart-shaped function defined by the following equations. [y – Sqrt(2.5 × 2.5 – (x – 2.5) × (x – 2.5))] × … Continue reading

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