Asked by:
code
Question

All replies

Hello,
Before anyone works with you on this, can you show us what you have tried so far using the code button.
Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
VB Forums  moderator

I think in your equation the y(i) should be y(j)?
The first thing you should do is reduce the equations.
You have:f(x(i),y(j))=(x(i)^2x(i))+y(j)
say f = (x(i) ^ 2  x(i)) + y(j)
where
x(i) = i * h
y(j) = j * h
h= 0.1Is that correct?
therefore:
x = 0.1i
y = 0.1j
now substitute:f = ((0.1 * i) ^ 2  (0.1 * i)) + (0.1 * j)
Then you need to write the code and display the result somehow. I used a textbox:
So give it a go and then show us your code and exactly where you have questions if any.

Do you just want to know how to write that function in VB?
'f(x(i),y(j))=(x(i)^2x(i))+y(j) Private Function DoExpression(x() As Double, y() As Double, i As Integer, j As Integer) As Double Return (x(i) ^ 2  x(i)) + y(j) End Function
Then use it with something like:
Dim xValues() As Double Dim yValues() As Double Dim i, j As Integer Dim result = DoExpression(xValues, yValues, i, j)
Reed Kimble  "When you do things right, people won't be sure you've done anything at all"
 Proposed as answer by Cherry BuMicrosoft contingent staff, Moderator Monday, March 19, 2018 9:32 AM

Hi emanhh,
The following code is to write the equation with vb.net.
Dim h As Double = 0.1 Dim xvalue As Double Dim yvalue As Double Dim xyvalue As Double For i As Integer = 1 To 5 For j As Integer = 1 To 5 xvalue = i * h yvalue = j * h xyvalue = xvalue ^ 2  xvalue + yvalue Console.WriteLine(xyvalue) Next Next
Best Regards,
Cherry
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com. Proposed as answer by Stanly Fan Monday, March 19, 2018 9:33 AM