Hot answers tagged

4

In units where hbar, m, and omega_0 are set to 1, the Schrödinger equation for the quantum harmonic oscillator can be written $$ i \partial_t \Psi(x,t) = \left(- \frac{1}{2} \partial_x^2 + \frac{1}{2} x^2\right)\Psi(x,t) $$ and the time-dependent solutions can be written as a sum of time-dependent complex exponentials times the time-independent ...


4

The error FEMStiffnessElements operator failure comes up when K is not defined properly. The first application example from the DiffusionPDETerm model = DiffusionPDETerm[{u[x], {x}}, {{If[x <= 3/4, 1, 2]}}] It's impossible to be more specific unless you provide your specific equation and code that you have.


4

You're using Compile in wrong way. I'd suggest reading this and this post as a start. The following is a quick fix for your code: rule = Flatten[ DownValues /@ {pproductLabVec3, pproductLabVec2, pproductLabVec1, ϕVal}]; θproductLabVec = Hold@Compile[{{EN, _Real}, {mN, _Real}, {θN, _Real}, {ϕN, _Real}, {EXrest, _Real}, {mX, _Real}, {...


3

The following takes approx. 4 seconds for 10^5 evaluations. A sped up could be obtained if the data is not fed one by one, but in bunches. Then instead of of calculating scalars, one could work with vectors. boost[thn_, phn_, en_, mn_, m_, e_, ph_, th_] := Module[{mn2 = mn^2, vn, gamn, gam, pt, tht, pht, pn}, p = Sqrt[e^2 - m^2] {Sin[th] Cos[ph], Sin[...


3

Although, it seems like the question has been addressed in comments, it may be useful to clarify the subject in general. The command Get["http://nrgljubljana.ijs.si/sneg/sneg.m"] does not install the package, it simply loads the package into the Mathematica session from the Web. This does not allow one using it offline. Installation on Windows Step-...


2

One approach is to construct the values of the iterator explicitly. For example: Table[i, {i, Exp[Range[0, 1, 0.01]] - 1}] has lots of values near zero and progresively fewer at larger values. Of course, if you want a function $f$ of these, it's straightforward: Table[f[i], {i, Exp[Range[0, 1, 0.02]] - 1}] And of course, Do uses the same iterator structure ...


2

Seems that the default error estimation of NDSolve doesn't work well for your initial value problem (IVP), and this turns out to be a (relatively) rare case that AccuracyGoal option helps. With f = 0.01: s1 = NDSolve[{A2[t] == 0, C1[t] == 0, P1[t] == 0, α[0] == -110, α'[0] == Sqrt[A1[0]], ψ[0] == ((Ω^4 Sin[(5*10^-4)/f])/(3 g λ Sqrt[A1[0]]))^(...


Only top voted, non community-wiki answers of a minimum length are eligible