Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wolfram mathematica 简单-绘制函数_Wolfram Mathematica - Fatal编程技术网

Wolfram mathematica 简单-绘制函数

Wolfram mathematica 简单-绘制函数,wolfram-mathematica,Wolfram Mathematica,为什么这不是阴谋 Clear[x, b] b = 2 f[x_] := b^x Plot[f[x], {x, 1, 5}] 该图只生成一个空图形。在Mathematica 8中,该图对我来说很好 但是需要注意的是,您并不真正想在这里的函数声明中执行:=操作。 :=推迟mathematica对函数的求值,直到函数实际被调用,然后使用给定的参数进行求值 基本上,我使用的规则是,如果我没有理由使用:=,我就不使用它 祝你好运 编辑 我只是注意到你没有清除f,这可能是你的问题。试试这个: Clea

为什么这不是阴谋

Clear[x, b]
b = 2
f[x_] := b^x 

Plot[f[x], {x, 1, 5}]

该图只生成一个空图形。

在Mathematica 8中,该图对我来说很好

但是需要注意的是,您并不真正想在这里的函数声明中执行:=操作。 :=推迟mathematica对函数的求值,直到函数实际被调用,然后使用给定的参数进行求值

基本上,我使用的规则是,如果我没有理由使用:=,我就不使用它

祝你好运

编辑 我只是注意到你没有清除f,这可能是你的问题。

试试这个:

ClearAll[f, b];
b = 2;
f[x_] := b^x

Plot[f[x], {x, 1, 5}]

以获得更好、可能更快的答案。@Lion。如果复制警察和连环收银员不让你。。。