a 15g bullet is fired at 840 m/s into a penullum consisting of a 24kg bag of sand. If the bag rises to a height of 80cm, how much energy is converted into thermal energy in the bag?

Emechanical=Ek + Eg
=1/2mv^2 +mgh
=1/5(0.015)(840) + 0
=5292J

Emechanical =Ek + Eg
=1/2mv^2 + mgh
=0 +(24.015)(9.8)(0.8)
=188.28

Total Emechanical = 188.28-5292
=-5103.72, which is the amount of energy convered into thermal energy.

Eheat = Ek - Eg

is the formula you should have used.
Eheat is the portion of the original KE that was converted to heat

I do not understand what your "Emechanical" is, and how it could be negative.

What you call "Total Emechanical" may be the energy converted to heat, except for the minus sign.

To find the amount of energy converted into thermal energy in the bag, we first need to find the total mechanical energy before and after the bullet is fired into the pendulum.

The total mechanical energy before the bullet is fired into the pendulum can be calculated using the formula:

Emechanical = Ek + Eg

Where Emechanical is the total mechanical energy, Ek is the kinetic energy, and Eg is the gravitational potential energy.

The kinetic energy can be calculated using the formula:

Ek = 1/2mv^2

Where m is the mass of the bullet and v is the velocity of the bullet.

The gravitational potential energy can be calculated using the formula:

Eg = mgh

Where m is the mass of the bag of sand, g is the acceleration due to gravity, and h is the height to which the bag rises.

Given:
Mass of the bullet (m) = 15g = 0.015kg
Velocity of the bullet (v) = 840 m/s
Mass of the bag of sand (m) = 24kg
Height to which the bag rises (h) = 80cm = 0.8m
Acceleration due to gravity (g) = 9.8 m/s^2

Now, let's calculate the total mechanical energy before the bullet is fired:

Ek = 1/2 * (0.015kg) * (840 m/s)^2 = 5292J

Eg = (24kg + 0.015kg) * 9.8 m/s^2 * 0.8m = 188.28J

Emechanical = Ek + Eg = 5292J + 188.28J = 5480.28J

Now, to find the amount of energy converted into thermal energy, we subtract the total mechanical energy after the bullet is fired from the initial total mechanical energy:

Amount of energy converted into thermal energy = Initial total mechanical energy - Final total mechanical energy
= 5480.28J - 5292J = 188.28J

Therefore, the amount of energy converted into thermal energy in the bag is 188.28J.