求解和优化多项式样条

时间:2019-02-14 08:48:49

标签: optimization wolfram-mathematica spline

首先,我要感谢Mathematica社区。

我有一个像这样的系统:

public class MyController{

MyController(IHostingEnvironment env){

var path = env.ContentRootPath;
var myTemplatePath = path + "/Helpers/Email/Templates/template.html"

}

}

我该如何解决s(x)= -2035.5111 + 561.33713 x -51.262777 x^2 + 1.5534175 x^3 x in [10, 11] -2035.5111 + 561.33713 x - 51.262777 x^2 + 1.5534175 x^3 x in [11, 12] 7158.3214 - 1737.121 x + 140.2754 x^2 - 3.7670874 x^3 x in [12, 13] -11037.276 + 2461.863 x - 182.72337 x^2 + 4.5149323 x^3 x in [13, 14] 9375.4483 - 1912.2922 x + 129.71629 x^2 - 2.9241071 x^3 x in [14, 15] -38343.961 + 7035.097 x - 429.49554 x^2 + 8.7261392 x^3 x in [15, 16] 45546.119 - 7769.0348 x + 441.33575 x^2 - 8.348984 x^3 x in [16, 17] -24547.41 + 3913.2201 x - 207.67842 x^2 + 3.6697968 x^3 x in [17, 18] -24547.41 + 3913.2201 x - 207.67842 x^2 + 3.6697968 x^3 x in [18, 19] m <= s(x) <= M不为空且为实的系统m

1 个答案:

答案 0 :(得分:0)

您可以做到

With[{m=4.5,M=5},
Map[Reduce[#,x]&,
{m<=-2035.5111 + 561.33713 x -51.262777 x^2 + 1.5534175 x^3<=M && 10<=x<=11,
 m<=-2035.5111 + 561.33713 x - 51.262777 x^2 + 1.5534175 x^3<=M && 11<=x<=12,
 m<=7158.3214 - 1737.121 x + 140.2754 x^2 - 3.7670874 x^3<=M && 12<=x<=13,
 m<=-11037.276 +  2461.863 x - 182.72337 x^2 + 4.5149323 x^3<=M && 13<=x<=14,
 m<=9375.4483 - 1912.2922 x + 129.71629 x^2 - 2.9241071 x^3<=M && 14<=x<=15,
 m<=-38343.961 + 7035.097 x - 429.49554 x^2 + 8.7261392 x^3<=M && 15<=x<=16,
 m<=45546.119 - 7769.0348 x + 441.33575 x^2 - 8.348984 x^3<=M && 16<=x<=17,
 m<=-24547.41 + 3913.2201 x - 207.67842 x^2 + 3.6697968 x^3<=M && 17<=x<=18,
 m<=-24547.41 + 3913.2201 x - 207.67842 x^2 + 3.6697968 x^3<=M && 18<=x<=19}
]]

这将为您提供

{x == 10. || 10.554622537850287<=x<=10.799264882501637,
 False,
 12.437932301023451<=x<=12.565380177021947,
 13.489415750912576<=x<=13.655683693607168,
 14.254978447526584<=x<=14.383489034636659,
 15.243856830113526<=x<=15.265292288384687,
 16.544981470615802<=x<=16.568935210200074,
 17.897288052000384<=x<=18.,
 18.<=x<=18.00034993487379 || 18.49992074750174<=x<=18.64596353629056}

其中的每一行对应于s(x)中具有相应方程式的零个或多个解。

您可以将该解决方案与此图进行比较

Show[
Plot[Piecewise[{
{-2035.5111 + 561.33713 x -51.262777 x^2 + 1.5534175 x^3,10<=x<=11},
{ -2035.5111 + 561.33713 x - 51.262777 x^2 + 1.5534175 x^3,11<=x<=12},
{ 7158.3214 - 1737.121 x + 140.2754 x^2 - 3.7670874 x^3,12<=x<=13},
{ -11037.276 +  2461.863 x - 182.72337 x^2 + 4.5149323 x^3,13<=x<=14},
{ 9375.4483 - 1912.2922 x + 129.71629 x^2 - 2.9241071 x^3,14<=x<=15},
{ -38343.961 + 7035.097 x - 429.49554 x^2 + 8.7261392 x^3,15<=x<=16},
{ 45546.119 - 7769.0348 x + 441.33575 x^2 - 8.348984 x^3,16<=x<=17},
{ -24547.41 + 3913.2201 x - 207.67842 x^2 + 3.6697968 x^3,17<=x<=18},
{ -24547.41 + 3913.2201 x - 207.67842 x^2 + 3.6697968 x^3,18<=x<=19}}],{x,10,19}],
Plot[{4.5,5},{x,10,19}]
]

并查看y == 4.5和y == 5之间的线段,似乎很匹配。

根据您要执行的操作,可以通过将Or@@放在With前面并合并诸如

之类的替代方法,将所有这些变成单个析取
17.897288052000384 <= x <= 18. || 18. <= x <= 18.00034993487379

进入

17.897288052000384 <= x <= 18.00034993487379

使用模式匹配替换。

这确实显示了有关Reduce的消息,需要将十进制数字转换为有理数才能使用适当的算法,但是,如果只有这些消息,那么可以安全地接受这些消息。所有消息都应仔细观察。

请仔细检查您的实际m和M,以确保这是正确的。