Yep, I didn't include any result because it takes too long for the program to arrive at it. Now I've included the plot I'm after - Mtotal(B). As you can see, it makes no sense.
In my opinion, dE() should return the energy minimized with respect to alpha and phi. I want to minimize the initial expression, that is, E(B,alpha,phi). I thought I minimized the E function by taking its derivatives and then finding their roots to be used for Mtotal... Should I have assumed a different approach? And how should I get the B range to have the desired effect?
Thank you.