0
我正在使用此代碼來構建我在每個點的3d表面圖,但我有一個問題,我需要參數化我的函數,因此t變量將從0循環到T值,但我無法弄清楚,我該如何在代表內部做到這一點?c#lambda表達式與循環
編輯的第一塊更加清晰:
/*this is code for building 3d surface plot, parameter delegate is counting Z
value in each (x, y) point.
x, y are axis variables. t is constant here*/
new ILPlotCube()
{
new ILSurface((x, y) => (float) (1/(x+y+t))
}
得到的僞代碼是一樣的東西:
float functionValue = 0;
for (double t = 0; t < T; t + deltaT)
{
/*t is loop parameter here*/
functionValue += (float) (1/(x+y+t));
}
return functionValue;
我認爲你應該去一個混淆的C#代碼比賽...這是三分鐘我正在閱讀第一個代碼塊,我仍然不確定誰是誰的參數 – xanatos