C#模式-与图片相同吗? [英] C# pattern - is it same as in image?
本文介绍了C#模式-与图片相同吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不太确定这与我在C#中编写的与该图像是否相同的模式吗?
代码:
Im not really sure about that is it same pattern i wrote in c# as in this image?
code:
-Math.Cos(x1) * Math.Cos(x2) * Math.Pow(Math.E, Math.Pow(-(x1 - Math.PI), 2) - Math.Pow((x2 - Math.PI),2));
正确的图案:
http://s18.postimage.org/btxjslcaf/wzor.png [
Right pattern:
http://s18.postimage.org/btxjslcaf/wzor.png[^]
Thank u you for help
推荐答案
将-"放入Math.Pow(-(x1 - Math.PI), 2)
内时出现了错误,该方法不是最好的.由于性能,我也不会在正方形上使用Pow
,而是会使用Exp
函数:
v
Acutally made error in putting the "-" inside theMath.Pow(-(x1 - Math.PI), 2)
, and the approach is not the best. I would also not use thePow
for square because of perfomance, and would use theExp
function:
v
ar VALUE = - Math.Cos(x1) * Math.Cos(x2) * Math.Exp(-(x1 -nu) *(x1 - Math.PI) -(x2 -nu) * (x2 -Math.PI));
这篇关于C#模式-与图片相同吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文