I am a mathematics and physics double major student entering my third year. Over this summer and the previous semester I have been working with a research group in physics writing simulation code. But I have been taking an incredibly long time to finish writing this objectively simple code that I have become very dissatisfied and pessimistic about my future in physics. I have been thinking about applying to graduate school in mathematics instead but I wonder: Would it even help to list this in my graduate school applications? I've spent a lot of time on this project yet I have near nothing to show for it. No publications or even interesting results. My code isn't done yet! Should I bother asking for a letter of recommendation from my PI knowing I did a terrible job at it? I have good grades but I do not know anyone who I believe will give me a strong letter of recommendation, which I know is crucial to admissions.
Asking costs nothing. Ask for a (strong, if possible) letter of recommendation from your PI in any case. Use this letter depending on how strong it actually will be.