Piecewise Time-Dependent Hamiltonian in Mathematica Strategy

  • #1
TL;DR Summary
Since matrices are handled as lists of lists in Mathematica and the Piecewise() function's first argument expects a list of pairs what type of strategy would you all use for defining a Hamiltonian that abruptly changes in time (Image included)
Hi all,

I'm doing some light simulations for an experiment I'm going to be running soon. I've ran through the math symbolically on paper but I'm not exactly eager for handling this large of matrices by hand so I'm trying to work through it and see if I can generate a simulated signal to compare my results against.

There is a Hamiltonian (Hzf15) which is present throughout the entire time and is an inherent structural part of the molecule and I'm trying to implement a hard RF pulse in the x-direction represented by HxDC that is applied for a period of time (PulseTime) that is initiated at t = 0.

Due to the way that the Piecewise[] function works by having a list of pairs and matrices are stored as a list of lists I get the error seen at the bottom. How would you all recommend going about defining such a function? I have started trying to rewrite this all in Matlab but I have significantly less experience with it so we'll see how that goes. 😂

I'm still rather new to the whole simulation side of this so any general recommendations would be appreciated as well especially if its just a syntactic error.

P.S. for more detail all of the operators here are for operating on a system of 5 spin-1/2 particles with tetrahedral symmetry around a heteroatom center.
 

Attachments

  • Screenshot 2022-05-27 134506.png
    Screenshot 2022-05-27 134506.png
    23.3 KB · Views: 54

Answers and Replies

  • #2
Thanks!HxDC[t_] := Piecewise[{{Hx*IdentityMatrix[5], 0 <= t <= PulseTime}}, 0];Hzf15[t_] := Piecewise[{{Hf15, 0 <= t <= PulseTime}}, 0];In[1]:= TotalHamiltonian[t_] := HxDC[t] + Hzf15[t]During evaluation of In[1]:= Piecewise::pwse: {{HxIdentityMatrix[5],0<=t<=PulseTime},0} is not a valid piecewise expression. >>Out[1]= Piecewise[{{HxIdentityMatrix[5], 0 <= t <= PulseTime}, 0}, 0] + Piecewise[{{Hf15, 0 <= t <= PulseTime}, 0}, 0]
 

Suggested for: Piecewise Time-Dependent Hamiltonian in Mathematica Strategy

Replies
1
Views
169
Replies
1
Views
647
Replies
2
Views
650
Replies
2
Views
3K
Replies
1
Views
513
Replies
1
Views
792
Replies
1
Views
557
Replies
6
Views
537
Back
Top