J
Jon
I have a class for complex numbers and an exponential function. This
event handler does not reach Expz in debug mode:
z = New Complex(CDbl(Real.Text), CDbl(Imag.Text))
Real.Text = CStr(z.Expz().GetReal())
Imag.Text = CStr(z.Expz().GetImaginary())
But when I do this
z = z.Expz()
Real.Text = CStr(z.GetReal())
Imag.Text = CStr(z.GetImaginary())
Or even this
Dim w As Complex = z.Expz()
Real.Text = CStr(z.Expz().GetReal())
Imag.Text = CStr(z.Expz().GetImaginary())
it executes the calculation and displays it. What's up here?
Jon Cosby
************************************************************
Public Class Complex
Private Shared re As Double
Private Shared im As Double
Public Sub New(ByVal x As Double, ByVal y As Double)
re = x
im = y
End Sub
Public Shared Function Expz() As Complex
Dim w As Complex
w = New Complex(Exp(re) * Cos(im), Exp(re) * Sin(im))
Return w
End Function
event handler does not reach Expz in debug mode:
z = New Complex(CDbl(Real.Text), CDbl(Imag.Text))
Real.Text = CStr(z.Expz().GetReal())
Imag.Text = CStr(z.Expz().GetImaginary())
But when I do this
z = z.Expz()
Real.Text = CStr(z.GetReal())
Imag.Text = CStr(z.GetImaginary())
Or even this
Dim w As Complex = z.Expz()
Real.Text = CStr(z.Expz().GetReal())
Imag.Text = CStr(z.Expz().GetImaginary())
it executes the calculation and displays it. What's up here?
Jon Cosby
************************************************************
Public Class Complex
Private Shared re As Double
Private Shared im As Double
Public Sub New(ByVal x As Double, ByVal y As Double)
re = x
im = y
End Sub
Public Shared Function Expz() As Complex
Dim w As Complex
w = New Complex(Exp(re) * Cos(im), Exp(re) * Sin(im))
Return w
End Function