Piecewise Time-Dependent Hamiltonian in Mathematica Strategy

In summary, the conversation discusses the process of simulating an experiment involving a Hamiltonian and an RF pulse in the x-direction. The individual is looking for recommendations on how to define a function involving a list of pairs and matrices. They also mention being new to the simulation side and welcome any general recommendations.
  • #1
alexmurillo242
1
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
    19.7 KB · Views: 97
Physics news on Phys.org
  • #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]
 

1. What is a Piecewise Time-Dependent Hamiltonian in Mathematica?

A Piecewise Time-Dependent Hamiltonian in Mathematica is a function that describes the behavior of a physical system over time, taking into account changes in the system's energy and momentum. It is represented as a matrix or a set of differential equations and is used in various fields of physics, such as quantum mechanics and classical mechanics.

2. How is a Piecewise Time-Dependent Hamiltonian defined in Mathematica?

A Piecewise Time-Dependent Hamiltonian in Mathematica is defined using the Piecewise function, which allows for different expressions to be used for different values of time. It can also be defined using the DifferentialEquations function, which allows for more complex equations to be used.

3. What is the purpose of using a Piecewise Time-Dependent Hamiltonian in Mathematica?

The purpose of using a Piecewise Time-Dependent Hamiltonian in Mathematica is to model and analyze the behavior of physical systems over time. It allows for the prediction of how a system will evolve, and can also be used to simulate and study complex systems that cannot be solved analytically.

4. Can you provide an example of using a Piecewise Time-Dependent Hamiltonian in Mathematica?

Sure, an example of using a Piecewise Time-Dependent Hamiltonian in Mathematica would be to model the behavior of a simple pendulum. The Hamiltonian would take into account the energy and momentum of the pendulum at different points in time, and the equations of motion could be solved to predict the pendulum's trajectory.

5. Are there any limitations to using a Piecewise Time-Dependent Hamiltonian in Mathematica?

Yes, there are some limitations to using a Piecewise Time-Dependent Hamiltonian in Mathematica. It may not be suitable for very large or complex systems, and it may also require a significant amount of computational power to solve the equations. Additionally, the accuracy of the results may depend on the assumptions and simplifications made in the model.

Similar threads

  • Programming and Computer Science
Replies
1
Views
1K
Replies
9
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
10K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
Back
Top