声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 2405|回复: 5

[1stopt] 解非线性方程组问题。

[复制链接]
发表于 2008-1-15 10:02 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
初次使用1stopt,算一个四元二次方程组得解,方程式比较长,涉及的系数比较多,而且是表达式,我发现直接把表达式的值直接算出来代方程里面解出的解才是正确的,而每当我把系数表达式里的常系数用字母表示,具体值用constant给出时,计算出来的值居然不对。请教各位,若方程式里要计算的量太多时,会影响1stopt的性能吗?
还有个问题是,1stopt有VC接口吗?具体情况是:我的方程组里面的很多系数是来自前面的VC程序,而后面的程序也要继续用到方程组的解,我现在就是用很笨的方法,把解解出来后再人为设置VC程序里的参数。
先在此谢谢大家!!!
回复
分享到:

使用道具 举报

 楼主| 发表于 2008-1-15 10:04 | 显示全部楼层
Title "Type your title here";

//Variable ;
Constant theta1=41,theta2=40.9,A1=-11.35,A2=6.91,A3=22.57,A4=37.46,B1=42.20,B2=22.74,B3=7.14,B4=-7.13,D1=800.96,D2=800.96,D3=800.96,D4=800.96;
ConstStr  Section11=x5-B1*cos(theta2)-A1*cos(theta1),
          Section12=x5-B2*cos(theta2)-A2*cos(theta1),
          Section13=x5-B3*cos(theta2)-A3*cos(theta1),
          Section14=x5-B4*cos(theta2)-A4*cos(theta1),
         
          Section21=x4-x2+B1*sin(theta2)-A1*sin(theta1),
          Section22=x4-x2+B2*sin(theta2)-A2*sin(theta1),
          Section23=x4-x2+B3*sin(theta2)-A3*sin(theta1),
          Section24=x4-x2+B4*sin(theta2)-A4*sin(theta1),
         
          Section31=x4+x2+B1*sin(theta2)+A1*sin(theta1),
          Section32=x4+x2+B2*sin(theta2)+A2*sin(theta1),
          Section33=x4+x2+B3*sin(theta2)+A3*sin(theta1),
          Section34=x4+x2+B4*sin(theta2)+A4*sin(theta1),
         
          Section41=x2+A1*sin(theta1),
          Section42=x2+A2*sin(theta1),
          Section43=x2+A3*sin(theta1),
          Section44=x2+A4*sin(theta1);
         
Parameters x2[100,200],x4[100,200],x5[600,700];

Function (0.5*Section11+0.5*Section21*Section31/Section11-0.5*D1*Section21/Section11)^2+Section41^2-D1*Section41;
         (0.5*Section12+0.5*Section22*Section32/Section12-0.5*D2*Section22/Section12)^2+Section42^2-D2*Section42;
         (0.5*Section13+0.5*Section23*Section33/Section13-0.5*D3*Section23/Section13)^2+Section43^2-D3*Section43;
         (0.5*Section14+0.5*Section24*Section34/Section14-0.5*D4*Section24/Section14)^2+Section44^2-D4*Section44;
 楼主| 发表于 2008-1-15 10:08 | 显示全部楼层
ps: 当然方程组里面是3个未知数,x5是一个合成的未知数(这里不是指x2,x4),以前经验得出用四个方程解出的解更合理。
 楼主| 发表于 2008-1-15 10:10 | 显示全部楼层
以上程序得不出合理的解,而我每次把section里面的具体值算出来后代入方程组里才得到合理解。
发表于 2008-1-15 15:44 | 显示全部楼层
发表于 2008-1-15 17:41 | 显示全部楼层
运行了一下代码,没发行有什么问题啊!只是三个未知数却是四个方程,属超越方程,无法得到为0的实数解。如果任取其中三个方程,就都可以得到实数解。

最新版可以和C++、Fortran等混编。
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-5-20 02:56 , Processed in 0.117560 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表