我正在嘗試使用 math.net.symbolics 庫進行推導。
我收到此錯誤:Compiler Error CS0103 The name 'cos' does not exist in the current context
private void Form1_Load(object sender, EventArgs e)
{
var x = Expr.Variable("x");
var func = 2 * x * x - 2 * Trigonometric.Contract(cos(x)) 1; //exc. question: 2 * x * x - 2 * cos(x) 1
Console.WriteLine("f(x) = " func.ToString()); //answer: //4*x 2*sin(x)
var derivative = func.Differentiate(x);
Console.WriteLine("f'(x) = " derivative.ToString());
}
uj5u.com熱心網友回復:
該檔案適用于 F#。它不起作用,因為我正在用 C# 撰寫代碼。
我使用時問題已解決
x.Cos()
代替
cos(x)
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/431640.html
