huiwuhuiwu的专栏

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Diagnostics;using System.Globalization;namespace FinMktReverseEngineering{class test{static void Main(string[] args){// 先生成集合Set<double> set1 = new Set<double>();for (int i = -10; i < 10; i++){set1.Insert(0.01*i);}Set<double> set2 = new Set<double>();for (int i = -10; i < 10; i++){set2.Insert(0.01 * i);}// 通过集合生成AssocArrayAssocArray<double, int> aa1 = new AssocArray<double, int>(set1,0);AssocArray<double, int> aa2 = new AssocArray<double, int>(set2, 0);// 通过AssocArray和NumericaMatrix生成AssocMatrixNumericMatrix<double> nmat= new NumericMatrix<double>(aa1.Count,aa2.Count,0,0);for (int i = nmat.MinRowIndex; i <=nmat.MaxRowIndex; i++){for (int j = nmat.MinColumnIndex; j <= nmat.MaxColumnIndex; j++){nmat[i,j]=-Math.Pow(aa1.Keys.ElementAt(i),2)/4.0+Math.Pow(aa2.Keys.ElementAt(j),2)/9.0;}}AssocMatrix<double, double, double> am = new AssocMatrix<double, double, double>(aa1, aa2, nmat);// 打印出来行、列(AssocArray中对应的序号)以及所有元素Console.WriteLine("行Key以及序号");am.PrintRowKeys();Console.WriteLine("列Key以及序号");am.PrintColKeys();Console.WriteLine("打印所有元素以及标题");am.PrintAllElements();ExcelMechanisms exl = new ExcelMechanisms();//exl.printAssocMatrixInExcel(am, "打印矩阵工作表");exl.printOneExcel<double, double, double>(am, "3D曲面:Z=-X^2/4+Y^2/9", "横坐标:X", "纵坐标:Y");Console.ReadLine();}}}

,吃东西,随便是什么——都可以。当日出越过山涧,我未老,你依然。

huiwuhuiwu的专栏

相关文章:

你感兴趣的文章:

标签云: