f[x_] = x^4; a = -1; b = 1; L = 1; gr = Plot[f[x], {x, a, b}, PlotRange -> {{a, b}, {-0.2, 1}}, PlotStyle -> {Hue[0.02], Thickness[0.007]}];a0 = 1/L \!\(\*SubsuperscriptBox[\(\[Integral]\), \(-1\), \(1\)]\(f[ x] \[DifferentialD]x\)\);a[n_] = 1/L \!\(\*SubsuperscriptBox[\(\[Integral]\), \(-1\), \(1\)]\(f[x]*Cos[\*FractionBox[\(n*\[Pi]\), \(L\)]*x] \[DifferentialD]x\)\);b[n_] = 1/L \!\(\*SubsuperscriptBox[\(\[Integral]\), \(-1\), \(1\)]\(f[x]*Sin[\*FractionBox[\(n*\[Pi]\), \(L\)]*x] \[DifferentialD]x\)\);\[CapitalPhi][x, k] = a0/2 + \!\(\*UnderoverscriptBox[\(\[Sum]\), \(n = 1\), \(k\)]\((a[n]*Cos[\*FractionBox[\(n*\[Pi]*x\), \(L\)]] + b[n]*Sin[\*FractionBox[\(n*\[Pi]*x\), \(L\)]])\)\) // N;\[CapitalPhi]1 = a0/2 + \!\(\*UnderoverscriptBox[\(\[Sum]\), \(n = 1\), \(1\)]\((a[n]*Cos[\*FractionBox[\(n*\[Pi]*x\), \(L\)]] + b[n]*Sin[\*FractionBox[\(n*\[Pi]*x\), \(L\)]])\)\) // N;gr1 = Plot[\[CapitalPhi]1, {x, a, b}, PlotStyle -> {Hue[0.1], Dashing[{0.03}], Thickness[0.01]}]
I'm a beginner, I was given a lab, I copied exactly the code from the picture that the teacher sent us, but my code does not work like his. Unfortunately, I can't ask him about my mistake, so I'm asking here