题目
数学题在线解4元一次方程
提问时间:2020-12-03
答案
方程:
a1x1+b1x2+c1x3+d1x4=e1
a2x1+b2x2+c2x3+d2x4=e2
a3x1+b3x2+c3x3+d3x4=e3
x1、x2、x3、x4为未知数,取值为0-9000范围内整数,其他全部为常数
现在要求用vb进行求解,求出最优的x1、x2、x3、x4值,即假设:
a1x1+b1x2+c1x3+d1x4值为s1
a2x1+b2x2+c2x3+d2x4值为s2
a3x1+b3x2+c3x3+d3x4值为s3
(s1-e1)*(s1-e1)+(s2-e2)*(s2-e2)+(s3-e3)*(s3-e3)的值最小
VB最原始的方法代码为:
VB code
m1 = -1:m2 = -1:m3 = -1:m4 = -1
aaa = -1
For n1 = 0 To 9000
For n2 = 0 To 9000
For n3 = 0 To 9000
For n4 = 0 To 9000
s1 = a1 * n1 + b1 * n2 + c1 * n3 + d1 * n4
s2 = a2 * n1 + b2 * n2 + c2 * n3 + d2 * n4
s3 = a3 * n1 + b3 * n2 + c3 * n3 + d3 * n4
If aaa = -1 Then
m1 = n1:m2 = n2:m3 = n3:m4 = n4
aaa = (s1 - e1) * (s1 - e1) + (s2 - e2) * (s2 - e2) + (s3 - e3) * (s3 - e3)
Else
If aaa < (s1 - e1) * (s1 - e1) + (s2 - e2) * (s2 - e2) + (s3 - e3) * (s3 - e3) Then
m1 = n1:m2 = n2:m3 = n3:m4 = n4
aaa = (s1 - e1) * (s1 - e1) + (s2 - e2) * (s2 - e2) + (s3 - e3) * (s3 - e3)
End If
End If
Next
Next
Next
Next
MsgBox "最优解为:" + Trim(m1) + "," + Trim(m2) + "," + Trim(m3) + "," + Trim(m4)
a1x1+b1x2+c1x3+d1x4=e1
a2x1+b2x2+c2x3+d2x4=e2
a3x1+b3x2+c3x3+d3x4=e3
x1、x2、x3、x4为未知数,取值为0-9000范围内整数,其他全部为常数
现在要求用vb进行求解,求出最优的x1、x2、x3、x4值,即假设:
a1x1+b1x2+c1x3+d1x4值为s1
a2x1+b2x2+c2x3+d2x4值为s2
a3x1+b3x2+c3x3+d3x4值为s3
(s1-e1)*(s1-e1)+(s2-e2)*(s2-e2)+(s3-e3)*(s3-e3)的值最小
VB最原始的方法代码为:
VB code
m1 = -1:m2 = -1:m3 = -1:m4 = -1
aaa = -1
For n1 = 0 To 9000
For n2 = 0 To 9000
For n3 = 0 To 9000
For n4 = 0 To 9000
s1 = a1 * n1 + b1 * n2 + c1 * n3 + d1 * n4
s2 = a2 * n1 + b2 * n2 + c2 * n3 + d2 * n4
s3 = a3 * n1 + b3 * n2 + c3 * n3 + d3 * n4
If aaa = -1 Then
m1 = n1:m2 = n2:m3 = n3:m4 = n4
aaa = (s1 - e1) * (s1 - e1) + (s2 - e2) * (s2 - e2) + (s3 - e3) * (s3 - e3)
Else
If aaa < (s1 - e1) * (s1 - e1) + (s2 - e2) * (s2 - e2) + (s3 - e3) * (s3 - e3) Then
m1 = n1:m2 = n2:m3 = n3:m4 = n4
aaa = (s1 - e1) * (s1 - e1) + (s2 - e2) * (s2 - e2) + (s3 - e3) * (s3 - e3)
End If
End If
Next
Next
Next
Next
MsgBox "最优解为:" + Trim(m1) + "," + Trim(m2) + "," + Trim(m3) + "," + Trim(m4)
举一反三
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
1,人们染上烟瘾,最终因吸烟使自己丧命.
最新试题
- 1其岸势犬牙差互,不可知其源 你能联想到哪个成语?
- 21、小王辰跑3分之2分钟跑了200米,照这样的速读度,她15分钟可以跑多少米...2、小刚骑自行车没分行驶4分之一km.从A到b地,共25km,小刚骑自行车去要花几小时...
- 3镁 硫 碳 红磷 燃烧时哪个不完全生成氧化物
- 4outstanding share和 share outstanding有何区别?
- 5电解质溶液的导电过程在两个电极上发生氧化还原反应
- 6市场饱和度的定义是什么怎么计算
- 7电位器100kA什么意思
- 8用“have,what,do,on,you,Saturday”连成一个句子
- 9三个英语单词首字母是t,最后一个字母是r
- 10化简,然后求值4x-2(x-3)-3[x-3(4-2x)+8],其中x=19分之18
热门考点