vb.net如何输入矩阵,vb矩阵乘法
请问怎样用 VB写一个计算矩阵的程序~~谢谢
用行列式化简就可以了
成都创新互联是一家集网站建设,宜川企业网站建设,宜川品牌网站建设,网站定制,宜川网站建设报价,网络营销,网络优化,宜川网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。
先把数据输入数组det(1 to m,1 to n)中
然后把 第一个元素不是0的行 移动到上部,然后用第一行把下面各行第一列化为0;依此类推,得到阶梯型,然后...反正你学过行列式,应该懂的.
编程的思路和平时做题的基本一样.顶多就加一个交换行用的函数
你自己想的话,效果会好点.可以由简单的做起,例如3行3列的
求助,初学者想问VB.NET,怎么输入一维列矩阵或者一维行矩阵怎么转置成一维列矩阵?谢谢了!
在程序设计语言里,用二维数组来保存矩阵的值。
一维列矩阵,就是由:若干行、一列组成的二维数组。
一维行矩阵,就是由:一行、若干列组成的二维数组。
比如一维列矩阵,的输入:
dim a(10,1) as integer '10行,1列
dim i as integer
for i = 1 to 10
a(i,1) = inputbox("")
next i
用VB编写矩阵
Option Explicit
Dim i, j As Integer
Dim X(11, 11), Y(11, 11) As Double
Dim A As Variant
'假设X是个一个方阵,那么就是有12行12列
Private Sub Form_Load()
Show
A = Array(1, 2, 4, 5, 6, 7, 1, 2, 4, 5, 6, 7)
For i = 0 To 11
For j = 0 To 11
X(i, j) = Val(InputBox("请输入第" + Trim(i) + "行第" + Trim(j) + "列的数值:", "", Trim(i) + Trim(j)))
Print X(i, j);
Next j
Next i
For i = 0 To 11
For j = 0 To 11
Y(j, i) = A(j) * X(j, i)
Print Y(j, i)
Next j
Next i
End Sub
vb 建立矩阵
Private Sub Form_click()
Dim a(1 To 3, 1 To 3)
For i = 1 To 3
For j = 1 To 3
a(i, j) = j + 3 * (i - 1)
Print a(i, j);
Next
Next
End Sub
求助!用Vb.net编写两个矩阵相乘!
Public Shared Sub Main()
Dim a As Integer, b As Integer, c As Integer, d As Integer
Console.WriteLine("该程序将求出两个矩阵的积:")
Console.WriteLine("请指定矩阵A的行数:")
a = Integer.Parse(Console.ReadLine())
Console.WriteLine("请指定矩阵A的列数:")
b = Integer.Parse(Console.ReadLine())
Dim MatrixA As Integer(,) = New Integer(a - 1, b - 1) {}
For i As Integer = 0 To a - 1
For j As Integer = 0 To b - 1
Console.WriteLine("请输入矩阵A第{0}行第{1}列的值:", i + 1, j + 1)
MatrixA(i, j) = Integer.Parse(Console.ReadLine())
Next
Next
Console.WriteLine("矩阵A输入完毕.")
Console.WriteLine("请指定矩阵B的行数:")
c = Integer.Parse(Console.ReadLine())
Console.WriteLine("请指定矩阵B的列数:")
d = Integer.Parse(Console.ReadLine())
Dim MatrixB As Integer(,) = New Integer(c - 1, d - 1) {}
For i As Integer = 0 To c - 1
For j As Integer = 0 To d - 1
Console.WriteLine("请输入矩阵A第{0}行第{1}列的值:", i + 1, j + 1)
MatrixB(i, j) = Integer.Parse(Console.ReadLine())
Next
Next
Console.WriteLine("矩阵B输入完毕.")
Console.WriteLine("矩阵A为:")
outputMatrix(MatrixA, a, b)
Console.WriteLine("矩阵B为:")
outputMatrix(MatrixB, c, d)
If b c Then
Console.WriteLine("矩阵A的列数与矩阵B的行数不相等,无法进行乘积运算!")
Return
Else
Console.WriteLine("矩阵A与矩阵B的乘积为:")
End If
Dim MatrixC As Integer(,) = New Integer(a - 1, d - 1) {}
For i As Integer = 0 To a - 1
For j As Integer = 0 To d - 1
MatrixC(i, j) = 0
For k As Integer = 0 To b - 1
MatrixC(i, j) += MatrixA(i, k) * MatrixB(k, j)
Next
Next
Next
outputMatrix(MatrixC, a, d)
End Sub
Private Shared Sub outputMatrix(MatrixX As Integer(,), rowCount As Integer, columnCount As Integer)
For i As Integer = 0 To rowCount - 1
For j As Integer = 0 To columnCount - 1
Console.Write(MatrixX(i, j) vbTab)
Next
Console.WriteLine()
Next
End Sub
End Class
文章标题:vb.net如何输入矩阵,vb矩阵乘法
分享链接:http://cdiso.cn/article/dscgsdc.html