2
I am using the package "Extreme Optimization" to learn how to use calculus and mathematically more advanced programs using the VB language. However, I need help saving the program in memory and presenting the non-numerical derivative of a given expression to the user. In this case, I have for example an expression x 2 + x 5 and its derivative is 2x + 5x 4. However, when I try to present such an expression, the value returned is zero. The code is attached. I have already made several modifications, but I did not succeed. So, I put here the code that I made initially. Thank you!
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim x As Double
Dim result As Double = FunctionMath.Derivative(AddressOf Differentiation, x)
MessageBox.Show("diferenciacao em x = " + result.ToString, "resultado", MessageBoxButtons.OK)
End Sub
Function Differentiation(ByVal x As Double) As Double
Return Math.Pow(x, 2) + Math.Pow(x, 5)
End Function
It wouldn’t be because
x
is worth 0?– Maniero
Thus, theoretically it should not. It may be that I am not able to add some line of code preventing the program to interpret this way...
– Ana Waldila
Check the return value of your function. Double returned by Differentiation() is a double precision float.
– user86792