2

Mathematica で方程式系の解をプロットするのに問題があります. 私の方程式系には 2 つの変数 (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*" で常に単一のソリューションを取得するため、これは mathematica の無限ソリューションでは機能しないということです。

私はこの警告を抑制しなければならないかもしれませんか、それとも誰か別の考えがありますか? 大まかなプロットだけが必要です。

問題は次のとおりです。

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は実数で「連続的な方法」で引用を解くことができないので、私はついに3段階のアプローチをしました:

  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 に答える