Wolfram mathematica 无法绘图

Wolfram mathematica 无法绘图,wolfram-mathematica,Wolfram Mathematica,在Mathematica中,我有一个绘制方程组解的问题。我的等式系统有两个变量(s12和t)。不可能显式地求解它(s12:=f(t)),但我能够得到每个正t的解。但我想要的是一个在x轴上有t,在y轴上有s12(t)的图 我最好的理由是,因为我得到的是带有注释的单一解决方案 “*Solve::ratnz:Solve无法求解系数不精确的系统。答案是通过求解相应的精确系统并对结果进行数值计算得出的。*“这不适用于mathematica的无限解。” 我可能不得不对这个警告感到惊讶,或者有人有其他想法吗?

在Mathematica中,我有一个绘制方程组解的问题。我的等式系统有两个变量(s12和t)。不可能显式地求解它(s12:=f(t)),但我能够得到每个正t的解。但我想要的是一个在x轴上有t,在y轴上有s12(t)的图

我最好的理由是,因为我得到的是带有注释的单一解决方案 “
*Solve::ratnz:Solve无法求解系数不精确的系统。答案是通过求解相应的精确系统并对结果进行数值计算得出的。*
“这不适用于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}]
"*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""*
如前所述,当我使用特定的t时,我会得到一个解决方案,否则我会收到如下消息:

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}]
"*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""*
非常感谢你的帮助,
Andreas

该系统有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}]

该系统有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}]
需要补充的重要事实:

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

不过,有一种解决方案是只使用实数。由于Mathematica无法用实数“连续方式”求解等式,因此我最终采用了三步方法:

  • 我在离散的时间点上解出了方程
  • 我用ListLinePlot绘制了解决方案
  • 我使用插值[]允许粗略检测与其他曲线的插入

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

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

    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;
    
    希望这有助于添加以下重要事实:

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

    不过,有一种解决方案是只使用实数。由于Mathematica无法用实数“连续方式”求解等式,因此我最终采用了三步方法:

  • 我在离散的时间点上解出了方程
  • 我用ListLinePlot绘制了解决方案
  • 我使用插值[]允许粗略检测与其他曲线的插入

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

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

    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;
    

    希望这有帮助

    非常感谢,它很有效。尽管如此,我还是有点惊讶为什么我要这样安排。您是否看到选择特定曲线的可能性,例如[[1]]?@user1426522
    Plot[s12/.s2[[1]],{t,0,57}]
    @user1426522问题不在于重新排序,而在于删除
    “Reals”
    s12>0
    部分。Mma不知道这些条件是否满足,直到您指定
    t
    谢谢。这很有道理,帮助很大。为了让问题更复杂一点,我想提出一个后续问题。希望你也能帮我。z的当前值不正确。右边的值在600-900之间。当我增加z时,图形中的“三角形”变得越来越小,并将在某个值z处消失。当我输入正确的值时,没有图形显示,但是如果我为t插入离散的示范值,我会得到合理的结果。你有什么想法吗?非常感谢,Andreastanks非常感谢,很有效。尽管如此,我还是有点惊讶为什么我要这样安排。您是否看到选择特定曲线的可能性,例如[[1]]?@user1426522
    Plot[s12/.s2[[1]],{t,0,57}]
    @user1426522问题不在于重新排序,而在于删除
    “Reals”
    s12>0
    部分。Mma不知道这些条件是否满足,直到您指定
    t
    谢谢。这很有道理,帮助很大。为了让问题更复杂一点,我想提出一个后续问题。希望你也能帮我。z的当前值不正确。右边的值在600-900之间。当我增加z时,图形中的“三角形”变得越来越小,并将在某个值z处消失。当我输入正确的值时,没有图形显示,但是如果我为t插入离散的示范值,我会得到合理的结果。你有什么想法吗?非常感谢,安德烈亚斯