Preheat oven to 400 degrees F (200 degrees C). Prepare a 9x13 inch baking dish with butter.
In a large bowl, mash the sweet potatoes. Mix together with sugar, eggs, 3/4 cup margarine, evaporated milk, nutmeg, cinnamon, marshmallows and coconut. Scoop the mixture into the baking dish.
Bake 20 minutes in the preheated oven, or until sweet potatoes are tender.
In a small bowl, mix the crushed cornflakes, brown sugar, pecans and remaining 3/4 cup margarine. Spread the topping over the baked casserole.
Return the casserole to the 400 degrees F (200 degrees C) oven and bake an additional 10 minutes.