You are on page 1of 4

octave:24> syms n x;

f(x) = 3*(pi-x)^2 ;

a0 = (int(f(x), 0, pi))/(2/pi)

a = (int(f(x)*cos(n*x), 0, pi))/(2/pi);

an = subs(a, [sin(pi*n), sin(2*pi*n), cos(pi*n), cos(2*pi*n)], [0, 0, (-1)^n, 1])

warning: passing floating-point values to sym is dangerous, see "help sym"

warning: called from

double_to_sym_heuristic at line 50 column 7

sym at line 379 column 13

mrdivide at line 79 column 5

a0 = (sym)

5374⋅π

───────

1089

warning: passing floating-point values to sym is dangerous, see "help sym"

warning: called from

double_to_sym_heuristic at line 50 column 7

sym at line 379 column 13

mrdivide at line 79 column 5

warning: passing floating-point values to sym is dangerous, see "help sym"

warning: called from

double_to_sym_heuristic at line 50 column 7

sym at line 379 column 13

mtimes at line 63 column 5

warning: passing floating-point values to sym is dangerous, see "help sym"

warning: called from

double_to_sym_heuristic at line 50 column 7

sym at line 379 column 13

mtimes at line 63 column 5

an = (sym)

⎛⎧6⋅π ⎞

⎜⎪─── for n > -∞ ∧ n < ∞ ∧ n ≠ 0⎟

⎜⎪ 2 ⎟

5374⋅⎜⎨ n ⎟

⎜⎪ ⎟

⎜⎪ 3 ⎟

⎝⎩π otherwise ⎠

───────────────────────────────────────

1089⋅π

octave:29> syms n x;

f(x) = (pi+x)^2 ;

a0 = (int(f(x), 0, pi))/(2/pi)

a = (int(f(x)*cos(n*x), 0, pi))/(2/pi);

an = subs(a, [sin(pi*n), sin(2*pi*n), cos(pi*n), cos(2*pi*n)], [0, 0, (-1)^n, 1])

warning: passing floating-point values to sym is dangerous, see "help sym"

warning: called from

double_to_sym_heuristic at line 50 column 7

sym at line 379 column 13

mrdivide at line 79 column 5

a0 = (sym)

37618⋅π

────────

3267

warning: passing floating-point values to sym is dangerous, see "help sym"

warning: called from

double_to_sym_heuristic at line 50 column 7

sym at line 379 column 13

mrdivide at line 79 column 5

warning: passing floating-point values to sym is dangerous, see "help sym"

warning: called from

double_to_sym_heuristic at line 50 column 7

sym at line 379 column 13

mtimes at line 63 column 5

warning: passing floating-point values to sym is dangerous, see "help sym"

warning: called from

double_to_sym_heuristic at line 50 column 7

sym at line 379 column 13

mtimes at line 63 column 5

an = (sym)

⎛⎧ n ⎞

⎜⎪4⋅(-1) ⋅π 2⋅π ⎟

⎜⎪───────── - ─── for n > -∞ ∧ n < ∞ ∧ n ≠ 0⎟

⎜⎪ 2 2 ⎟

⎜⎪ n n ⎟

5374⋅⎜⎨ ⎟

⎜⎪ 3 ⎟

⎜⎪ 7⋅π ⎟

⎜⎪ ──── otherwise ⎟

⎜⎪ 3 ⎟

⎝⎩ ⎠

───────────────────────────────────────────────────

1089⋅π

octave:34> syms n x;

f(x) = 5(pi-x) ;

a0 = (int(f(x), 0, pi))/(2/pi)

a = (int(f(x)*cos(n*x), 0, pi))/(2/pi);

an = subs(a, [sin(pi*n), sin(2*pi*n), cos(pi*n), cos(2*pi*n)], [0, 0, (-1)^n, 1])

error: subscript indices must be integers or boolean

error: called from

subsindex at line 64 column 5

warning: passing floating-point values to sym is dangerous, see "help sym"

warning: called from

