尝试在这里解决这个问题:微分方程的绘图方向场
dy/dx=sin(x^2+y^2)log(|x+y|) when -1<x,y<1.如果你将所有相同长度的曲线图的间隔,你将有完整的评分。将轴网设置为20 X 20。
下面是我的非工作代码:
StreamPlot[{1, (Sin[y^2+x^2]*Log[Abs[x+y]])}, {x, -10, 10}, {y, -10, 10}, RegionFunction->Function[{x,y}, {{-1<x<1}&&{-1<y<1}}]]无法理解Wolfram语法。任何建议都非常感谢!
发布于 2017-11-27 15:16:41
我不确定能理解你问的所有问题。如果您的目标是使用包含20x20=400点的栅格绘制方向场,一种可能的方法是:
grid = Range[-1, 1, 2/19]
points = Apply[Join, Outer[{#1, #2} &, grid, grid]];
VectorPlot[{1, (Sin[y^2 + x^2]*Log[Abs[x + y]])},
{x, -1, 1}, {y, -1, 1},
VectorPoints -> points,
GridLines -> {grid, grid}]length=20的grid是:
{-1, -(17/19), -(15/19), -(13/19), -(11/19), -(9/19), -(7/19), -(5/19),
-(3/19), -(1/19), 1/19, 3/19, 5/19, 7/19, 9/19, 11/19, 13/19, 15/19,
17/19, 1}points是网格笛卡尔产品:
{{-1, -1}, {-1, -(17/19)}, {-1, -(15/19)}, {-1, -(13/19)}, ...}对points的每个点计算ODE‘= f(x,y)的向量(1,f(x,y))。生成的曲线图为:

下面是关于Mathematica语法和你的问题的一些澄清:
RegionFunction选项允许您在某些指定的区域中绘图。例如,您可以限制要在单位磁盘中绘制的矢量场:
VectorPlot[{1, (Sin[y^2 + x^2]*Log[Abs[x + y]])},
{x, -1, 1}, {y, -1, 1},
VectorPoints -> points, GridLines -> {grid, grid},
RegionFunction -> Function[{x, y}, x^2 + y^2 < 1]]

您的代码无法工作是因为您的布尔表达式(纯函数的主体部分):
Function[{x, y}, {{-1<x<1}&&{-1<y<1}}]不遵守Mathematica语法。
编写它的数学方法是:
Function[{x, y}, (-1<x<1)&&(-1<y<1)]https://stackoverflow.com/questions/47504339
复制相似问题