Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想输入这个字符串:
“pow(y,2) = 4 - pow(x,2)”(换句话说,y^2=4-x^2)
并让“x”= 1,然后让它评估并给我 y 的值。我该怎么做呢?
所以你想在给定数字 x 的情况下求解 y 的方程?这意味着 'y' 是 x 的函数,所以:
var y = new Expression("sqrt(4 - pow(x, 2))"); // y = SQRT(4 - X^2) e.Parameters["x"] = 1; var x = y.Evaluate();
那不能解决你的问题吗?(除了任何东西的平方根总是加/减一些东西,所以你必须添加那个逻辑)