- #1
- 15
- 0
Sorry I'm sort of deleting the template here, but my question isn't a strict HW help problem. I wasn't sure where else to ask it. I need to take an integral given that a certain variable is an integer, odd, and greater than zero, on mathematica. I'm integrating with respect to the variable x, but its for a trig function that involves the integer n*Pi in the domain, meaning it will dissapear for certain n, given n is an integer and > 0. Its for a quantum mechanics problem on griffiths (finding the coefficients of a wavefunction, given the wave function at time 0). For those of you familiar with griffiths text on QM, the equation is something like Cn = Integral (Your eigenfunction given a certain n)*(Your wave function at time 0).
I have already done it by hand and gotten the correct answer (almost! my answer switches sign depending on the variable n, where as the solution I have is positive for all n), but now the problem asks for me find the expectation value for the energy, which is <H> = summation (Cn^2* En) from zero --> infinity.
After getting rid of some constants, I now have a summation from n = 1 --> infinity, given n is odd, for 1/(n^2). So really this isn't a QM question at all, its "how do I tell mathematica my variable is an odd integer and make it do the problem." I am familiar with how to do integrals and summations on mathematica, just not very familiar on how to tell it constraints on a variable. Any help?
Honestly I could probably look up the summation in a reference or something, though I feel like this would be very useful knowledge to know to begin with.
I have already done it by hand and gotten the correct answer (almost! my answer switches sign depending on the variable n, where as the solution I have is positive for all n), but now the problem asks for me find the expectation value for the energy, which is <H> = summation (Cn^2* En) from zero --> infinity.
After getting rid of some constants, I now have a summation from n = 1 --> infinity, given n is odd, for 1/(n^2). So really this isn't a QM question at all, its "how do I tell mathematica my variable is an odd integer and make it do the problem." I am familiar with how to do integrals and summations on mathematica, just not very familiar on how to tell it constraints on a variable. Any help?
Honestly I could probably look up the summation in a reference or something, though I feel like this would be very useful knowledge to know to begin with.