1樓:匿名使用者
option explicit
private sub command1_click()
text1.text = ""
text2.text = ""
dim i as integer
for i = 1 to 24
text1.text = text1 & int(rnd * 90) + 10 & " "
if i mod 4 = 0 then text1.text = text1.text & vbcrlf & vbcrlf
next
end sub
private sub command2_click()
dim a, b, c as integer, d as integer
a = split(text1.text, vbcrlf & vbcrlf)
for c = 0 to 3
for d = 0 to 5
b = split(a(d))
text2.text = text2.text & b(c) & " "
next
text2.text = text2.text & vbcrlf & vbcrlf
next
end sub
private sub form_load()
text1.text = ""
text2.text = ""
end sub
2樓:蝴蝶飛飛
dim a(6, 6) as integer, i as integer, ii as integer
private sub command1_click()for i = 1 to 6
for ii = 1 to 4
a(i, ii) = int(rnd * 90 + 10)next ii
next i
for i = 1 to 6
for ii = 1 to 4
picture1.print a(i, ii);
next ii
picture1.print ""
next i
end sub
private sub command2_click()for ii = 1 to 4
for i = 1 to 6
picture2.print a(i, ii);
next i
picture2.print
next ii
end sub
vb。求矩陣的轉置矩陣
3樓:鄧白
private sub command1_click()randomize timer
dim n as integer, m as integerdim arr1() as integer, arr2() as integer
dim i as integer, j as integern = inputbox("請輸入矩陣的行數")m = inputbox("請輸入矩陣的列數")redim arr1(1 to n, 1 to m), arr2(1 to m, 1 to n)
for i = 1 to n
for j = 1 to m
arr1(i, j) = int(rnd * 10)print arr1(i, j);
next
next
for i = 1 to m
for j = 1 to n
arr2(i, j) = arr1(j, i)print arr2(i, j);
next
next
end sub
vb程式設計,應用二維陣列產生隨機矩陣5*5,並實現矩陣的轉置。
4樓:珈藍惜夢
vb源程式如下:option base 1
private sub command1_click()dim a(5, 5) as integer, b(5, 5) as integer
for x = 1 to 5
for y = 1 to 5
a(x, y) = int(10 + rnd * 90) '隨機產生兩位數的整數
print a(x, y); '輸出
next
next
for x = 1 to 5
for y = 1 to 5
b(x, y) = a(y, x) '轉置print b(x, y); '輸出
next
next
end sub
程式輸出結果如下:
擴充套件資料:vb:編寫程式,實現如下規律的5*5矩陣存入陣列,並輸出該陣列private sub command1_click()dim a(1 to 6, 1 to 6) as integerfor i = 1 to 5
for j = 1 to 5
tmp = 99
if i < tmp then
tmp = i
end if
if j < tmp then
tmp = j
end if
if 6 - i < tmp then
tmp = 6 - i
end if
if 6 - j < tmp then
tmp = 6 - j
end if
a(i, j) = tmp
next j
next i
for i = 1 to 5
for j = 1 to 5
picture1.print tab(j * 5); a(i, j);
next j
picture1.print
next i
end sub
程式輸出結果如下:
5樓:會飛滴包子
option base 1
private sub command1_click()dim a(5, 5) as integer, b(5, 5) as integer
for x = 1 to 5
for y = 1 to 5
a(x, y) = int(10 + rnd * 90) '隨機產生兩位數的整數
print a(x, y); '輸出
next
next
for x = 1 to 5
for y = 1 to 5
b(x, y) = a(y, x) '轉置print b(x, y); '輸出
next
next
end sub
編寫vb程式,實現矩陣轉置,即將一個nⅹm的矩陣的行和列互換。
6樓:匿名使用者
private sub command1_click()randomize timerdim n as integer,m as integerdim arr1() as integer,arr2() as integerdim i as integer,j as integern = inputbox("請輸入矩陣的行數")m = inputbox("請輸入矩陣的列...
7樓:匿名使用者
private sub form_click()
dim n, m, i, j, matrix(), cache() as integer
n = cint(inputbox("請輸入矩陣行數n", "矩陣置換"))
m = cint(inputbox("請輸入矩陣列數m", "矩陣置換"))
redim matrix(n - 1, m - 1)
redim cache(m - 1, n - 1)
'錄入for i = 0 to n - 1
for j = 0 to m - 1
matrix(i, j) = cint(inputbox("請輸入矩陣項(" & (i + 1) & "," & (j + 1) & ")", "矩陣置換"))
next
next
'轉置for i = 0 to n - 1
for j = 0 to m - 1
cache(j, i) = matrix(i, j)
next
next
'輸出轉置前的矩陣
print "轉置前的矩陣為:"
for i = 0 to n - 1
for j = 0 to m - 1
print matrix(i, j);
next
next
'輸出轉置後的矩陣
print "轉置後的矩陣為:"
for i = 0 to m - 1
for j = 0 to n - 1
print cache(i, j);
next
next
end sub
8樓:指尖遊戲
dim a() as integer, b() as integerdim m as integer, n as integer, s as string
m = 3 '定義m值
n = 4 '定義n值
redim a(m * n - 1) '重定義陣列a大小for i = 1 to m * n
a(i - 1) = i '給陣列a賦值next
s = ""
for i = 0 to ubound(a)s = s & " " & a(i)
if (i + 1) mod m = 0 thenprint s '列印陣列a矩形排列s = ""
end if
next
print vbcrlf
redim b(ubound(a)) '重定義陣列b大小for i = 0 to ubound(b)b(i) = a((i mod n) * m + i \ n) '將a陣列的矩形重新排列賦值給b陣列
next
s = ""
for i = 0 to ubound(b)s = s & " " & b(i)
if (i + 1) mod n = 0 thenprint s '以矩形方式排列並且列印b陣列s = ""
end if
next
9樓:home若夕陽西下
private sub command1_click()dim a#(), n1#, n2#, i#, j#n1 = text1.text: n2 = text2.
textredim a(1 to n1, 1 to n2)redim b(1 to n2, 1 to n1)texttoarray text3, a
for i = 1 to n1
for j = 1 to n2
b(j, i) = a(i, j)
next
next
arraytotext b, text4
end sub
我也給難住了,在網上找了半天無果後,自己做出來了。。。。
雖然對你來說有點晚(n1,n2就是m,n),希望對別人有幫助吧
複數矩陣為什麼要取共軛轉置而不直接取轉置?或者說兩者的應用範圍有什麼不同
對於復矩陣而言共軛轉置確實比單純的轉置更為常用,其原因主要來自於對內積的需求 先看c n空間,x ty是一個雙線性形式,不構成內積,而x hy才構成內積.進一步,看線性運算元的伴隨,容易驗證伴隨運算元的矩陣表示恰好是一個轉置共軛.這些都是由內積空間的公理自然決定的.所以與幾何相關的概念經常會採用共軛...
兩矩陣轉置後相乘與相乘後轉置是否相等
兩矩陣轉置bai後相乘與相乘後du轉置不相 等。證zhi明如下 把矩陣a的行換成相dao應的列,得到的新內矩陣稱容 為a的轉置矩陣,記作a t或a 根據基本性質 a b a b a b b a a a a a det a det a 所以轉置後相乘和相乘後轉置,也就是 a b 和a b 一般是不相等...
怎麼證明a乘以a的轉置矩陣是對稱
根據對稱矩陣的定義來證明。規定,用a 表示矩陣a的轉置矩陣,首先說明,對稱專矩陣的定屬義,即n階方陣a,當僅當滿足a a時,a稱為對稱矩陣.其次,需要用到一個矩陣乘法和矩陣轉置相關的一個性質,即 ab b a 現在來表述題目,設a為矩陣,那麼必有矩陣a與其轉置矩陣a 的乘積為對稱矩陣,即aa 為對稱...