# Performing piecewise integration

The premise is that I am a new Mathematica user. I'm trying to evaluate the following

B[t_, i_, h_] = piecewise[{{(t - (i - 2)*h)^3, (i - 2)*h <= t <= (i - 1)*h}, {h^3 +
3*h^2*(t - (i - 1)*h) + 3*h*(t - (i - 1)*h)^2 - 3*(t - (i - 1)*h)^3,
(i - 1)*h <= t <= i*h}, {h^3 + 3*h^2*((i + 1)*h - t) + 3*h*((i + 1)*h - t)^2 -
3*((i + 1)*h - t)^3, i*h <= t <= (i + 1)*h}, {((i + 2)*h - t)^3, (i + 1)*h <= t <= (i + 2)*h}}]

B0 = B[t, 0, h] - 4*B[t, -1, h]
B0p = D[B0, t]
a00p = integrate[B0p[t, h]^2, {t, 0, 1}]


But at the end I just get 'integrate[the extended form of B0p]'. Thanks in advance for your help.

EDIT: Thanks. Using uppercase letters I get the following:

• Commands need to be capitalised. – b.gates.you.know.what Jun 14 '15 at 12:49
• And probably worth avoiding single capitals for functions names to avoid clashes with built in functions. – image_doctor Jun 14 '15 at 12:56
• To be precise, built-in function names are always capitalized. User developed function may be named with or without caps but preferably don't start with a capital letter. – Sjoerd C. de Vries Jun 14 '15 at 13:16
• You have not defined a function B0p with two arguments, yet you call it that way. – Sjoerd C. de Vries Jun 14 '15 at 13:18

Correcting the syntax errors:

B[t_, i_, h_] :=
Piecewise[{{(t - (i - 2)*h)^3, (i - 2)*h <= t <= (i - 1)*h}, {h^3 +
3*h^2*(t - (i - 1)*h) + 3*h*(t - (i - 1)*h)^2 -
3*(t - (i - 1)*h)^3, (i - 1)*h <= t <= i*h}, {h^3 +
3*h^2*((i + 1)*h - t) + 3*h*((i + 1)*h - t)^2 -
3*((i + 1)*h - t)^3,
i*h <= t <= (i + 1)*h}, {((i + 2)*h - t)^3, (i + 1)*h <=
t <= (i + 2)*h}}]

B0[t_, h_] := B[t, 0, h] - 4*B[t, -1, h]
B0p[t_, h_] := D[B0[t, h], t]
a00p = Integrate[B0p[t, h]^2, {t, 0, 1}]


yields:

you should check this fits your expectations. Please compare code (if my corrections are ok) to understand the syntax errors.