double_to_sym_heuristic at line 50 column 7

sym at line 379 column 13

mrdivide at line 79 column 5

a0 = (sym)

37618⋅π

────────

3267

warning: passing floating-point values to sym is dangerous, see "help sym"

warning: called from

double_to_sym_heuristic at line 50 column 7

sym at line 379 column 13

mrdivide at line 79 column 5

warning: passing floating-point values to sym is dangerous, see "help sym"

warning: called from

double_to_sym_heuristic at line 50 column 7

sym at line 379 column 13

mtimes at line 63 column 5

warning: passing floating-point values to sym is dangerous, see "help sym"

warning: called from

double_to_sym_heuristic at line 50 column 7

sym at line 379 column 13

mtimes at line 63 column 5

an = (sym)

⎛⎧ n ⎞

⎜⎪4⋅(-1) ⋅π 2⋅π ⎟

⎜⎪───────── - ─── for n > -∞ ∧ n < ∞ ∧ n ≠ 0⎟

⎜⎪ 2 2 ⎟

⎜⎪ n n ⎟

5374⋅⎜⎨ ⎟

⎜⎪ 3 ⎟

⎜⎪ 7⋅π ⎟

⎜⎪ ──── otherwise ⎟

⎜⎪ 3 ⎟

⎝⎩ ⎠

───────────────────────────────────────────────────

1089⋅π

octave:39> syms n x l;

f(x) = 3*(l-x)^2;

b = (int(f(x) *sin(n * pi * x/l), 0, l))/(2/l);


bn = subs(b, [sin(pi*n), sin(2*pi*n), cos(pi*n), cos(2*pi*n)], [0, 0, (-1)^n, 1])


warning: passing floating-point values to sym is dangerous, see "help sym"

warning: called from

double_to_sym_heuristic at line 50 column 7

sym at line 379 column 13

mtimes at line 63 column 5

warning: passing floating-point values to sym is dangerous, see "help sym"

warning: called from

double_to_sym_heuristic at line 50 column 7

sym at line 379 column 13

mtimes at line 63 column 5

bn = (sym)

⎛⎧ n 3 3 3 ⎞

⎜⎪6⋅(-1) ⋅l 3⋅l 6⋅l ⎟

⎜⎪────────── + ──── - ───── for n > -∞ ∧ n < ∞ ∧ n ≠ 0⎟

l⋅⎜⎨ 3 3 π⋅n 3 3 ⎟

⎜⎪ π ⋅n π ⋅n ⎟

⎜⎪ ⎟

⎝⎩ 0 otherwise ⎠

──────────────────────────────────────────────────────────

octave:43> syms n x l;

f(x) = (l+x)^2;

b = (int(f(x) *sin(n * pi * x/l), 0, l))/(2/l);


bn = subs(b, [sin(pi*n), sin(2*pi*n), cos(pi*n), cos(2*pi*n)], [0, 0, (-1)^n, 1])

warning: passing floating-point values to sym is dangerous, see "help sym"

warning: called from

double_to_sym_heuristic at line 50 column 7

sym at line 379 column 13

mtimes at line 63 column 5

warning: passing floating-point values to sym is dangerous, see "help sym"

warning: called from

double_to_sym_heuristic at line 50 column 7

sym at line 379 column 13

mtimes at line 63 column 5

bn = (sym)

⎛⎧ n 3 n 3 3 3 ⎞

⎜⎪ 4⋅(-1) ⋅l 2⋅(-1) ⋅l l 2⋅l ⎟

⎜⎪- ────────── + ────────── + ─── - ───── for n > -∞ ∧ n < ∞ ∧ n ≠ 0⎟

l⋅⎜⎨ π⋅n 3 3 π⋅n 3 3 ⎟

⎜⎪ π ⋅n π ⋅n ⎟

⎜⎪ ⎟

⎝⎩ 0 otherwise ⎠

────────────────────────────────────────────────────────────────────────

octave:47> display("20TUIT140-SRIRAM")
20TUIT140-SRIRAM

You might also like