再麻烦你个mathematica的问题!
a[n_]:=(Integrate[-Cos[nx],{x,-Pi,0}]+Integrate[Cos[nx],{x,0,Pi}])/Pi;b[n_]:=(Integra...
a[n_] := (Integrate[-Cos[n x], {x, -Pi, 0}] +
Integrate[Cos[n x], {x, 0, Pi}])/Pi;
b[n_] := (Integrate[-Sin[n x], {x, -Pi, 0}] +
Integrate[Sin[n x], {x, 0, Pi}])/Pi;
s[x_, n_] := a[0]/2 + Sum[a[k] Cos[k x] + b[k] Sin[k x], {k, 1, n}];
m = 18;
For[i = 1, i <= m, i += 2,
Print[Plot[Evaluate[s[x, i]], {x, -2 Pi, 2 Pi},
DisplayFunction -> Identity]]]
这段代码哪里出错了? 展开
Integrate[Cos[n x], {x, 0, Pi}])/Pi;
b[n_] := (Integrate[-Sin[n x], {x, -Pi, 0}] +
Integrate[Sin[n x], {x, 0, Pi}])/Pi;
s[x_, n_] := a[0]/2 + Sum[a[k] Cos[k x] + b[k] Sin[k x], {k, 1, n}];
m = 18;
For[i = 1, i <= m, i += 2,
Print[Plot[Evaluate[s[x, i]], {x, -2 Pi, 2 Pi},
DisplayFunction -> Identity]]]
这段代码哪里出错了? 展开
2个回答
展开全部
没错啊,在我这里能正常运行的么
更多追问追答
追问
运行后提示:
SetDelayed::write: Tag List in {Sin[1],Sin[1/2],Sin[1/3],Sin[1/7]}[n_] is Protected. >>
Integrate::ilim: Invalid integration variable or limit(s) in {2.,-\[Pi],0}. >>
NIntegrate::itraw: Raw object 1.9999997142857142` cannot be used as an iterator. >>
General::stop: Further output of Integrate::ilim will be suppressed during this calculation. >>
追答
我用的是8.0.4的,你用4.0的我拿你没办法呀
来自:求助得到的回答
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询