<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>Visualization Archives - CenterSpace</title>
	<atom:link href="https://www.centerspace.net/category/visualization/feed" rel="self" type="application/rss+xml" />
	<link>https://www.centerspace.net/category/visualization</link>
	<description>.NET numerical class libraries</description>
	<lastBuildDate>Tue, 07 Feb 2023 21:47:10 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.1</generator>
<site xmlns="com-wordpress:feed-additions:1">104092929</site>	<item>
		<title>CenterSpace partner releases symbolic, computational library</title>
		<link>https://www.centerspace.net/centerspace-partner-releases-symbolic-computational-library</link>
					<comments>https://www.centerspace.net/centerspace-partner-releases-symbolic-computational-library#respond</comments>
		
		<dc:creator><![CDATA[Trevor Misfeldt]]></dc:creator>
		<pubDate>Sun, 23 Oct 2016 23:09:20 +0000</pubDate>
				<category><![CDATA[Visualization]]></category>
		<category><![CDATA[partner]]></category>
		<category><![CDATA[symbolic]]></category>
		<guid isPermaLink="false">http://www.centerspace.net/?p=7060</guid>

					<description><![CDATA[<p>Our partner, Scientific Research Software, has released a new product on top of the NMath libraries. NMath ANALYTICS allows users to use symbolic expressions for functions and then visualize resulting fits. Please check them out. &#8211; Trevor</p>
<p>The post <a rel="nofollow" href="https://www.centerspace.net/centerspace-partner-releases-symbolic-computational-library">CenterSpace partner releases symbolic, computational library</a> appeared first on <a rel="nofollow" href="https://www.centerspace.net">CenterSpace</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Our partner, Scientific Research Software, has released a new product on top of the NMath libraries. <a href="http://sergey-l-gladkiy.narod.ru/index/nmath-analytics/0-21" target="_blank">NMath ANALYTICS</a> allows users to use symbolic expressions for functions and then visualize resulting fits. </p>
<p><img decoding="async" loading="lazy" src="https://www.centerspace.net/wp-content/uploads/2016/10/DataFitting-300x225.png" alt="Data Fitting Example" width="600" height="450" class="aligncenter size-medium wp-image-7061" srcset="https://www.centerspace.net/wp-content/uploads/2016/10/DataFitting-300x225.png 300w, https://www.centerspace.net/wp-content/uploads/2016/10/DataFitting-768x576.png 768w, https://www.centerspace.net/wp-content/uploads/2016/10/DataFitting-135x100.png 135w, https://www.centerspace.net/wp-content/uploads/2016/10/DataFitting.png 1000w" sizes="(max-width: 600px) 100vw, 600px" /></p>
<p>Please check them out.</p>
<p>&#8211; Trevor</p>
<p>The post <a rel="nofollow" href="https://www.centerspace.net/centerspace-partner-releases-symbolic-computational-library">CenterSpace partner releases symbolic, computational library</a> appeared first on <a rel="nofollow" href="https://www.centerspace.net">CenterSpace</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.centerspace.net/centerspace-partner-releases-symbolic-computational-library/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">7060</post-id>	</item>
		<item>
		<title>NMath Charts in WPF</title>
		<link>https://www.centerspace.net/nmath-charts-in-wpf</link>
					<comments>https://www.centerspace.net/nmath-charts-in-wpf#comments</comments>
		
		<dc:creator><![CDATA[Trevor Misfeldt]]></dc:creator>
		<pubDate>Wed, 06 Mar 2013 01:23:53 +0000</pubDate>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[NMath]]></category>
		<category><![CDATA[Visualization]]></category>
		<guid isPermaLink="false">http://www.centerspace.net/blog/uncategorized/nmath-charts-in-wpf/</guid>

					<description><![CDATA[<p>The NMathChart adapter class makes it easy to generate visualizations of NMath data in as little as one line of code.  The Chart class that is created is a Windows Forms control, but this control can be included in a Windows Presentation Foundation application by using the WindowsFormsHost element. To do so: Add references to [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.centerspace.net/nmath-charts-in-wpf">NMath Charts in WPF</a> appeared first on <a rel="nofollow" href="https://www.centerspace.net">CenterSpace</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>The NMathChart adapter class makes it easy to <a href="https://www.centerspace.net/nmath-charts-in-wpf/" target="_blank" rel="noopener">generate visualizations of NMath data</a> in as little as one line of code.  The <a href="https://msdn.microsoft.com/en-us/library/system.windows.forms.datavisualization.charting.chart.aspx" target="_blank" rel="noopener">Chart</a> class that is created is a Windows Forms control, but this control can be included in a Windows Presentation Foundation application by using the <a href="https://msdn.microsoft.com/en-us/library/system.windows.forms.integration.windowsformshost.aspx" target="_blank" rel="noopener">WindowsFormsHost</a> element.</p>
<p>To do so:</p>
<ol>
<li><span style="color: #333333;">Add references to these namespaces: </span><span style="font-family: Consolas;">System.Windows.Forms<br />
System.Windows.Forms.Integration<br />
</span></li>
<li>In the XAML markup for your WPF window (<span style="font-family: Consolas;">MainWindow.xaml</span> for example), add a <a href="https://msdn.microsoft.com/en-us/library/system.windows.forms.integration.windowsformshost.aspx" target="_blank" rel="noopener">WindowsFormsHost</a> element at the desired location, e.g:<span style="font-family: Consolas;">&lt;Grid&gt;<br />
&lt;WindowsFormsHost Name=&#8221;ChartHost&#8221;/&gt;<br />
&lt;/Grid&gt;<br />
</span></li>
<li>In the code-behind for the window (<span style="font-family: Consolas;">MainWindow.xaml.cs</span> for example), set the <span style="font-family: Consolas;">Child</span> property of the <a href="https://msdn.microsoft.com/en-us/library/system.windows.forms.integration.windowsformshost.aspx" target="_blank" rel="noopener">WindowsFormsHost</a> to a <a href="https://msdn.microsoft.com/en-us/library/system.windows.forms.datavisualization.charting.chart.aspx" target="_blank" rel="noopener">Chart</a>. For example:<span style="font-family: Consolas;">public MainWindow()<br />
{<br />
InitializeComponent();<br />
ChartHost.Child = NMathChart.ToChart(NMathFunctions.CosFunction,<br />
-Math.PI, Math.PI, 100 );<br />
}</span></li>
</ol>
<p>To see this in action, check out the sample code in the new Visualization Examples solution included in <a href="/nmath-5-3-nmath-stats-3-6-are-coming/" target="_blank" rel="noopener">NMath 5.3</a>. For more information about visualization of NMath data types, see:</p>
<ul>
<li>Whitepaper: <a href="https://www.centerspace.net/doc/NMath/whitepapers/NMath.ChartMicrosoft.pdf">NMath Visualization Using the Microsoft Chart Controls</a></li>
<li>Whitepaper: NMath Stats Visualization Using the Microsoft Chart Controls</li>
<li>the <a href="https://www.centerspace.net/doc/NMath/ref/">API docs</a> for the <code>CenterSpace.NMath.Charting.Microsoft </code>namespace</li>
</ul>
<p>The post <a rel="nofollow" href="https://www.centerspace.net/nmath-charts-in-wpf">NMath Charts in WPF</a> appeared first on <a rel="nofollow" href="https://www.centerspace.net">CenterSpace</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.centerspace.net/nmath-charts-in-wpf/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4292</post-id>	</item>
		<item>
		<title>Distribution Fitting Demo</title>
		<link>https://www.centerspace.net/distribution-fitting-demo</link>
					<comments>https://www.centerspace.net/distribution-fitting-demo#respond</comments>
		
		<dc:creator><![CDATA[Ken Baldwin]]></dc:creator>
		<pubDate>Mon, 09 Apr 2012 14:49:02 +0000</pubDate>
				<category><![CDATA[NMath Tutorial]]></category>
		<category><![CDATA[Visualization]]></category>
		<category><![CDATA[CDF]]></category>
		<category><![CDATA[CDF C#]]></category>
		<category><![CDATA[gaussian distribution]]></category>
		<category><![CDATA[nonlinear least squares]]></category>
		<category><![CDATA[normal distribution]]></category>
		<category><![CDATA[PDF]]></category>
		<category><![CDATA[PDF C#]]></category>
		<category><![CDATA[probability distribution]]></category>
		<category><![CDATA[Trust Region minimization]]></category>
		<guid isPermaLink="false">http://www.centerspace.net/blog/?p=3719</guid>

					<description><![CDATA[<p><img class="excerpt" title="Distribution Fit" src="https://www.centerspace.net/blog/wp-content/uploads/2012/04/distribution_fit_pdf.png" alt="Distribution Fit" /><br />
A customer recently asked how to fit a normal (Gaussian) distribution to a vector of experimental data. Here's a demonstration of how to do it.</p>
<p>The post <a rel="nofollow" href="https://www.centerspace.net/distribution-fitting-demo">Distribution Fitting Demo</a> appeared first on <a rel="nofollow" href="https://www.centerspace.net">CenterSpace</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>A customer recently asked how to fit a normal (Gaussian) distribution to a vector of experimental data. Here&#8217;s a demonstration of how to do it.</p>
<p>Let&#8217;s start by creating a data set: 100 values drawn from a normal distribution with known parameters (mean = 0.5, variance = 2.0).</p>
<pre lang="csharp">int n = 100;
double mean = .5;
double variance = 2.0;
var data = new DoubleVector( n, new RandGenNormal( mean, variance ) );</pre>
<p>Now, compute y values based on the empirical cumulative distribution function (CDF), which returns the probability that a random variable X will have a value less than or equal to x&#8211;that is, f(x) = P(X &lt;= x). Here&#8217;s an easy way to do, although not necessarily the most efficient for larger data sets:</p>
<pre lang="csharp">var cdfY = new DoubleVector( data.Length );
var sorted = NMathFunctions.Sort( data );
for ( int i = 0; i &lt; data.Length; i++ )
{
  int j = 0;
  while ( j &lt; sorted.Length &amp;&amp; sorted[j] &lt;= data[i] ) j++;
  cdfY[i] = j / (double)data.Length;
}</pre>
<p>The data is sorted, then for each value x in the data, we iterate through the sorted vector looking for the first value that is greater than x.</p>
<p>We&#8217;ll use one of NMath&#8217;s non-linear least squares minimization routines to fit a normal distribution CDF() function to our empirical CDF. NMath provides classes for fitting generalized one variable functions to a set of points. In the space of the function parameters, beginning at a specified starting point, these classes finds a minimum (possibly local) in the sum of the squared residuals with respect to a set of data points.</p>
<p>A one variable function takes a single double x, and returns a double y:</p>
<pre class="code">y = f(x)</pre>
<p>A <em>generalized</em> one variable function additionally takes a set of parameters, p, which may appear in the function expression in arbitrary ways:</p>
<pre class="code">y = f(p1, p2,..., pn; x)</pre>
<p>For example, this code computes y=a*sin(b*x + c):</p>
<pre lang="csharp">public double MyGeneralizedFunction( DoubleVector p, double x )
{
  return p[0] * Math.Sin( p[1] * x + p[2] );
}</pre>
<p>In the distribution fitting example, we want to define a parameterized function delegate that returns CDF(x) for the distribution described by the given parameters (mean, variance):</p>
<pre lang="csharp">Func<doublevector, double,="" double=""> f =
  ( DoubleVector p, double x ) =&gt;
    new NormalDistribution( p[0], p[1] ).CDF( x );</doublevector,></pre>
<p>Now that we have our data and the function we want to fit, we can apply the curve fitting routine. We&#8217;ll use a bounded function fitter, because the variance of the fitted normal distribution must be constrained to be greater than 0.</p>
<pre lang="csharp">var fitter = new BoundedOneVariableFunctionFitter<trustregionminimizer>( f );
var start = new DoubleVector( new double[] { 0.1, 0.1 } );
var lowerBounds = new DoubleVector( new double[] { Double.MinValue, 0 } );
var upperBounds = 
   new DoubleVector( new double[] { Double.MaxValue, Double.MaxValue } );
var solution = fitter.Fit( data, cdfY, start, lowerBounds, upperBounds );
var fit = new NormalDistribution( solution[0], solution[1] );

Console.WriteLine( "Fitted distribution:\nmean={0}\nvariance={1}",
  fit.Mean, fit.Variance );</trustregionminimizer></pre>
<p>The output for one run is</p>
<pre class="code">Fitted distribution: 
mean=0.567334190790594
variance=2.0361207956132</pre>
<p>which is a reasonable approximation to the original distribution (given 100 points).</p>
<p>We can also visually inspect the fit by plotting the original data and the CDF() function of the fitted distribution.</p>
<pre lang="csharp">ToChart( data, cdfY, SeriesChartType.Point, fit,
  NMathStatsChart.DistributionFunction.CDF );

private static void ToChart( DoubleVector x, DoubleVector y,
  SeriesChartType dataChartType, NormalDistribution dist,
  NMathStatsChart.DistributionFunction distFunction )
{
  var chart = NMathStatsChart.ToChart( dist, distFunction );
  chart.Series[0].Name = "Fit";

  var series = new Series() {
    Name = "Data",
    ChartType = dataChartType
  };
  series.Points.DataBindXY( x, y );
  chart.Series.Insert( 0, series );

  chart.Legends.Add( new Legend() );
  NMathChart.Show( chart );
}</pre>
<p><a href="https://www.centerspace.net/blog/wp-content/uploads/2012/04/distribution_fit_cdf.png"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-3727" title="distribution_fit_cdf" src="https://www.centerspace.net/blog/wp-content/uploads/2012/04/distribution_fit_cdf.png" alt="CDF() of fitted distribution" width="482" height="488" srcset="https://www.centerspace.net/wp-content/uploads/2012/04/distribution_fit_cdf.png 482w, https://www.centerspace.net/wp-content/uploads/2012/04/distribution_fit_cdf-296x300.png 296w" sizes="(max-width: 482px) 100vw, 482px" /></a></p>
<p>We can also look at the probability density function (PDF) of the fitted distribution, but to do so we must first construct an empirical PDF using a histogram. The x-values are the midpoints of the histogram bins, and the y-values are the histogram counts converted to probabilities, scaled to integrate to 1.</p>
<pre lang="csharp">int numBins = 10;
var hist = new Histogram( numBins, data );

var pdfX = new DoubleVector( hist.NumBins );
var pdfY = new DoubleVector( hist.NumBins );
for ( int i = 0; i &lt; hist.NumBins; i++ )
{
  // use bin midpoint for x value
  Interval bin = hist.Bins[i];
  pdfX[i] = ( bin.Min + bin.Max ) / 2;

   // convert histogram count to probability for y value
   double binWidth = bin.Max - bin.Min;
   pdfY[i] = hist.Count( i ) / ( data.Length * binWidth );
}

ToChart( pdfX, pdfY, SeriesChartType.Column, fit,
  NMathStatsChart.DistributionFunction.PDF );</pre>
<p><a href="https://www.centerspace.net/blog/wp-content/uploads/2012/04/distribution_fit_pdf.png"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-3728" title="distribution_fit_pdf" src="https://www.centerspace.net/blog/wp-content/uploads/2012/04/distribution_fit_pdf.png" alt="PDF() of fitted distribution" width="485" height="484" srcset="https://www.centerspace.net/wp-content/uploads/2012/04/distribution_fit_pdf.png 485w, https://www.centerspace.net/wp-content/uploads/2012/04/distribution_fit_pdf-150x150.png 150w, https://www.centerspace.net/wp-content/uploads/2012/04/distribution_fit_pdf-300x300.png 300w" sizes="(max-width: 485px) 100vw, 485px" /></a></p>
<p>You might be tempted to try to fit a distribution PDF() function directly to the histogram data, rather than using the CDF() function like we did above, but this is problematic for several reasons. The bin counts have different variability than the original data. They also have a fixed sum, so they are not independent measurements. Also, for continuous data, fitting a model based on aggregated histogram counts, rather than the original data, throws away information.</p>
<p>Ken</p>
<p>Download the <a href="https://drive.google.com/open?id=1KlctDEKniD8SdmQiBGmcrJWMuhvU-WYP">source code</a></p>
<p>The post <a rel="nofollow" href="https://www.centerspace.net/distribution-fitting-demo">Distribution Fitting Demo</a> appeared first on <a rel="nofollow" href="https://www.centerspace.net">CenterSpace</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.centerspace.net/distribution-fitting-demo/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3719</post-id>	</item>
		<item>
		<title>The Importance of Graphing Your Data</title>
		<link>https://www.centerspace.net/the-importance-of-graphing-your-data</link>
					<comments>https://www.centerspace.net/the-importance-of-graphing-your-data#respond</comments>
		
		<dc:creator><![CDATA[Ken Baldwin]]></dc:creator>
		<pubDate>Tue, 13 Dec 2011 17:28:10 +0000</pubDate>
				<category><![CDATA[NMath]]></category>
		<category><![CDATA[NMath Stats]]></category>
		<category><![CDATA[Visualization]]></category>
		<category><![CDATA[.NET charting]]></category>
		<category><![CDATA[.NET plotting]]></category>
		<category><![CDATA[C# charts]]></category>
		<category><![CDATA[C# ploting]]></category>
		<category><![CDATA[Chart Controls for .NET]]></category>
		<category><![CDATA[F# charts]]></category>
		<category><![CDATA[VB.NET charts]]></category>
		<category><![CDATA[VB.NET plotting]]></category>
		<guid isPermaLink="false">http://www.centerspace.net/blog/?p=3639</guid>

					<description><![CDATA[<p><img class="excerpt" title="Anscombe's Quartet" src="https://www.centerspace.net/blog/wp-content/uploads/2011/12/anscombe2.png" alt="Anscombe's Quartet" /><br />
In his classic book <em>The Visual Display of Quantitative Information</em>, Edward R. Tufte argued that "graphics can be more precise and revealing than conventional statistical computations".  As an example, he described <a href="http://en.wikipedia.org/wiki/Anscombe%27s_quartet">Anscombe's Quartet</a>--four datasets that have identical simple statistical properties, yet appear very different when graphed.</p>
<p>The post <a rel="nofollow" href="https://www.centerspace.net/the-importance-of-graphing-your-data">The Importance of Graphing Your Data</a> appeared first on <a rel="nofollow" href="https://www.centerspace.net">CenterSpace</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In his classic book <em>The Visual Display of Quantitative Information</em>, Edward R. Tufte argued that &#8220;graphics can be more precise and revealing than conventional statistical computations&#8221;. As an example, he described <a href="https://en.wikipedia.org/wiki/Anscombe%27s_quartet">Anscombe&#8217;s Quartet</a>&#8211;four datasets that have identical simple statistical properties, yet appear very different when graphed.<br />
<a href="https://www.centerspace.net/blog/wp-content/uploads/2011/12/anscombe2.png"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-3655" title="Anscombe's Quartet" src="https://www.centerspace.net/blog/wp-content/uploads/2011/12/anscombe2.png" alt="Anscombe's Quartet" width="451" height="283" srcset="https://www.centerspace.net/wp-content/uploads/2011/12/anscombe2.png 451w, https://www.centerspace.net/wp-content/uploads/2011/12/anscombe2-300x188.png 300w" sizes="(max-width: 451px) 100vw, 451px" /></a><br />
These data sets&#8211;each consisting of 11 x,y points&#8211;were constructed by statistician Francis Anscombe in 1973.</p>
<p>As <a href="https://www.centerspace.net/nmath-charts-in-wpf/">previously described</a>, <strong>NMath 5.1</strong> and <strong>NMath Stats 3.4</strong> include classes for plotting NMath types using the Microsoft Chart Controls for .NET. (<a href="/nmath-integration-with-essential-chart/">Free adapter code</a> is also available for using NMath with Syncfusion Essential Chart.) Let&#8217;s use Anscombe&#8217;s data to explore how NMath&#8217;s new visualization capabilities can be used to reveal the differences in the data sets.</p>
<p>First, we&#8217;ll load the data into a <strong>DoubleMatrix</strong>.</p>
<pre lang="csharp">DoubleMatrix A = new DoubleMatrix( @"11x8 [
  10.0 8.04  10.0 9.14 10.0 7.46  8.0  6.58
  8.0  6.95  8.0  8.14 8.0  6.77  8.0  5.76
  13.0 7.58  13.0 8.74 13.0 12.74 8.0  7.71
  9.0  8.81  9.0  8.77 9.0  7.11  8.0  8.84
  11.0 8.33  11.0 9.26 11.0 7.81  8.0  8.47
  14.0 9.96  14.0 8.10 14.0 8.84  8.0  7.04
  6.0  7.24  6.0  6.13 6.0  6.08  8.0  5.25
  4.0  4.26  4.0  3.10 4.0  5.39  19.0 12.50
  12.0 10.84 12.0 9.13 12.0 8.15  8.0  5.56
  7.0  4.82  7.0  7.26 7.0  6.42  8.0  7.91
  5.0  5.68  5.0  4.74 5.0  5.73  8.0  6.89 ]" );</pre>
<p>Now let&#8217;s perform some simple descriptive statistics.</p>
<pre lang="csharp"> int groups = 4;
 Slice rows = Slice.All;
 Slice xCols = new Slice( 0, groups, 2 );
 Slice yCols = new Slice( 1, groups, 2 );
 double unbiased = (double)A.Rows / ( A.Rows - 1 );

 Console.WriteLine( "Mean of x: {0}",
   NMathFunctions.Mean( A[ rows, xCols ] ) );
 Console.WriteLine( "Variance of x: {0}",
   NMathFunctions.Variance( A[rows, xCols] ) * unbiased );
 Console.WriteLine( "Mean of y: {0}",
   NMathFunctions.Round( NMathFunctions.Mean( A[rows, yCols] ), 2 ) );
 Console.WriteLine( "Variance of y: {0}",
   NMathFunctions.Round(
     NMathFunctions.Variance( A[rows, yCols] ) * unbiased, 3 ) );

 Console.Write( "Correlation of x-y: " );
 for (int i = 0; i < A.Cols; i += 2 )
 {
   Console.Write( NMathFunctions.Round(
    StatsFunctions.Correlation( A.Col(i), A.Col(i + 1) ), 3 ) + " " );
 }
 Console.WriteLine();</pre>
<p>You can see from the output that the statistics are nearly identical for all four data sets:</p>
<pre class="code">Mean of x: [ 9 9 9 9 ]
Variance of x: [ 11 11 11 11 ]
Mean of y: [ 7.5 7.5 7.5 7.5 ]
Variance of y: [ 4.127 4.128 4.123 4.123 ]
Correlation of x-y: 0.816 0.816 0.816 0.817</pre>
<p>Now let's fit a linear model to each data set.</p>
<pre lang="csharp"> LinearRegression[] lrs = new LinearRegression[groups];

 for( int i = 0; i < groups; i ++ )
 {
   Console.WriteLine( "Group {0}", i + 1 );

   bool addIntercept = true;
   lrs[i] = new LinearRegression( new DoubleMatrix( A.Col( 2 * i ) ),
     A.Col( 2 * i + 1 ), addIntercept );
   Console.WriteLine( "equation of regression line: Y = {0} + {1}X",
     Math.Round( lrs[i].Parameters[0], 2 ),
     Math.Round( lrs[i].Parameters[1], 3 ) );

   LinearRegressionParameter param =
     new LinearRegressionParameter( lrs[i], 1 );
   Console.WriteLine( "standard error of estimate of slope: {0}",
     Math.Round( param.StandardError, 3 ) );
   Console.WriteLine( "t-statistic: {0}",
     Math.Round( param.TStatistic( 0 ), 2 ) );

   LinearRegressionAnova anova = new LinearRegressionAnova( lrs[i] );
   Console.WriteLine( "regression sum of squares: {0}",
     Math.Round( anova.RegressionSumOfSquares, 2 ) );
   Console.WriteLine( "residual Sum of squares: {0}",
     Math.Round( anova.ResidualSumOfSquares, 2 ) );
   Console.WriteLine( "r2: {0}", Math.Round( anova.RSquared, 2 ) );

   Console.WriteLine();
 }</pre>
<p>Again, the output is nearly identical for each data set:</p>
<pre class="code">Group 1
equation of regression line: Y = 3 + 0.5X
standard error of estimate of slope: 0.118
t-statistic: 4.24
regression sum of squares: 27.51
residual Sum of squares: 13.76
r2: 0.67

Group 2
equation of regression line: Y = 3 + 0.5X
standard error of estimate of slope: 0.118
t-statistic: 4.24
regression sum of squares: 27.5
residual Sum of squares: 13.78
r2: 0.67

Group 3
equation of regression line: Y = 3 + 0.5X
standard error of estimate of slope: 0.118
t-statistic: 4.24
regression sum of squares: 27.47
residual Sum of squares: 13.76
r2: 0.67

Group 4
equation of regression line: Y = 3 + 0.5X
standard error of estimate of slope: 0.118
t-statistic: 4.24
regression sum of squares: 27.49
residual Sum of squares: 13.74
r2: 0.67</pre>
<p>Finally, let's use the new <strong>NMath</strong> charting functionality to plot each linear regression fit. Note that we make use of the <code>Compose()</code> method to combine multiple charts into a single composite <strong>Chart</strong> control.</p>
<pre lang="csharp"> List<Chart> charts = new List<Chart>();
 for( int i = 0; i < lrs.Length; i++ )
 {
   charts.Add( NMathStatsChart.ToChart( lrs[i], 0 ) );
 }
 Chart all = NMathStatsChart.Compose( charts, 2, 2,
   NMathChart.AreaLayoutOrder.RowMajor );
 for( int i = 0; i < groups; i++ )
 {
   all.ChartAreas[i].AxisX.Title = "x" + ( i + 1 );
   all.ChartAreas[i].AxisX.Minimum = 2;
   all.ChartAreas[i].AxisX.Maximum = 22;
   all.ChartAreas[i].AxisX.Interval = 4;

   all.ChartAreas[i].AxisY.Title = "y" + ( i + 1 );
   all.ChartAreas[i].AxisY.Minimum = 2;
   all.ChartAreas[i].AxisY.Maximum = 14;
   all.ChartAreas[i].AxisY.Interval = 4;

   all.Series[2 * i].Color = Color.DarkOrange;
   all.Series[2 * i + 1].Color = Color.SteelBlue;
 }
 NMathStatsChart.Show( all );</pre>
<p><a href="https://www.centerspace.net/blog/wp-content/uploads/2011/12/anscombe.png"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-3640" title="Anscombe's Quartet" src="https://www.centerspace.net/blog/wp-content/uploads/2011/12/anscombe.png" alt="Anscombe's Quartet" width="497" height="499" srcset="https://www.centerspace.net/wp-content/uploads/2011/12/anscombe.png 497w, https://www.centerspace.net/wp-content/uploads/2011/12/anscombe-150x150.png 150w, https://www.centerspace.net/wp-content/uploads/2011/12/anscombe-298x300.png 298w" sizes="(max-width: 497px) 100vw, 497px" /></a>The charts reveal  dramatic differences between the data sets, despite the identical fitted models. Group 1 shows a linear relationship, while in Group 2 the releationship is clearly non-linear.  Groups 3 and 4 demonstrate how a single outlier can have a large effect on simple statistics.</p>
<p>Ken</p>
<p><strong>References</strong></p>
<p>Anscombe, F. J. (1973). "Graphs in Statistical Analysis". American Statistician 27 (1): 17–21. JSTOR 2682899.<br />
Tufte, Edward R. (2001). The Visual Display of Quantitative Information (2nd ed.). Cheshire, CT: Graphics Press</p>
<p>The post <a rel="nofollow" href="https://www.centerspace.net/the-importance-of-graphing-your-data">The Importance of Graphing Your Data</a> appeared first on <a rel="nofollow" href="https://www.centerspace.net">CenterSpace</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.centerspace.net/the-importance-of-graphing-your-data/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3639</post-id>	</item>
		<item>
		<title>NMath integration with Essential Chart</title>
		<link>https://www.centerspace.net/nmath-integration-with-essential-chart</link>
					<comments>https://www.centerspace.net/nmath-integration-with-essential-chart#respond</comments>
		
		<dc:creator><![CDATA[Trevor Misfeldt]]></dc:creator>
		<pubDate>Thu, 08 Dec 2011 18:33:49 +0000</pubDate>
				<category><![CDATA[Syncfusion]]></category>
		<category><![CDATA[Visualization]]></category>
		<category><![CDATA[nmath charts]]></category>
		<category><![CDATA[syncfusion integration]]></category>
		<guid isPermaLink="false">http://www.centerspace.net/blog/visualization/nmath-integration-with-essential-chart/</guid>

					<description><![CDATA[<p>When building numerical applications, you&#8217;ll inevitably be faced with the challenge of taking raw data and computed results and presenting information in a way that makes business sense to the end user. NMath 5.1 added some new visualization features to help. We&#8217;ve also worked closely with the team at Syncfusion to make it very easy [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.centerspace.net/nmath-integration-with-essential-chart">NMath integration with Essential Chart</a> appeared first on <a rel="nofollow" href="https://www.centerspace.net">CenterSpace</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>When building numerical applications, you&#8217;ll inevitably be faced with the challenge of taking raw data and computed results and presenting information in a way that makes business sense to the end user. <a href="/new-versions-of-nmath-libraries-released-3/" target="_blank">NMath 5.1 added some new visualization features</a> to help. We&#8217;ve also worked closely with the team at <a href="http://www.syncfusion.com" target="_blank">Syncfusion</a> to make it very easy to create visualizations of NMath data with their powerful <a href="http://www.syncfusion.com/products/windows-forms/chart" target="_blank">Essential Chart</a> component.</p>
<p>We&#8217;ve released some <a href="https://www.syncfusion.com/resources/techportal/whitepapers/nmath" target="_blank">free adapter code</a> that will allow you to create an Essential Chart control from NMath data structures with as little as one line of code. We&#8217;ve also written some technical documentation that walk you through many common graphing scenarios using the Syncfusion components. These papers detail how to:</p>
<ul>
<li>Download and reference the CenterSpace.NMath.Charting.Syncfusion.NMathChart and CenterSpace.NMath.Charting.Syncfusion.NMathStatsChart adapters.</li>
<li>Create and configure Essential Chart controls, and bind charts to NMath data structures.</li>
<li>Use the NMathChart and NMathStatsChart adapters to create and customize Essential Chart ChartControl instances easily.</li>
<li>Plot vectors, matrices, functions, fitted functions, function peaks, least squares classes, and histograms using a variety of chart types.</li>
<li>Plot NMath Stats data structures such as data frames, probability distributions, linear regressions, goodness of fit, principal component analysis, and cluster analyses.</li>
</ul>
<p><a href="https://www.syncfusion.com/resources/techportal/whitepapers/nmath" target="_blank">Click here</a> to download the free adapter code and detailed instructions. Questions or comments?</p>
<p>The post <a rel="nofollow" href="https://www.centerspace.net/nmath-integration-with-essential-chart">NMath integration with Essential Chart</a> appeared first on <a rel="nofollow" href="https://www.centerspace.net">CenterSpace</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.centerspace.net/nmath-integration-with-essential-chart/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3638</post-id>	</item>
		<item>
		<title>.NET Math with Microsoft Chart Controls, Revisited</title>
		<link>https://www.centerspace.net/math-charts</link>
					<comments>https://www.centerspace.net/math-charts#comments</comments>
		
		<dc:creator><![CDATA[Ken Baldwin]]></dc:creator>
		<pubDate>Wed, 05 Oct 2011 18:28:35 +0000</pubDate>
				<category><![CDATA[NMath]]></category>
		<category><![CDATA[NMath Stats]]></category>
		<category><![CDATA[Visualization]]></category>
		<category><![CDATA[.NET plotting]]></category>
		<category><![CDATA[C# ploting]]></category>
		<category><![CDATA[Chart Controls for .NET]]></category>
		<category><![CDATA[VB.NET charts]]></category>
		<category><![CDATA[VB.NET plotting]]></category>
		<guid isPermaLink="false">http://www.centerspace.net/blog/?p=3538</guid>

					<description><![CDATA[<p><img class="excerpt" title="Linear Regression Chart" src="https://www.centerspace.net/blog/wp-content/uploads/2011/09/lr.png" alt="Linear Regression Chart" /><br />
With the most recent releases of NMath 5.1 and NMath Stats 3.4, creating charts from our class types is easy with new adapter classes.  These classes use the .NET Microsoft Chart Controls for visualization, and allow for complex customization or simple data visualization with one line of code.  </p>
<p>The post <a rel="nofollow" href="https://www.centerspace.net/math-charts">.NET Math with Microsoft Chart Controls, Revisited</a> appeared first on <a rel="nofollow" href="https://www.centerspace.net">CenterSpace</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h3>Easy Math Charting</h3>
<p>In <a href="/using-nmath-with-microsoft-chart-controls-for-net/">an earlier post</a>, we described how NMath types can be plotted using the Microsoft Chart Controls for .NET, but programmatically constructing <strong>Chart</strong> objects with data series bound to NMath objects. The <a href="/new-versions-of-nmath-libraries-released-3/">latest release</a> of the NMath libraries makes this process much simpler by providing <em>adapter classes</em> which easily construct basic math charts for you from NMath types:</p>
<ul>
<li>NMath 5.1 includes assembly <strong>NMathChartMicrosoft.dll</strong> containing class <strong>NMathChart</strong>, which provides convenience methods for plotting NMath types using the Microsoft Chart Controls</li>
<li>NMath Stats 3.4 includes assembly <strong>NMathStatsChartMicrosoft.dll</strong> containing <strong>NMathStatsChart</strong> which provides convenience methods for plotting NMath Stats types using the Microsoft Chart Controls</li>
</ul>
<p>The generated charts can then be customized to meet your needs.</p>
<h3>Using the Math Chart Adapters</h3>
<p>The Microsoft Chart Controls for .NET are available as a <a href="https://www.microsoft.com/en-us/download/details.aspx?id=14422">separate download for .NET 3.5</a>. Beginning in .NET 4.0, the Chart controls are part of the .NET Framework. To use the Chart controls, add a reference to <code>System.Windows.Forms.DataVisualization</code>.<br />
To use the adapters, add a reference to <strong>NMathChartMicrosoft.dll</strong> and/or <strong>NMathStatsChartMicrosoft.dll,</strong> and <code>using</code> statement:</p>
<pre class="code">using CenterSpace.NMath.Charting.Microsoft;</pre>
<p>A <a href="/using-nmath-charts-with-net-4-0/">previous blog article</a> provides a simple <code>app.config</code> solution for deploying your chart dependent applications to target both .NET 3.5 or .NET 4.0.  Without this <code>app.config</code> modification, your application will only target .NET 3.5.</p>
<h3>The Math Chart Adapter API</h3>
<p>Both <strong>NMathChart</strong> and <strong>NMathStatsChart</strong> classes share a common API. Overloads of the <code>ToChart()</code> function are provided for our common math and stats types. <code>ToChart()</code> returns an instance of <code>System.Windows.Forms.DataVisualization.Charting.Chart</code>, which can be customized as desired. For example</p>
<pre lang="csharp">Polynomial poly = new Polynomial( new DoubleVector( 4, 2, 5, -2, 3 ) );
Chart chart = NMathChart.ToChart( poly, -1, 1 );
chart.Titles.Add("Hello World");</pre>
<p>For prototyping and debugging console applications, the <code>Show()</code> function shows a given chart in a default form.</p>
<pre lang="csharp">NMathChart.Show( chart );</pre>
<p>Note that when the window is closed, the chart is disposed.</p>
<p>If you do not need to customize the chart, overloads of <code>Show()</code> are also provided for common NMath types.</p>
<pre lang="csharp">NMathChart.Show( poly );</pre>
<p>This is equivalent to calling:</p>
<pre lang="csharp">NMathChart.Show( NMathChart.ToChart( poly ) );</pre>
<p>The <code>Save()</code> function saves a chart to a file or stream.</p>
<pre lang="csharp">NMathChart.Save( chart, "chart.png", ChartImageFormat.Png );</pre>
<p>If you are developing a Windows Forms application using the Designer, add a Microsoft Chart control to your form, then update it with an NMath object using the appropriate <code>Update()</code> function after initialization.</p>
<pre lang="csharp">public Form1()
{
  InitializeComponent();

  Polynomial poly =
    new Polynomial( new DoubleVector( 4, 2, 5, -2, 3 ) );
  NMathChart.Update( ref this.chart1, poly, -1, 1 );
}</pre>
<p>This has the following effect on your existing Chart object:</p>
<ul>
<li>a new, default ChartArea is added if one does not exist, otherwise chart.ChartAreas[0] is used</li>
<li>axis titles, and DefaultAxisTitleFont and DefaultMajorGridLineColor, only have an effect if a new ChartArea is added</li>
<li>titles are added only if the given Chart does not already contain any titles</li>
<li>chart.Series[0] is replaced, or added if necessary</li>
</ul>
<h3>Charting Examples</h3>
<p>Here are a few examples of usage in C# (Of course, as with all NMath functionality, these examples will also work, given the necessary syntactic changes, from VB.NET or F#, or any other .NET language.) :</p>
<pre lang="chsarp">double xmin = -1;
double xmax = 1;
int numInterpolatedValues = 100;
Polynomial poly = new Polynomial( new DoubleVector( 4, 2, 5, -2, 3 ) );
NMathChart.Show( poly, xmin, xmax, numInterpolatedValues );</pre>
<p><a href="https://www.centerspace.net/blog/wp-content/uploads/2011/09/polynomial.png"><img decoding="async" class="aligncenter size-full wp-image-3542" title="Polynomial" src="https://www.centerspace.net/blog/wp-content/uploads/2011/09/polynomial.png" alt="Math chart of a polynomial" width="480" srcset="https://www.centerspace.net/wp-content/uploads/2011/09/polynomial.png 489w, https://www.centerspace.net/wp-content/uploads/2011/09/polynomial-150x150.png 150w, https://www.centerspace.net/wp-content/uploads/2011/09/polynomial-300x300.png 300w" sizes="(max-width: 489px) 100vw, 489px" /></a></p>
<pre lang="csharp">DoubleVector x = new DoubleVector( 100, 0, 0.1 );
DoubleVector cos = x.Apply( NMathFunctions.CosFunction );
DoubleVector sin = x.Apply( NMathFunctions.SinFunction );

DoubleVector[] data = new DoubleVector[] { cos, sin };
NMathChart.Unit unit = new NMathChart.Unit( 0, 0.1, "x" );
Chart chart = NMathChart.ToChart( data, unit );

chart.Series[0].Name = "cos(x)";
chart.Series[1].Name = "sin(x)";
NMathChart.Show( chart );</pre>
<p><a href="https://www.centerspace.net/blog/wp-content/uploads/2011/09/vector_array.png"><img decoding="async" class="aligncenter size-full wp-image-3541" title="Vector Array" src="https://www.centerspace.net/blog/wp-content/uploads/2011/09/vector_array.png" alt="Math chart of a vector array" width="480" srcset="https://www.centerspace.net/wp-content/uploads/2011/09/vector_array.png 489w, https://www.centerspace.net/wp-content/uploads/2011/09/vector_array-150x150.png 150w, https://www.centerspace.net/wp-content/uploads/2011/09/vector_array-300x298.png 300w" sizes="(max-width: 489px) 100vw, 489px" /></a></p>
<pre lang="csharp">double lambda = 4.0;
PoissonDistribution poisson = new PoissonDistribution( lambda );

NMathStatsChart.Show( poisson,
  NMathStatsChart.DistributionFunction.PDF );</pre>
<p><a href="https://www.centerspace.net/blog/wp-content/uploads/2011/09/poisson_pdf1.png"><img decoding="async" class="aligncenter size-full wp-image-3544" title="Poisson Distribution" src="https://www.centerspace.net/blog/wp-content/uploads/2011/09/poisson_pdf1.png" alt="A math chart of a poisson distribution" width="480" srcset="https://www.centerspace.net/wp-content/uploads/2011/09/poisson_pdf1.png 487w, https://www.centerspace.net/wp-content/uploads/2011/09/poisson_pdf1-150x150.png 150w, https://www.centerspace.net/wp-content/uploads/2011/09/poisson_pdf1-298x300.png 298w" sizes="(max-width: 487px) 100vw, 487px" /></a></p>
<pre lang="csharp">DoubleMatrix predictors =
  new DoubleMatrix( 100, 3, new RandGenUniform() ); ;
DoubleVector observations = 2 * predictors.Col(0) +
  -0.75 * predictors.Col(1) + 1.25 * predictors.Col(2) + 0.5;
bool addIntercept = true;

LinearRegression lr =
  new LinearRegression( predictors, observations, addIntercept );
NMathStatsChart.Show( lr, 2 );</pre>
<pre class="csharp"><a href="https://www.centerspace.net/blog/wp-content/uploads/2011/09/lr.png"><img decoding="async" class="aligncenter size-full wp-image-3545" title="Linear Regression" src="https://www.centerspace.net/blog/wp-content/uploads/2011/09/lr.png" alt="Math chart of a linear regression" width="480" srcset="https://www.centerspace.net/wp-content/uploads/2011/09/lr.png 492w, https://www.centerspace.net/wp-content/uploads/2011/09/lr-150x150.png 150w, https://www.centerspace.net/wp-content/uploads/2011/09/lr-300x300.png 300w" sizes="(max-width: 492px) 100vw, 492px" /></a></pre>
<p><strong>More Information</strong></p>
<p>For more information, and many more examples, see:</p>
<ul>
<li>Whitepaper: <a href="https://www.centerspace.net/doc/NMath/whitepapers/NMath.ChartMicrosoft.pdf">NMath Visualization Using the Microsoft Chart Controls</a></li>
<li>Whitepaper: NMath Stats Visualization Using the Microsoft Chart Controls</li>
<li>the <a href="https://www.centerspace.net/doc/NMath/ref/">API docs</a> for the <code>CenterSpace.NMath.Charting.Microsoft </code>namespace</li>
</ul>
<p>The post <a rel="nofollow" href="https://www.centerspace.net/math-charts">.NET Math with Microsoft Chart Controls, Revisited</a> appeared first on <a rel="nofollow" href="https://www.centerspace.net">CenterSpace</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.centerspace.net/math-charts/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3538</post-id>	</item>
		<item>
		<title>Using NMath Charts with .NET 4.0</title>
		<link>https://www.centerspace.net/using-nmath-charts-with-net-4-0</link>
					<comments>https://www.centerspace.net/using-nmath-charts-with-net-4-0#respond</comments>
		
		<dc:creator><![CDATA[Ken Baldwin]]></dc:creator>
		<pubDate>Fri, 30 Sep 2011 23:10:47 +0000</pubDate>
				<category><![CDATA[NMath]]></category>
		<category><![CDATA[NMath Stats]]></category>
		<category><![CDATA[Visualization]]></category>
		<category><![CDATA[.NET charting]]></category>
		<category><![CDATA[C# charts]]></category>
		<category><![CDATA[deploying .NET charts]]></category>
		<category><![CDATA[F# charts]]></category>
		<category><![CDATA[VB.NET charts]]></category>
		<guid isPermaLink="false">http://www.centerspace.net/blog/?p=3558</guid>

					<description><![CDATA[<p>The NMath Chart DLLs (NMathChartMicrosoft.dll and NMathStatsChartMicrosoft.dll) are built against the .NET 3.5 version of the Microsoft Chart Controls for .NET (System.Windows.Forms.DataVisualization). The .NET runtime will not automatically replace this reference with the version of the Microsoft Chart DLL built into the .NET 4.0 Framework, unless you explicitly tell it to do so by adding the [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.centerspace.net/using-nmath-charts-with-net-4-0">Using NMath Charts with .NET 4.0</a> appeared first on <a rel="nofollow" href="https://www.centerspace.net">CenterSpace</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>The NMath Chart DLLs (<strong>NMathChartMicrosoft.dll</strong> and <strong>NMathStatsChartMicrosoft.dll</strong>) are built against the .NET 3.5 version of the Microsoft Chart Controls for .NET (<strong>System.Windows.Forms.DataVisualization</strong>). The .NET runtime will not automatically replace this reference with the version of the Microsoft Chart DLL built into the .NET 4.0 Framework, unless you explicitly tell it to do so by adding the following lines to your <code>app.config</code>:</p>
<pre class="code">
<table><tbody>
<tr>
<td>
&lt;configuration&gt;
   ...
   &lt;runtime&gt;
      ...
      &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;
         ...
         &lt;dependentAssembly&gt;
            &lt;assemblyIdentity name="System.Windows.Forms.DataVisualization"
              publicKeyToken="31bf3856ad364e35"/&gt;
            &lt;bindingRedirect oldVersion="3.5.0.0-3.5.0.0" newVersion="4.0.0.0"/&gt;
         &lt;/dependentAssembly&gt;
         ...
      &lt;/assemblyBinding&gt;
      ...
   &lt;/runtime&gt;
   ...
&lt;/configuration&gt;
</td>
</tr>
</tbody>
</table>
</pre>
<p>In this way, your application with charts can be <em>deployed to both .NET 3.5 and .NET 4.0.</em> Please note that all other NMath assemblies (with non-visual functionality) can be used in .NET 3.5 and .NET 4.0 without this step.</p>
<p>See <a href="https://msdn.microsoft.com/en-us/library/dd990785.aspx">this tutorial</a> for more information.</p>
<p>The post <a rel="nofollow" href="https://www.centerspace.net/using-nmath-charts-with-net-4-0">Using NMath Charts with .NET 4.0</a> appeared first on <a rel="nofollow" href="https://www.centerspace.net">CenterSpace</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.centerspace.net/using-nmath-charts-with-net-4-0/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3558</post-id>	</item>
		<item>
		<title>CenterSpace @ TechEd</title>
		<link>https://www.centerspace.net/centerspace-teched</link>
					<comments>https://www.centerspace.net/centerspace-teched#respond</comments>
		
		<dc:creator><![CDATA[Trevor Misfeldt]]></dc:creator>
		<pubDate>Mon, 16 May 2011 16:13:15 +0000</pubDate>
				<category><![CDATA[CenterSpace]]></category>
		<category><![CDATA[Corporate]]></category>
		<category><![CDATA[Visualization]]></category>
		<category><![CDATA[Infragistics]]></category>
		<guid isPermaLink="false">http://www.centerspace.net/blog/?p=3439</guid>

					<description><![CDATA[<p>We will be giving demos at the Infragistics booth (#616) at Tech Ed 2011 in Atlanta. Come by and say hello! &#8211; Trevor</p>
<p>The post <a rel="nofollow" href="https://www.centerspace.net/centerspace-teched">CenterSpace @ TechEd</a> appeared first on <a rel="nofollow" href="https://www.centerspace.net">CenterSpace</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>We will be giving demos at the Infragistics booth (#616) at Tech Ed 2011 in Atlanta. Come by and say hello!</p>
<p><a href="https://www.centerspace.net/blog/wp-content/uploads/2011/05/andy_tech_ed4.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-3456" title="andy_tech_ed" src="https://www.centerspace.net/blog/wp-content/uploads/2011/05/andy_tech_ed4.jpg" alt="" width="400" height="533" srcset="https://www.centerspace.net/wp-content/uploads/2011/05/andy_tech_ed4.jpg 400w, https://www.centerspace.net/wp-content/uploads/2011/05/andy_tech_ed4-225x300.jpg 225w" sizes="(max-width: 400px) 100vw, 400px" /></a></p>
<p>&#8211; Trevor</p>
<p>The post <a rel="nofollow" href="https://www.centerspace.net/centerspace-teched">CenterSpace @ TechEd</a> appeared first on <a rel="nofollow" href="https://www.centerspace.net">CenterSpace</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.centerspace.net/centerspace-teched/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3439</post-id>	</item>
		<item>
		<title>Using NMath with Microsoft Chart Controls for .NET</title>
		<link>https://www.centerspace.net/using-nmath-with-microsoft-chart-controls-for-net</link>
					<comments>https://www.centerspace.net/using-nmath-with-microsoft-chart-controls-for-net#respond</comments>
		
		<dc:creator><![CDATA[Ken Baldwin]]></dc:creator>
		<pubDate>Wed, 09 Mar 2011 11:04:53 +0000</pubDate>
				<category><![CDATA[NMath]]></category>
		<category><![CDATA[NMath Tutorial]]></category>
		<category><![CDATA[Visualization]]></category>
		<category><![CDATA[.NET chart]]></category>
		<category><![CDATA[.NET plotting]]></category>
		<category><![CDATA[C# charts]]></category>
		<category><![CDATA[C# ploting]]></category>
		<category><![CDATA[Chart Controls for .NET]]></category>
		<category><![CDATA[VB.NET charts]]></category>
		<category><![CDATA[VB.NET plotting]]></category>
		<guid isPermaLink="false">http://www.centerspace.net/blog/?p=3262</guid>

					<description><![CDATA[<p><img class="excerpt" title="chart2" src="https://www.centerspace.net/blog/wp-content/uploads/2011/03/chart2.png"  /> The Microsoft Chart Controls for .NET provide an easy (and free) solution for visualizing NMath numerical types. The Chart controls are available as a separate download for .NET 3.5. Beginning in .NET 4.0, the Chart controls are part of the .NET Framework. </p>
<p>The post <a rel="nofollow" href="https://www.centerspace.net/using-nmath-with-microsoft-chart-controls-for-net">Using NMath with Microsoft Chart Controls for .NET</a> appeared first on <a rel="nofollow" href="https://www.centerspace.net">CenterSpace</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In 2007, Microsoft acquired the Dundas chart components, in order to deliver data visualization directly within Microsoft products. In October 2008, they released the Microsoft Chart Controls for .NET, which includes the Dundas ASP.NET and Windows Forms Chart controls. The Chart controls are available as a <a href="https://www.microsoft.com/en-us/download/details.aspx?id=14422">separate download for .NET 3.5</a>. Beginning in .NET 4.0, the Chart controls are part of the .NET Framework. To use the Chart controls, add a reference to System.Windows.Forms.DataVisualization.</p>
<p>A <strong>Chart</strong> object contains one or more <strong>ChartArea</strong>s, each of which contain one or more data <strong>Series</strong>. Each <strong>Series</strong> has an associated chart type, and a <strong>DataPoint</strong> collection. <strong>DataPoint</strong>s can be manually appended or inserted into the collection, or added automatically when a series is bound to a datasource using either the <tt>DataBindY()</tt> or <tt>DataBindXY()</tt> method. Since any <strong>IEnumerable</strong> can act as a datasource, it&#8217;s easy to use an NMath vector or vector view (of a matrix row or column, for example) as a datasource.</p>
<p>For example, suppose we want to create a scatter plot of the first two columns of a 20 x 5 <strong>DoubleMatrix</strong> (that is, column 0 vs. column 1).</p>
<pre lang="csharp">DoubleMatrix data = new DoubleMatrix( 20, 5, new RandGenUniform() );
DoubleVector x = data.Col( 0 );
DoubleVector y = data.Col( 1 );</pre>
<p>Begin by creating a new <strong>Chart</strong> object, and optionally adding a <strong>Title</strong>.</p>
<pre lang="csharp">Chart chart = new Chart()
{
  Size = new Size( 500, 500 ),
};

Title title = new Title()
{
  Name = chart.Titles.NextUniqueName(),
  Text = "My Data",
  Font = new Font( "Trebuchet MS", 12F, FontStyle.Bold ),
};
chart.Titles.Add( title );</pre>
<p>Next, add a <strong>ChartArea</strong>.</p>
<pre lang="csharp">ChartArea area = new ChartArea()
{
  Name = chart.ChartAreas.NextUniqueName(),
};
area.AxisX.Title = "Col 0";
area.AxisX.TitleFont = new Font( "Trebuchet MS", 10F, FontStyle.Bold );
area.AxisX.MajorGrid.LineColor = Color.LightGray;
area.AxisX.RoundAxisValues();
area.AxisY.Title = "Col 1";
area.AxisY.TitleFont = new Font( "Trebuchet MS", 10F, FontStyle.Bold );
area.AxisY.MajorGrid.LineColor = Color.LightGray;
area.AxisY.RoundAxisValues();
chart.ChartAreas.Add( area );</pre>
<p>Finally, add a new data <strong>Series</strong>, and bind the datasource to the NMath x,y vectors.</p>
<pre lang="csharp">Series series = new Series()
{
  Name = "Points",
  ChartType = SeriesChartType.Point,
  MarkerStyle = MarkerStyle.Circle,
  MarkerSize = 8,
};
series.Points.DataBindXY( x, y );
chart.Series.Add( series );</pre>
<p>To display the chart, we can use a utility function like this, which shows the given chart in a default form running in a new thread.</p>
<pre lang="csharp">public static void Show( Chart chart )
{
  Form form = new Form();
  form.Size = new Size( chart.Size.Width + 20, chart.Size.Height + 40 );
  form.Controls.Add( chart );
  Thread t = new Thread( () =&gt; Application.Run( form ) );
   t.Start();
}</pre>
<p>After calling</p>
<pre lang="csharp">Show( chart );</pre>
<p>the result looks like this:</p>
<p style="text-align: center;"><a href="https://www.centerspace.net/blog/wp-content/uploads/2011/03/chart11.png"><img decoding="async" loading="lazy" class="size-full wp-image-3267 aligncenter" title="chart1" src="https://www.centerspace.net/blog/wp-content/uploads/2011/03/chart11.png" alt="Microsoft Chart Controls for .NET" width="491" height="486" srcset="https://www.centerspace.net/wp-content/uploads/2011/03/chart11.png 491w, https://www.centerspace.net/wp-content/uploads/2011/03/chart11-300x296.png 300w" sizes="(max-width: 491px) 100vw, 491px" /></a></p>
<p>Of course, you can easily plot more complicated data as well. For instance, suppose we fit a 4th degree polynomial to this (random) data:</p>
<pre lang="csharp">int degree = 4;
PolynomialLeastSquares pls = new PolynomialLeastSquares( degree, x, y );</pre>
<p>To add the fitted polynomial to the cart, just add a new data <strong>Series</strong> interpolating over the range of x values.</p>
<pre lang="csharp">Series series2 = new Series()
{
  Name = "Polynomial",
  ChartType = SeriesChartType.Line,
  MarkerStyle = MarkerStyle.None,
};
int numInterpolatedValues = 100;
double xmin = NMathFunctions.MinValue( x );
double xmax = NMathFunctions.MaxValue( x );
double step = ( xmax - xmin ) / ( numInterpolatedValues - 1 );
DoubleVector xi = new DoubleVector( numInterpolatedValues, xmin, step );
series2.Points.DataBindXY( xi, pls.FittedPolynomial.Evaluate( xi ) );
chart.Series.Add( series2 );</pre>
<p>Let&#8217;s also add a subtitle with the fitted function, and a <strong>Legend</strong>.</p>
<pre lang="csharp">Title subtitle = new Title()
{
  Name = chart.Titles.NextUniqueName(),
  Text = "f(x) = " + pls.FittedPolynomial.ToString( "N2" ),
};
chart.Titles.Add( subtitle );

Legend legend = new Legend()
{
  Name = chart.Legends.NextUniqueName(),
  DockedToChartArea = chart.ChartAreas[0].Name,
};
chart.Legends.Add( legend );</pre>
<p>Now the chart looks like this:<br />
<a href="https://www.centerspace.net/blog/wp-content/uploads/2011/03/chart2.png"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-3268" title="chart2" src="https://www.centerspace.net/blog/wp-content/uploads/2011/03/chart2.png" alt="" width="491" height="494" srcset="https://www.centerspace.net/wp-content/uploads/2011/03/chart2.png 491w, https://www.centerspace.net/wp-content/uploads/2011/03/chart2-150x150.png 150w, https://www.centerspace.net/wp-content/uploads/2011/03/chart2-298x300.png 298w" sizes="(max-width: 491px) 100vw, 491px" /></a></p>
<p>If you add a <strong>Chart</strong> control to your application using the visual designer (by dragging a <strong>Chart</strong> control from the Data category in the Toolbox), this generates code to create a default <strong>Chart</strong>, with a single <strong>ChartArea</strong>, <strong>Series</strong>, and <strong>Legend</strong>. You can then edit the properties in the Properties tab, and bind the generated <strong>Series</strong> to an NMath datasource. For example:</p>
<pre lang="csharp">public Form1()
{
  InitializeComponent();

  DoubleMatrix data = new DoubleMatrix( 20, 5, new RandGenUniform() );
  this.chart1.Series[0].Points.DataBindXY( data.Col(0), data.Col(1) );
}</pre>
<p>The Microsoft Chart Controls for .NET provide an easy (and free) solution for visualizing NMath numerical types.</p>
<p>Ken</p>
<p>The post <a rel="nofollow" href="https://www.centerspace.net/using-nmath-with-microsoft-chart-controls-for-net">Using NMath with Microsoft Chart Controls for .NET</a> appeared first on <a rel="nofollow" href="https://www.centerspace.net">CenterSpace</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.centerspace.net/using-nmath-with-microsoft-chart-controls-for-net/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3262</post-id>	</item>
		<item>
		<title>NMath Visualizers</title>
		<link>https://www.centerspace.net/nmath-visualizers</link>
					<comments>https://www.centerspace.net/nmath-visualizers#comments</comments>
		
		<dc:creator><![CDATA[Ken Baldwin]]></dc:creator>
		<pubDate>Fri, 06 Feb 2009 19:13:21 +0000</pubDate>
				<category><![CDATA[NMath]]></category>
		<category><![CDATA[Visualization]]></category>
		<category><![CDATA[debugging]]></category>
		<guid isPermaLink="false">http://www.centerspace.net/blog/?p=85</guid>

					<description><![CDATA[<p>NMath debugger visualizers allow you to look at your data structures while you&#8217;re debugging your code. Currently supported types are: Grid view DataFrame DoubleVector FloatVector DoubleComplexVector FloatComplexVector DoubleMatrix FloatMatrix DoubleComplexMatrix FloatComplexMatrix DoubleSymmetricMatrix FloatSymmetricMatrix DoubleCsrSparseMatrix Histogram Chart view BetaDistribution BinomialDistribution Bracket ChiSquareDistribution DataFrame DFIntColumn DFNumericColumn DoubleComplexMatrix DoubleComplexVector DoubleVector ExponentialDistribution FDistribution FloatComplexMatrix FloatComplexVector FloatMatrix FloatVector GammaDistribution GeometricDistribution [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.centerspace.net/nmath-visualizers">NMath Visualizers</a> appeared first on <a rel="nofollow" href="https://www.centerspace.net">CenterSpace</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>NMath debugger visualizers allow you to look at your data structures while you&#8217;re debugging your code.</p>
<p>Currently supported types are:</p>
<p><strong>Grid view</strong><br />
<code>DataFrame</code><br />
<code>DoubleVector</code><br />
<code>FloatVector</code><br />
<code>DoubleComplexVector</code><br />
<code>FloatComplexVector</code><br />
<code>DoubleMatrix</code><br />
<code>FloatMatrix</code><br />
<code>DoubleComplexMatrix</code><br />
<code>FloatComplexMatrix</code><br />
<code>DoubleSymmetricMatrix</code><br />
<code>FloatSymmetricMatrix</code><br />
<code>DoubleCsrSparseMatrix</code><br />
<code>Histogram</code></p>
<p><strong>Chart view</strong><br />
<code>BetaDistribution</code><br />
<code>BinomialDistribution</code><br />
<code>Bracket</code><br />
<code>ChiSquareDistribution</code><br />
<code>DataFrame</code><br />
<code>DFIntColumn</code><br />
<code>DFNumericColumn</code><br />
<code>DoubleComplexMatrix</code><br />
<code>DoubleComplexVector</code><br />
<code>DoubleVector</code><br />
<code>ExponentialDistribution</code><br />
<code>FDistribution</code><br />
<code>FloatComplexMatrix</code><br />
<code>FloatComplexVector</code><br />
<code>FloatMatrix</code><br />
<code>FloatVector</code><br />
<code>GammaDistribution</code><br />
<code>GeometricDistribution</code><br />
<code>GoodnessOfFit</code><br />
<code>Histogram</code><br />
<code>IDFColumn</code><br />
<code>JohnsonDistribution</code><br />
<code>LinearRegression</code><br />
<code>LogisticDistribution</code><br />
<code>LognormalDistribution</code><br />
<code>NegativeBinomialDistribution</code><br />
<code>NormalDistribution</code><br />
<code>PoissonDistribution</code><br />
<code>TDistribution</code><br />
<code>TriangularDistribution</code><br />
<code>UniformDistribution</code><br />
<code>DoubleMatrix</code><br />
<code>WeibullDistribution</code></p>
<p><strong>Installing the Visualizers</strong></p>
<p>NMath Visualizers for Visual Studio 2010 and 2012 are automatically installed.</p>
<p><strong>Starting a Visualizer</strong></p>
<p>When debugging and at a breakpoint, hover your mouse over the supported NMath object you want to visualize. Click the little magnifying glass that appears in the datatip. You can also start a visualizer from the Locals view, as shown below:</p>
<p><strong>Examples</strong></p>
<p><a href="https://www.centerspace.net/blog/wp-content/uploads/2009/02/visualizer11.jpg"><img decoding="async" loading="lazy" src="https://www.centerspace.net/blog/wp-content/uploads/2009/02/visualizer11-300x250.jpg" alt="visualizer1" width="300" height="250" class="aligncenter size-medium wp-image-5573" srcset="https://www.centerspace.net/wp-content/uploads/2009/02/visualizer11-300x250.jpg 300w, https://www.centerspace.net/wp-content/uploads/2009/02/visualizer11.jpg 877w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p></br></p>
<p><a href="https://www.centerspace.net/blog/wp-content/uploads/2009/02/visualizer31.jpg"><img decoding="async" loading="lazy" src="https://www.centerspace.net/blog/wp-content/uploads/2009/02/visualizer31-300x213.jpg" alt="visualizer3" width="300" height="213" class="aligncenter size-medium wp-image-5574" srcset="https://www.centerspace.net/wp-content/uploads/2009/02/visualizer31-300x213.jpg 300w, https://www.centerspace.net/wp-content/uploads/2009/02/visualizer31-1024x727.jpg 1024w, https://www.centerspace.net/wp-content/uploads/2009/02/visualizer31.jpg 1204w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p></br></p>
<p><a href="https://www.centerspace.net/blog/wp-content/uploads/2009/02/visualizers4.jpg"><img decoding="async" loading="lazy" src="https://www.centerspace.net/blog/wp-content/uploads/2009/02/visualizers4-300x108.jpg" alt="visualizers4" width="300" height="108" class="aligncenter size-medium wp-image-5575" srcset="https://www.centerspace.net/wp-content/uploads/2009/02/visualizers4-300x108.jpg 300w, https://www.centerspace.net/wp-content/uploads/2009/02/visualizers4-1024x371.jpg 1024w, https://www.centerspace.net/wp-content/uploads/2009/02/visualizers4.jpg 1305w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p><strong>Known Issues</strong></p>
<ol>
<li>It is not possible to use the visualizers to debug a 64-bit application.</li>
</ol>
<p>&#8211; Trevor</p>
<p>The post <a rel="nofollow" href="https://www.centerspace.net/nmath-visualizers">NMath Visualizers</a> appeared first on <a rel="nofollow" href="https://www.centerspace.net">CenterSpace</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.centerspace.net/nmath-visualizers/feed</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">85</post-id>	</item>
	</channel>
</rss>
