What is the mathematical definition of work?

I'm looking for the pure mathematical definition of work, but I haven't yet learned line integrals.

My book says that the work due to a force ${\bf F}$ from point $A$ to point $B$ is $$W= |AB|\cdot |{\bf F}|\cdot\cos(\angle AB,{\bf F})$$

but it also says this only applies for constant forces.

I am assigned a problem which asks me to determine the work of from a point $A$ to $B$ with gravitational force $$F=GmM/R^2.$$ I don't think that I can apply the normal rule above, since it only works for forces that don't change their pointing. Am I mistaken?

-
Are you not allowed to use line integrals or are line integrals out of the scope of the class or do you simply not know how to evaluate them? I'm curious because a way around this for this specific force is by constructing the potential energy. The gravitational force is a conservative force, meaning it can be expressed as the gradient of a scalar function, which happens to be the potential energy. This provides a simple way to calculating work done by these forces since you can show it must be equal to the change in the potential energy. – Elvex Jul 8 '14 at 2:56
out of the scope of the class – user31731 Jul 8 '14 at 3:08
Are integrals, of any kind, out of the scope of the class? As Joshphysics pointed out below, this line integral reduces to a very simple integral where the specifics of it being a line integral aren't important. If you're not supposed to use calculus, then the potential energy is probably the way to go. – Elvex Jul 8 '14 at 3:10
we are allowed to use integrals , but we havent studiedline integrals yet , i'll have a look at them soon – user31731 Jul 8 '14 at 3:12
For gravity the work done is equal to the difference in gravitational potential times the mass of the object. – Taemyr Jul 8 '14 at 7:45

Let $\mathbf x(t)$ be the path of a particle. Let $\mathbf F(t)$ be a force acting on the particle as a function of time, then the work done by the force from time $t_a$ to time $t_b$ is \begin{align} W(t_b, t_a) = \int_{t_a}^{t_b} \mathbf F(t)\cdot \frac{d\mathbf x}{dt}(t)\, dt. \end{align} where the center dot denotes dot product; \begin{align} \mathbf F(t)\cdot \frac{d\mathbf x}{dt}(t) = |\mathbf F(t)|\left|\frac{d\mathbf x}{dt}(t)\right| \cos\theta(t) \end{align} where $\theta(t)$ is the angle between $\mathbf F(t)$ and $\frac{d\mathbf x}{dt}(t)$.
Technically, the definition I wrote down is also how one defines line integrals, but you don't actually need to know anything about line integrals to understand that expression; it's just an integral in the single variable $t$.
The definition of work, it is done on vectors, let's say $$\vec F = F_x\hat i+F_y\hat j+F_x\hat k,$$ that would be the force and the displacement vector it is $$\vec \ell=\ell_x\hat i+\ell_y \hat j + \ell_z\hat k$$ so you have the 3D. Then the definition is $$W=\int \vec F \cdot d\vec\ell$$ also it would be good to check anyways the dot product and the line integral as well as work.