I am having a hard time figuring out how to calculate the work done by friction with varying acceleration. I will post the entire problem just for reference, but I know how to do everything EXCEPT how to calculate the work done by non conservative forces, i.e. friction in this case. Here is the problem:

I know the work done by friction is 0.24J, but I don't know how to calculate it.

You calculate the work done by friction exactly as you'd calculate the work done by any force: Work = force X distance. What's the friction force? What's the distance over which it acts?

(What makes you think the work done by friction is 0.24 J?)

The force of the spring has nothing to do with friction.

Friction acts between a mass and the surface on which it is moving.

Normally, friction is defined as the product of the coefficient for friction [itex]\mu[/itex] and the weight of the mass (mg). Then the work is the integral of the force over the distance. The spring is pulled 0.2 m from equilibrium.

[tex]Work, W\,=\,\int\,F\,dx[/tex]

If F is constant, then Work, W = F*d, where d is the distance over which the force is applied, not the differential operator in dx.

I actually thought of this, because I saw that by integrating from 0 to .2 xdx and moving the spring constant outside I got the right answer.

Here is what I don't understand, and maybe you can help explain it to me: why .2 and not .1? Aren't we talking about half the distance between x and 0? why .2? why why why?

The friction is applied over the distance that the glider travels on the track, and that force is completely independent from the force of the spring. The friction is proportional to the weight of the glider.

Now, try to calculate the friction force based on the weight of the glider and apply it over the distance traveled.

Half-way along the track is 0.1 m, and that is part of one of the questions

To solve this equation, one would have to subtract the friction force from the spring force to solve the problem.

Energy is a conditional quantity ; initial condition of the stretched spring is ½ k s^2 = 24 [Joules] contained, since stretched .2 [m] .

Work is a process quantity ; it depends on the (average) Force component parallel to the displacement.

The Energy in the later configuration (spring only stretched 0.1 [m])
is less than in the initial condition because the Work by friction
transferred some of the Energy to the track.
Because the Potential Energy function is not linear, you have to measure its stretch distance from the its unstretched condition (minimum PE).
That is, ½ k (.2[m])^2 - ½ k (.1[m])^2 is NOT equal ½ k (.1[m])^2 .
gravitational PE near Earth surface is UNusual, being almost linear.