I am trying to calculate a two point Gaussian Quadrature on the interval [0,4] and the function f_n = (x^n) + 2 x - 3 for n = {4, 5, 6}. I want to compare the results I get using Gaussian quadrature done out versus the built in. This is what I have so far but for some reason my f keeps printing in my answer despite being defined.
a = 0;
b = 4;
f[x_] = x^n + 2 x - 3;
n = {4, 5, 6};
Subscript[c, 1] = Abs[b - a]/2
Subscript[c, 2] = Abs[b - a]/2
Subscript[x, 1] = (b - a)/2 (-1/Sqrt[3]) + (b + a)/2
Subscript[x, 2] = (b - a)/2 (1/Sqrt[3]) + (b + a)/2
(*\!\(
\*SubsuperscriptBox[\(\[Integral]\), \(a\), \(b\)]\(f\((x)\)\
\[DifferentialD]x\)\) \[Equal] Subscript[c, 1] f(Subscript[x, \
1])+Subscript[c, 2] f(Subscript[x, 2])*)
\!\(
\*SubsuperscriptBox[\(\[Integral]\), \(a\), \(b\)]\(f \((x)\) \
\[DifferentialD]x\)\)
Subscript[c, 1] f (Subscript[x, 1]) +
Subscript[c, 2] f (Subscript[x, 2])
Subscript[c, 1] f (Subscript[x, 1]) + Subscript[c, 2] f (Subscript[x, 2])toSubscript[c, 1] f[Subscript[x, 1]]+ Subscript[c, 2] f[Subscript[x, 2]]– Bill Dec 25 '19 at 22:41Integrate[f*x, {x, a, b}], notIntegrate[f[x], {x, a, b}], which is probably what you want. – m_goldberg Dec 26 '19 at 16:23