Mathematica returns non-numerical integrand while minimizing

  • Thread starter Thread starter physstudent.4
  • Start date Start date
  • Tags Tags
    Mathematica
physstudent.4
Messages
12
Reaction score
0

Homework Statement


I need to minimize the function Etrial[a]
trial[x_] := E^(-a*x^2)
Etrial[a_] :=
NIntegrate[1/2*D[trial[x], x]^2 + x^4*trial[x]^2, {x, -\[Infinity], \[Infinity]}]/
NIntegrate[trial[x]^2, {x, -\[Infinity], \[Infinity]}]


Homework Equations





The Attempt at a Solution


I have used NMinimize[Etrial[a],a] and Minimize[Etrial[a],a], as well as FindMiminum[Etrial[a],{a,.5}], since when I plot it, the minimum is pretty obviously around .7, so I arbitrarily chose .5 as a close starting point.
 
Physics news on Phys.org
Use Integrate instead of NIntegrate. Also, you can actually do the integrals and write the expressions down in closed form. If you define Etrial using those results, it'll be a lot faster since Mathematica won't have to repeatedly perform the integrations.
 
I ended up just writing a separate loop that found the minimum. I discovered if I had written my trial function as a function of both x and a, then used partial derivatives, Mathematica can handle that easier. Thanks anyway though!
 
To solve this, I first used the units to work out that a= m* a/m, i.e. t=z/λ. This would allow you to determine the time duration within an interval section by section and then add this to the previous ones to obtain the age of the respective layer. However, this would require a constant thickness per year for each interval. However, since this is most likely not the case, my next consideration was that the age must be the integral of a 1/λ(z) function, which I cannot model.

Similar threads

Replies
13
Views
2K
Replies
1
Views
2K
Replies
34
Views
4K
Replies
4
Views
3K
Replies
6
Views
5K
Replies
7
Views
2K
Back
Top