1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Any Mathematica Guru's here?

  1. Apr 11, 2009 #1
    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.
     
  2. jcsd
  3. Apr 11, 2009 #2

    nicksauce

    User Avatar
    Science Advisor
    Homework Helper

    Well, if I understand you correctly, you can do it with a simple change of variables: Sum 1 / (2n+1)^2, from n=0 to infinity.
     
  4. Apr 11, 2009 #3
    Yep, that will work well for summation, but not for integration - Mathematica won't have the initial condition that n is an integer.

    AND I don't think it yields *quiet* the right answer, though I don't understand why. Mathematica gives the sum as (-1+(Pi^2)/8), while the answer I found on the internet gives Pi^2 / 8 (difference of one between the two, though the second was calculated by "maple." No idea why, or even which one is really correct. I'm sure there are some subtleties here that I am missing. )
     
  5. Apr 12, 2009 #4

    Hurkyl

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Did you ask Sum[1/(2n+1)^2, {n, 1, :inf:}] on accident? (Instead of using {n, 0, :inf:} as your bounds)


    Some functions take an additional argument called "Assumptions"; Integrate is one of them, meaning you can do

    Integrate[ f, {x, a, b}, Assumptions->Element[x, Integers] ]

    If I've remembered wrongly, you can still do something like

    FullSimplify[ [Integrate[ f, {x, a, b}], Assumptions->Element[n, Integers] ]

    or

    Assuming[ Element[n, Integers], Integrate[ f, {x, a, b}] ]

    (I think I have the syntax right for this last one)

    I think there's a way to specify that it has to be odd.

    I think you can even declare to Mathematica an assumption that you will always use. In any case, you have a lead, now you can go read up on assumptions in the help documentation.
     
  6. Apr 12, 2009 #5
    Ah yes you were definitely right about the sum. Simple mistake. As for the integration, that is exactly the sort of thing that I was looking for. Now that I have a lead, I'm sure I can read up on the documention and figure out exactly how to do it.
     
  7. May 20, 2009 #6
    Hello everybody,
    I a new to Mathematica and I want t find the roots of a complex equation. It is basically a dispersion relation with omega as a function of K.

    \[Rho] = 0.01;
    we = 1000;
    oh = 0.1;
    k =.;
    n =.;
    m = (Sqrt[k^2 + n^2]);
    F[ome_] = (ome + I (we)^0.5 k + 4 m^2 oh)*(ome + I (we)^0.5 k) Tanh[
    m] + 4 m^3 oh^2 *(m Tanh[
    m] - (m^2 + (ome + I (we)^0.5 k)/oh)^0.5 *
    Tanh[(m^2 + (ome + I (we)^0.5 k)/oh)^0.5]) + \[Rho] ome^2 +
    m^3;
    n = 1;

    t = Table[{k,
    Re[ome /.
    FindRoot[F[ome] == 0, {ome, {(1.5 + 50 I), (3 + 100 I)}},
    MaxIterations -> 500]]}, {k, 1, 100, 1}]

    ListPlot[t, PlotJoined -> True]

    This is how i have been trying to solve the equation, my email i.d is kumar.kannan@uni.lu.Any suggestions about solving the equation is welcome. It is urgent.
    Thanks in advance
    bye
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Any Mathematica Guru's here?
Loading...