2

我有一个问题要在 Mathematica 中绘制一个 equotations 系统的解决方案。我的报价系统有两个变量(s12 和 t)。不可能明确地解决它(s12:=f(t)),但我能够为每个正 t 得到一个解决方案。但我想要的是在 x-achses 上带有 t 和在 y-achses 上带有 s12(t) 的图。

我最好的猜测是,因为我总是得到带有注释“ *Solve::ratnz: Solve was unable to solve the system with inexact coefficients. The answer was obtained by solving a corresponding exact system and numericizing the result*”的单一解决方案,这不适用于数学的无限解决方案。

我可能不得不取消这个警告,或者有人有其他想法吗?我只需要一个粗略的情节。

问题如下:

ClearAll["Global`*"];
cinv1 = 40;
cinv2 = 4;
cinv3 = 3;
h2 = 1.4;
h3 = 1.2;
alpha = 0.04;
z = 20;
p = 0.06;
cop1 = 0;
cop2 = 1;
cop3 = 1.5;
l2 = 0.1;
l3 = 0.17;
teta2 = 0.19;
teta3 = 0.1;
co2 = -0.1;

smax = 40;
c = 1;

Plot[Solve[{s12 == ((cinv1 - 
         cinv2) + ((cinv2 - cinv3)*((s12 teta2)/(
          Sqrt[ (teta2 - teta3)] Sqrt[
           c s12^2 teta2 - (2 alpha z)/c]))))/((1/(teta2 - 
           teta3))*((teta2*cop3 - teta3*cop2) + (teta2*h3*l3*E^(p*t) -
            teta3*h2*l2*E^(p*t)))), s12 > 0}, s12, Reals], {t, 0, 10}]

如前所述,当我使用特定的 t 时,我会得到一个解决方案,否则我会收到如下消息:

"*Solve::ratnz: Solve was unable to solve the system with inexact coefficients. The answer was obtained by solving a corresponding exact system and numericizing the result*"
"*Solve::ratnz: Solve was unable to solve the system with inexact coefficients. The answer was obtained by solving a corresponding exact system and numericizing the result*"
"*Solve::ratnz: Solve was unable to solve the system with inexact coefficients. The answer was obtained by solving a corresponding exact system and numericizing the result*"
*"General::stop: "Further output of \!\(\*
StyleBox[
RowBox[{\"Solve\", \"::\", \"ratnz\"}], \"MessageName\"]\) will be suppressed during this calculation""*

非常感谢您的帮助,安德烈亚斯

4

2 回答 2

0

系统有 4 个解,其中 3 个在感兴趣的范围内为正:

s2 = Solve[{s12 - ((cinv1 - cinv2) + ((cinv2 - cinv3) ((s12 teta2)/
          (Sqrt[(teta2 - teta3)] Sqrt[c s12^2 teta2 - (2 alpha z)/c]))))/
           ((1/(teta2 - teta3))*((teta2*cop3 - teta3*cop2) + 
           (teta2*h3*l3*E^(p*t) - teta3*h2*l2*E^(p*t))))} == 0, s12];
Plot[s12 /. s2 , {t, 0, 59}]

在此处输入图像描述

于 2012-05-31T09:01:15.507 回答
-1

要补充的重要事实:

上面提出的解决方案是正确的,但它使用复数来解决。上述解决方案中的图表仅显示了复数的实部。这可能会导致一些混乱,就像它对我一样。

不过,有一个只有实数的解决方案。由于 Mathematica 无法以“连续方式”用实数求解方程,所以我最后做了一个三步法:

  1. 我在离散的时间点解决了方程
  2. 我用 ListLinePlot 绘制了解决方案。
  3. 我使用 Interpolation[] 来粗略检测与其他曲线的交点

    a = Table[NSolve[{s12 - ((cinv1 - cinv2) + ((cinv2 - cinv3)*((s12 teta2)/(\[Sqrt] (teta2 - teta3) \[Sqrt](c s12^2 teta2 - (2 alpha z)/c)))))/ ((1/(teta2 - teta3))*((teta2*cop3 -teta3*cop2) + (teta2*h3*l3*E^(p*t) - teta3*h2*l2*E^(p*t)))) == 0}, s12][[1]], {t, 0, 100}];

    b = Table[t, {t, 0, 100}];

    f1a = s12 /. a;
    
    f1 = Transpose[{b, f1a}];
    
    ceiling1 = ListLinePlot[{f1},
    PlotRange -> {{0, 20}, {0, 40}},PlotStyle -> {Black, Dotted, Thickness[0.003]}];
    

在下一步中,我还需要找到以这种方式创建的多条曲线的交点。为了粗略估计,我做了以下工作:

curve1 = Interpolation[f1];
intersec2a = FindRoot[curve1[x2] - t12[x2, l2], {x2, 0}];
intersec2 = x2 /. intersec2a;

希望这可以帮助

于 2012-06-19T12:50:29.187 回答