I am trying to plot Sage calculation listed below. I get the following error:
verbose 0 (3989: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 200 points. verbose 0 (3989: plot.py, generate_plot_points) Last error message: 'unable to simplify to float approximation'
Gather all for Full H off resonance
Ix=1/2matrix(SR,2,2,[[0,1],[1,0]]) Iy=1/(2I)matrix(SR,2,2,[[0,1],[-1,0]]) Iz=1/2matrix(SR,2,2,[[1,0],[0,-1]]) Al=vector(SR,[1,0]) Be=vector(SR,[0,1])
g = 26.7522128e7 # 1H Gamma rad/s/T rf_field = 100 # B1 rf field in kHz Brf = rf_field1e32pi/g2 # B1 in T for Wnut/2pi= 100 kHz Thetarf = pi/2 # angle between BO and Brf Wnut = (1/2gBrfsin(Thetarf)) t360 = 1/((1/2gBrfsin(Thetarf))/(2pi))# 360 pulse tip = 180 # Tip angle tp = tip/360t360 Bo = 500e62pi/g# T Spectrometer Field Strength wref = gBo # spectrometer reference frequency for Protons, rad/S Bo.n(),(wref/(2pi)).simplify()/1e6;(Wnut/(2pi)).simplify()/1e3,tp.simplify()1e6
Ratio = var ('Ratio')# Wnut/O0, Ratio creates offset, 0=on res Boo=(WnutRatio+wref)/g woo = gBoo O0=woo-wref Phip = var('Phip') # Phip = phase of rf pulse Hrfrf = (O0)Iz + Wnut(Ixcos(Phip)+Iysin(Phip)) Pabrf=((abs(Beexp(-iHrfrf(Phip=0)tp)Al))^2)
for Ratio in srange (-1,1,0.25,include_endpoint=True):
Pabrf(Ratio=Ratio).n(digits=5) #(pi)x on Alpha off resonance Full H
plot (Pabrf,(Ratio, -1,1))