If there is a force $\mathbf F(x)=ax\hat i$ and an object is moving from $x_2>0$ to $x_1>0$ in the opposite direction of force. Then work could be calculated as follows
$$\int_{x_2}^{x_1} -F(x)\cdot\text dx$$
the negative sign is because the direction between $\mathbf F(x)$ and $\text dx$ are anti-parallel
$$-\int_{x_2}^{x_1} ax\cdot\text dx$$ $$-a(\frac{x_1^2-x_2^2}{2})$$
since $x_1 < x_2$, therefore $x_1^2<x_2^2$ so $$x_1^2-x_2^2 < 0$$ and $$-a(\frac{x_1^2-x_2^2}{2})>0$$
So my calculation shows that the work done in going against the force is positive, which is absolutely wrong. Please correct me!