怎样用C#写代码实现卷积运算和三角函数运算
问题描述:
利用C#设计一个计算器,怎样用C#写代码,实现卷积运算和三角函数运算?
答
回答:三角函数是简单,卷积运算,你咋输入一个矩阵呢,还需要选定算子,最后得到一个矩阵,说实话不太容易
以下为三角函数的,卷积的容我再想想
private void button1_Click(object sender, EventArgs e)
{
string n = textBox1.Text;
float i = float.Parse(n);
textBox2.Text = Math.Sin(i).ToString();
}
private void button2_Click(object sender, EventArgs e)
{
string n = textBox1.Text;
float i = float.Parse(n);
textBox2.Text = Math.Cos(i).ToString();
}
private void button3_Click(object sender, EventArgs e)
{
string n = textBox1.Text;
float i = float.Parse(n);
textBox2.Text = Math.Tan(i).ToString();
}
运行截图:
由于没有办法输入Π,所以,除了0之外的特殊点,基本都是近似值