This is my matrix. I want to solve C,D and E
<uploaded>
Can anyone give me the sample codes to solve C, D and E in VB.Net?
Answers are C=0.4857143, D=0.0000000 and E=-0.1428571 (manual calculation)
Thanks!
This is my matrix. I want to solve C,D and E
<uploaded>
Can anyone give me the sample codes to solve C, D and E in VB.Net?
Answers are C=0.4857143, D=0.0000000 and E=-0.1428571 (manual calculation)
Thanks!
have you heard of multidimensional arrays?
This is the answer here.
btw, how do we get those results (any formulas)?
Not a math.wiz, just hobbyist programmer, and am just wondering; How are the calculations added up to return those results?
.ex: "C=0.4857143", though how are you getting that value?
Not a math.wiz, just hobbyist programmer, and am just wondering; How are the calculations added up to return those results?
.ex: "C=0.4857143", though how are you getting that value?
Thanks dear,
I am not a programmer doing as a hobby. I am developing a mathematical software for Ecology. I am not much familiar with matrix and solving it in VB. Unfortunately my ecology model gives some answers as matrices. So, I want to solve those using VB.NET codes as I do my codes in VB.NET. I posted here just an example, not a real data. These results I got using "R" statistical software. Here are the codes for "R" software.
> e<- matrix(nrow=3, ncol=3, data=c(5,0,10,0,10,10,10,0,34))
> f<- c(1,0,0)
> solve(e,f)
[1] 0.4857143 0.0000000 -0.1428571
>
But this is very difficult in VB.NET. That's why I posted this into this forum.
Please help me!
Thanks!
have you heard of multidimensional arrays?
This is the answer here.
btw, how do we get those results (any formulas)?
Thanks dear,
Yes I heard multidimensional arrays. But I am not much familiar with it in VB.NET. Okay, I will try to do it with it. Thanks, but I must say this. I am developing a mathematical software for Ecology. I am not much familiar with matrix and solving it in VB. Unfortunately my ecology model gives some answers as matrices. So, I want to solve those using VB.NET codes as I do my codes in VB.NET. I posted here just an example, not a real data. These results I got using "R" statistical software. Here are the codes for "R" software.
> e<- matrix(nrow=3, ncol=3, data=c(5,0,10,0,10,10,10,0,34))
> f<- c(1,0,0)
> solve(e,f)
[1] 0.4857143 0.0000000 -0.1428571
>
But this is very difficult in VB.NET. That's why I posted this into this forum.
Please help me!
Thanks!
You still didnt tell us any formula you want to use to get these kindof results.
Here is how you create and loop through multidimensional array:
Dim multiArray As Integer(,) = New Integer(,) {{5, 0, 10}, {0, 10, 0}, {10, 0, 34}}
Dim x As Integer = 0
For i As Integer = 0 To multiArray.GetLength(0) - 1
For j As Integer = 0 To multiArray.GetLength(1) - 1
x = multiArray(i, j)
Next
Next
Many thanks Mitja Bonca,
But how i solve C, D and E using these kind of multidimensional arrays? Formula?? OK, This is basics of least square methods. When we solve matrix like this, we get 3 equations (using above matrix) like,
5C + 0 + 10E = 1
0 + 10D + 0 = 0
10C + 0 + 34E = 0
This I got just by multiplying the matrix elements. So just we can solve manually and get C, D and E. Also it is easy using R software (as I mentioned codes in previous reply). This is what I ask. But, why this is difficult in VB.NET??? Can you extend your codes to get answers for C, D and E.
Thanks!
I cannot help you out, since I dont know what would those C, D and E mean.
I cannot help you out, since I dont know what would those C, D and E mean.
Thanks for the discussion.
.i just went grasshopper and ran out the.door, thanks also.:)
I think the technique you want to use is called Gaussian Elimination. I must have written this code a half dozen times when I was back in university. I did versions with simple elimination, partial and full pivoting (actual and virtual). I hated it every time and I have long since forgotten how to do it but a walk-through with code can be found here. The technique can be used to solve for n equations in n unknowns.
And don't get me started on eigen values or linear diophantine equations. I don't recall what they are for but it is cool to be able to rattle off the names. Of course I didn't think so at exam time;)
Trivia - for matrices that are non-singular, the computer language, APL, has a single operator (quad divide) that does all that for you.
Dear codeorder and Mitja Bonca,
Thanks for your discussion about my problem. I solved the problem using C# library for .NET. Here you can find it, but its in another forum. I just used "solvelinear()" function. Its easy. I use two projects, one for C# and one for VB in same solution. Its working, but i don't know what will happen in the setup deployment.
Thanks!
I think the technique you want to use is called Gaussian Elimination. I must have written this code a half dozen times when I was back in university. I did versions with simple elimination, partial and full pivoting (actual and virtual). I hated it every time and I have long since forgotten how to do it but a walk-through with code can be found here. The technique can be used to solve for n equations in n unknowns.
And don't get me started on eigen values or linear diophantine equations. I don't recall what they are for but it is cool to be able to rattle off the names. Of course I didn't think so at exam time;)
Trivia - for matrices that are non-singular, the computer language, APL, has a single operator (quad divide) that does all that for you.
Thanks for the information. I will try it also. My problem is already solved using C# libraries for Matrix (see my previous reply. Thanks!
C, D, and E are unknowns. What is presented is what is known as "simultaneous equations" (system of linear equations). Basically, you want to multiply, add, and subtract, etc, until the matrix on the left hand side ends up as the identity matrix:
[1 0 0]
[0 1 0]
[0 0 1]
Whatever is performed on the left matrix must also be performed on the right matrix. Once you have come to the point where you have the identity matrix on the left side, the right side will display the results to C, D, and E.
This link (http://www.ucl.ac.uk/Mathematics/geomath/level2/mat/mat102.html) should get you started.
C, D, and E are unknowns. What is presented is what is known as "simultaneous equations" (system of linear equations). Basically, you want to multiply, add, and subtract, etc, until the matrix on the left hand side ends up as the identity matrix:
[1 0 0]
[0 1 0]
[0 0 1]Whatever is performed on the left matrix must also be performed on the right matrix. Once you have come to the point where you have the identity matrix on the left side, the right side will display the results to C, D, and E.
This link (http://www.ucl.ac.uk/Mathematics/geomath/level2/mat/mat102.html) should get you started.
Thanks!