Why is part of the output “Null”? [closed]
$begingroup$
Whenever I execute the code, portions of the output are null. How can I fix this? I am not sure the extent to which the result is invalid because I am not entirely familiar with the null output, though I have read the documentation. The point in which this problem arises is labeled in the following code:
omega[t_, t0_, T_] = Exp[(-(t - t0)^2)/T^2];
omegap[t_, t0p_, Tp_] = Exp[-((t - t0p)^2)/Tp^2];
eff[t_, t0p_,
Tp_] = ((omega[t, t0, T])^2 - (omegap[t, t0p,
Tp])^2)/(2 [CapitalDelta]);
eff[t_, t0p_,
Tp_] = (omegap[t, t0p, Tp]*omega[t, t0, T])/([CapitalDelta]);
ReducedHam = ({
{[CapitalDelta]eff[t, t0p, Tp], [CapitalOmega]eff[t, t0p, Tp]*
Exp[Sqrt[-1]*[CurlyPhi]]},
{[CapitalOmega]eff[t, t0p, Tp]*
Exp[-Sqrt[-1]*[CurlyPhi]], -[CapitalDelta]eff[t, t0p, Tp]}
});
Print[MatrixForm[ReducedHam]]
[Theta][t_, t0p_, Tp_] = ArcTan[omegap[t, t0p, Tp]/omega[t, t0, T]];
[Lambda]1 = ({
{Cos[[Theta]]},
{-Sin[[Theta]]*Exp[-Sqrt[-1]*[CurlyPhi]]}
});
[Lambda]2 = ({
{Sin[[Theta]]*Exp[Sqrt[-1]*[CurlyPhi]]},
{Cos[[Theta]]}
});
Print[MatrixForm[[Lambda]1]]
Print[MatrixForm[[Lambda]2]]
Mat1 = (D[[Lambda]1, [Theta]]).(Transpose[[Lambda]1]);
Print[Mat1]
V1 = Transpose[[Lambda]1].D[[Lambda]1, [Theta]];
V2 = [Lambda]1.Transpose[[Lambda]1];
Print[MatrixForm[V2]]
Mat2 = V1[[1, 1]] V2;
Print[Mat2]
Dimensions[Mat2];
Mat12 = Mat1 - Mat2;
Print[MatrixForm[Mat12]]
Mat3 = Print[
MatrixForm[D[[Lambda]2, [Theta]].Transpose[[Lambda]2]]];
V3 = Transpose[[Lambda]2].D[[Lambda]2, [Theta]];
V4 = [Lambda]2.Transpose[[Lambda]2];
Print[MatrixForm[V4]]
Mat4 = V3[[1, 1]] V4;
Print[MatrixForm[Mat4]]
Mat34 = Mat3 - Mat4;
CDTerm = Mat12 + Mat34 ;
Print[MatrixForm[Simplify[CDTerm]]]
(*this is where null arises*)
TotalHam = ReducedHam + CDTerm;
Print[MatrixForm[Simplify[TotalHam]]]
Dimensions[ReducedHam]
Dimensions[CDTerm]
[CapitalOmega]a[t_, t0p_,
Tp_] = (2 (((D[omega[t, t0, T], t])*(omegap[t, t0p, Tp])) - ((omega[
t, t0, T]) (D[omegap[t, t0, T], t]))))/((omegap[t, t0,
T])^2 + (omega[t, t0, T]^2))
[Gamma][t_, t0_, T_, [CurlyPhi]_] =
ArcTan[([CapitalOmega]a[t, t0p, Tp])/([CapitalOmega]eff[t, t0p,
Tp])] + [CurlyPhi];
f1[t_, t0_,
T_, [CurlyPhi]_] = (Exp[(Sqrt[-1]*[Gamma][t, t0,
T, [CurlyPhi]])]/2)
f2[t_, t0_, T_, [CurlyPhi]_] =
Exp[(Sqrt[-1]*[Gamma][t, t0, T, [CurlyPhi]])/2]
U = ({
{f1[t, t0, T, [CurlyPhi]], 0},
{0, f2[t, t0, T, [CurlyPhi]]}
})
Mat5 = ConjugateTranspose[U].TotalHam.U;
Print[MatrixForm[Mat5]]
Mat6 = ConjugateTranspose[U].(D[U, t]);
Print[MatrixForm[Mat6]]
HModified = Mat5 - Mat6;
Print[MatrixForm[Simplify[HModified]]]
matrix error output
$endgroup$
closed as off-topic by Lukas Lang, Henrik Schumacher, m_goldberg, bbgodfrey, Szabolcs Jan 2 at 13:37
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Lukas Lang, Henrik Schumacher, m_goldberg, bbgodfrey, Szabolcs
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
$begingroup$
Whenever I execute the code, portions of the output are null. How can I fix this? I am not sure the extent to which the result is invalid because I am not entirely familiar with the null output, though I have read the documentation. The point in which this problem arises is labeled in the following code:
omega[t_, t0_, T_] = Exp[(-(t - t0)^2)/T^2];
omegap[t_, t0p_, Tp_] = Exp[-((t - t0p)^2)/Tp^2];
eff[t_, t0p_,
Tp_] = ((omega[t, t0, T])^2 - (omegap[t, t0p,
Tp])^2)/(2 [CapitalDelta]);
eff[t_, t0p_,
Tp_] = (omegap[t, t0p, Tp]*omega[t, t0, T])/([CapitalDelta]);
ReducedHam = ({
{[CapitalDelta]eff[t, t0p, Tp], [CapitalOmega]eff[t, t0p, Tp]*
Exp[Sqrt[-1]*[CurlyPhi]]},
{[CapitalOmega]eff[t, t0p, Tp]*
Exp[-Sqrt[-1]*[CurlyPhi]], -[CapitalDelta]eff[t, t0p, Tp]}
});
Print[MatrixForm[ReducedHam]]
[Theta][t_, t0p_, Tp_] = ArcTan[omegap[t, t0p, Tp]/omega[t, t0, T]];
[Lambda]1 = ({
{Cos[[Theta]]},
{-Sin[[Theta]]*Exp[-Sqrt[-1]*[CurlyPhi]]}
});
[Lambda]2 = ({
{Sin[[Theta]]*Exp[Sqrt[-1]*[CurlyPhi]]},
{Cos[[Theta]]}
});
Print[MatrixForm[[Lambda]1]]
Print[MatrixForm[[Lambda]2]]
Mat1 = (D[[Lambda]1, [Theta]]).(Transpose[[Lambda]1]);
Print[Mat1]
V1 = Transpose[[Lambda]1].D[[Lambda]1, [Theta]];
V2 = [Lambda]1.Transpose[[Lambda]1];
Print[MatrixForm[V2]]
Mat2 = V1[[1, 1]] V2;
Print[Mat2]
Dimensions[Mat2];
Mat12 = Mat1 - Mat2;
Print[MatrixForm[Mat12]]
Mat3 = Print[
MatrixForm[D[[Lambda]2, [Theta]].Transpose[[Lambda]2]]];
V3 = Transpose[[Lambda]2].D[[Lambda]2, [Theta]];
V4 = [Lambda]2.Transpose[[Lambda]2];
Print[MatrixForm[V4]]
Mat4 = V3[[1, 1]] V4;
Print[MatrixForm[Mat4]]
Mat34 = Mat3 - Mat4;
CDTerm = Mat12 + Mat34 ;
Print[MatrixForm[Simplify[CDTerm]]]
(*this is where null arises*)
TotalHam = ReducedHam + CDTerm;
Print[MatrixForm[Simplify[TotalHam]]]
Dimensions[ReducedHam]
Dimensions[CDTerm]
[CapitalOmega]a[t_, t0p_,
Tp_] = (2 (((D[omega[t, t0, T], t])*(omegap[t, t0p, Tp])) - ((omega[
t, t0, T]) (D[omegap[t, t0, T], t]))))/((omegap[t, t0,
T])^2 + (omega[t, t0, T]^2))
[Gamma][t_, t0_, T_, [CurlyPhi]_] =
ArcTan[([CapitalOmega]a[t, t0p, Tp])/([CapitalOmega]eff[t, t0p,
Tp])] + [CurlyPhi];
f1[t_, t0_,
T_, [CurlyPhi]_] = (Exp[(Sqrt[-1]*[Gamma][t, t0,
T, [CurlyPhi]])]/2)
f2[t_, t0_, T_, [CurlyPhi]_] =
Exp[(Sqrt[-1]*[Gamma][t, t0, T, [CurlyPhi]])/2]
U = ({
{f1[t, t0, T, [CurlyPhi]], 0},
{0, f2[t, t0, T, [CurlyPhi]]}
})
Mat5 = ConjugateTranspose[U].TotalHam.U;
Print[MatrixForm[Mat5]]
Mat6 = ConjugateTranspose[U].(D[U, t]);
Print[MatrixForm[Mat6]]
HModified = Mat5 - Mat6;
Print[MatrixForm[Simplify[HModified]]]
matrix error output
$endgroup$
closed as off-topic by Lukas Lang, Henrik Schumacher, m_goldberg, bbgodfrey, Szabolcs Jan 2 at 13:37
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Lukas Lang, Henrik Schumacher, m_goldberg, bbgodfrey, Szabolcs
If this question can be reworded to fit the rules in the help center, please edit the question.
$begingroup$
Mat3isNull, sincePrint[…]always returnsNull. You might be interested inEcho, which always returns its argument. For the next time, try to look at the different values of the expression that containsNull- this way, you can easily trace the error back to its origin (theMat3=Print[…]line in this case). For this,Echois your friend, as you can just put it in front of anything you want to look at
$endgroup$
– Lukas Lang
Dec 28 '18 at 15:33
add a comment |
$begingroup$
Whenever I execute the code, portions of the output are null. How can I fix this? I am not sure the extent to which the result is invalid because I am not entirely familiar with the null output, though I have read the documentation. The point in which this problem arises is labeled in the following code:
omega[t_, t0_, T_] = Exp[(-(t - t0)^2)/T^2];
omegap[t_, t0p_, Tp_] = Exp[-((t - t0p)^2)/Tp^2];
eff[t_, t0p_,
Tp_] = ((omega[t, t0, T])^2 - (omegap[t, t0p,
Tp])^2)/(2 [CapitalDelta]);
eff[t_, t0p_,
Tp_] = (omegap[t, t0p, Tp]*omega[t, t0, T])/([CapitalDelta]);
ReducedHam = ({
{[CapitalDelta]eff[t, t0p, Tp], [CapitalOmega]eff[t, t0p, Tp]*
Exp[Sqrt[-1]*[CurlyPhi]]},
{[CapitalOmega]eff[t, t0p, Tp]*
Exp[-Sqrt[-1]*[CurlyPhi]], -[CapitalDelta]eff[t, t0p, Tp]}
});
Print[MatrixForm[ReducedHam]]
[Theta][t_, t0p_, Tp_] = ArcTan[omegap[t, t0p, Tp]/omega[t, t0, T]];
[Lambda]1 = ({
{Cos[[Theta]]},
{-Sin[[Theta]]*Exp[-Sqrt[-1]*[CurlyPhi]]}
});
[Lambda]2 = ({
{Sin[[Theta]]*Exp[Sqrt[-1]*[CurlyPhi]]},
{Cos[[Theta]]}
});
Print[MatrixForm[[Lambda]1]]
Print[MatrixForm[[Lambda]2]]
Mat1 = (D[[Lambda]1, [Theta]]).(Transpose[[Lambda]1]);
Print[Mat1]
V1 = Transpose[[Lambda]1].D[[Lambda]1, [Theta]];
V2 = [Lambda]1.Transpose[[Lambda]1];
Print[MatrixForm[V2]]
Mat2 = V1[[1, 1]] V2;
Print[Mat2]
Dimensions[Mat2];
Mat12 = Mat1 - Mat2;
Print[MatrixForm[Mat12]]
Mat3 = Print[
MatrixForm[D[[Lambda]2, [Theta]].Transpose[[Lambda]2]]];
V3 = Transpose[[Lambda]2].D[[Lambda]2, [Theta]];
V4 = [Lambda]2.Transpose[[Lambda]2];
Print[MatrixForm[V4]]
Mat4 = V3[[1, 1]] V4;
Print[MatrixForm[Mat4]]
Mat34 = Mat3 - Mat4;
CDTerm = Mat12 + Mat34 ;
Print[MatrixForm[Simplify[CDTerm]]]
(*this is where null arises*)
TotalHam = ReducedHam + CDTerm;
Print[MatrixForm[Simplify[TotalHam]]]
Dimensions[ReducedHam]
Dimensions[CDTerm]
[CapitalOmega]a[t_, t0p_,
Tp_] = (2 (((D[omega[t, t0, T], t])*(omegap[t, t0p, Tp])) - ((omega[
t, t0, T]) (D[omegap[t, t0, T], t]))))/((omegap[t, t0,
T])^2 + (omega[t, t0, T]^2))
[Gamma][t_, t0_, T_, [CurlyPhi]_] =
ArcTan[([CapitalOmega]a[t, t0p, Tp])/([CapitalOmega]eff[t, t0p,
Tp])] + [CurlyPhi];
f1[t_, t0_,
T_, [CurlyPhi]_] = (Exp[(Sqrt[-1]*[Gamma][t, t0,
T, [CurlyPhi]])]/2)
f2[t_, t0_, T_, [CurlyPhi]_] =
Exp[(Sqrt[-1]*[Gamma][t, t0, T, [CurlyPhi]])/2]
U = ({
{f1[t, t0, T, [CurlyPhi]], 0},
{0, f2[t, t0, T, [CurlyPhi]]}
})
Mat5 = ConjugateTranspose[U].TotalHam.U;
Print[MatrixForm[Mat5]]
Mat6 = ConjugateTranspose[U].(D[U, t]);
Print[MatrixForm[Mat6]]
HModified = Mat5 - Mat6;
Print[MatrixForm[Simplify[HModified]]]
matrix error output
$endgroup$
Whenever I execute the code, portions of the output are null. How can I fix this? I am not sure the extent to which the result is invalid because I am not entirely familiar with the null output, though I have read the documentation. The point in which this problem arises is labeled in the following code:
omega[t_, t0_, T_] = Exp[(-(t - t0)^2)/T^2];
omegap[t_, t0p_, Tp_] = Exp[-((t - t0p)^2)/Tp^2];
eff[t_, t0p_,
Tp_] = ((omega[t, t0, T])^2 - (omegap[t, t0p,
Tp])^2)/(2 [CapitalDelta]);
eff[t_, t0p_,
Tp_] = (omegap[t, t0p, Tp]*omega[t, t0, T])/([CapitalDelta]);
ReducedHam = ({
{[CapitalDelta]eff[t, t0p, Tp], [CapitalOmega]eff[t, t0p, Tp]*
Exp[Sqrt[-1]*[CurlyPhi]]},
{[CapitalOmega]eff[t, t0p, Tp]*
Exp[-Sqrt[-1]*[CurlyPhi]], -[CapitalDelta]eff[t, t0p, Tp]}
});
Print[MatrixForm[ReducedHam]]
[Theta][t_, t0p_, Tp_] = ArcTan[omegap[t, t0p, Tp]/omega[t, t0, T]];
[Lambda]1 = ({
{Cos[[Theta]]},
{-Sin[[Theta]]*Exp[-Sqrt[-1]*[CurlyPhi]]}
});
[Lambda]2 = ({
{Sin[[Theta]]*Exp[Sqrt[-1]*[CurlyPhi]]},
{Cos[[Theta]]}
});
Print[MatrixForm[[Lambda]1]]
Print[MatrixForm[[Lambda]2]]
Mat1 = (D[[Lambda]1, [Theta]]).(Transpose[[Lambda]1]);
Print[Mat1]
V1 = Transpose[[Lambda]1].D[[Lambda]1, [Theta]];
V2 = [Lambda]1.Transpose[[Lambda]1];
Print[MatrixForm[V2]]
Mat2 = V1[[1, 1]] V2;
Print[Mat2]
Dimensions[Mat2];
Mat12 = Mat1 - Mat2;
Print[MatrixForm[Mat12]]
Mat3 = Print[
MatrixForm[D[[Lambda]2, [Theta]].Transpose[[Lambda]2]]];
V3 = Transpose[[Lambda]2].D[[Lambda]2, [Theta]];
V4 = [Lambda]2.Transpose[[Lambda]2];
Print[MatrixForm[V4]]
Mat4 = V3[[1, 1]] V4;
Print[MatrixForm[Mat4]]
Mat34 = Mat3 - Mat4;
CDTerm = Mat12 + Mat34 ;
Print[MatrixForm[Simplify[CDTerm]]]
(*this is where null arises*)
TotalHam = ReducedHam + CDTerm;
Print[MatrixForm[Simplify[TotalHam]]]
Dimensions[ReducedHam]
Dimensions[CDTerm]
[CapitalOmega]a[t_, t0p_,
Tp_] = (2 (((D[omega[t, t0, T], t])*(omegap[t, t0p, Tp])) - ((omega[
t, t0, T]) (D[omegap[t, t0, T], t]))))/((omegap[t, t0,
T])^2 + (omega[t, t0, T]^2))
[Gamma][t_, t0_, T_, [CurlyPhi]_] =
ArcTan[([CapitalOmega]a[t, t0p, Tp])/([CapitalOmega]eff[t, t0p,
Tp])] + [CurlyPhi];
f1[t_, t0_,
T_, [CurlyPhi]_] = (Exp[(Sqrt[-1]*[Gamma][t, t0,
T, [CurlyPhi]])]/2)
f2[t_, t0_, T_, [CurlyPhi]_] =
Exp[(Sqrt[-1]*[Gamma][t, t0, T, [CurlyPhi]])/2]
U = ({
{f1[t, t0, T, [CurlyPhi]], 0},
{0, f2[t, t0, T, [CurlyPhi]]}
})
Mat5 = ConjugateTranspose[U].TotalHam.U;
Print[MatrixForm[Mat5]]
Mat6 = ConjugateTranspose[U].(D[U, t]);
Print[MatrixForm[Mat6]]
HModified = Mat5 - Mat6;
Print[MatrixForm[Simplify[HModified]]]
matrix error output
matrix error output
asked Dec 28 '18 at 15:15
khaylablackkhaylablack
111
111
closed as off-topic by Lukas Lang, Henrik Schumacher, m_goldberg, bbgodfrey, Szabolcs Jan 2 at 13:37
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Lukas Lang, Henrik Schumacher, m_goldberg, bbgodfrey, Szabolcs
If this question can be reworded to fit the rules in the help center, please edit the question.
closed as off-topic by Lukas Lang, Henrik Schumacher, m_goldberg, bbgodfrey, Szabolcs Jan 2 at 13:37
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Lukas Lang, Henrik Schumacher, m_goldberg, bbgodfrey, Szabolcs
If this question can be reworded to fit the rules in the help center, please edit the question.
$begingroup$
Mat3isNull, sincePrint[…]always returnsNull. You might be interested inEcho, which always returns its argument. For the next time, try to look at the different values of the expression that containsNull- this way, you can easily trace the error back to its origin (theMat3=Print[…]line in this case). For this,Echois your friend, as you can just put it in front of anything you want to look at
$endgroup$
– Lukas Lang
Dec 28 '18 at 15:33
add a comment |
$begingroup$
Mat3isNull, sincePrint[…]always returnsNull. You might be interested inEcho, which always returns its argument. For the next time, try to look at the different values of the expression that containsNull- this way, you can easily trace the error back to its origin (theMat3=Print[…]line in this case). For this,Echois your friend, as you can just put it in front of anything you want to look at
$endgroup$
– Lukas Lang
Dec 28 '18 at 15:33
$begingroup$
Mat3 is Null, since Print[…] always returns Null. You might be interested in Echo, which always returns its argument. For the next time, try to look at the different values of the expression that contains Null - this way, you can easily trace the error back to its origin (the Mat3=Print[…] line in this case). For this, Echo is your friend, as you can just put it in front of anything you want to look at$endgroup$
– Lukas Lang
Dec 28 '18 at 15:33
$begingroup$
Mat3 is Null, since Print[…] always returns Null. You might be interested in Echo, which always returns its argument. For the next time, try to look at the different values of the expression that contains Null - this way, you can easily trace the error back to its origin (the Mat3=Print[…] line in this case). For this, Echo is your friend, as you can just put it in front of anything you want to look at$endgroup$
– Lukas Lang
Dec 28 '18 at 15:33
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
Just leave out the Print functions, and remember not to throw away the results with ;. Example:
m1 = IdentityMatrix[3];
MatrixForm[m1]
m2 = 3 m1;
MatrixForm[m2]

Most experienced Mathematica users rarely use Print. To show results, just evaluate them.
A more compact, functional form is:
MatrixForm[m1 = IdentityMatrix[3]]
MatrixForm[m2 = 3 m1]
Same output as above.
$endgroup$
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Just leave out the Print functions, and remember not to throw away the results with ;. Example:
m1 = IdentityMatrix[3];
MatrixForm[m1]
m2 = 3 m1;
MatrixForm[m2]

Most experienced Mathematica users rarely use Print. To show results, just evaluate them.
A more compact, functional form is:
MatrixForm[m1 = IdentityMatrix[3]]
MatrixForm[m2 = 3 m1]
Same output as above.
$endgroup$
add a comment |
$begingroup$
Just leave out the Print functions, and remember not to throw away the results with ;. Example:
m1 = IdentityMatrix[3];
MatrixForm[m1]
m2 = 3 m1;
MatrixForm[m2]

Most experienced Mathematica users rarely use Print. To show results, just evaluate them.
A more compact, functional form is:
MatrixForm[m1 = IdentityMatrix[3]]
MatrixForm[m2 = 3 m1]
Same output as above.
$endgroup$
add a comment |
$begingroup$
Just leave out the Print functions, and remember not to throw away the results with ;. Example:
m1 = IdentityMatrix[3];
MatrixForm[m1]
m2 = 3 m1;
MatrixForm[m2]

Most experienced Mathematica users rarely use Print. To show results, just evaluate them.
A more compact, functional form is:
MatrixForm[m1 = IdentityMatrix[3]]
MatrixForm[m2 = 3 m1]
Same output as above.
$endgroup$
Just leave out the Print functions, and remember not to throw away the results with ;. Example:
m1 = IdentityMatrix[3];
MatrixForm[m1]
m2 = 3 m1;
MatrixForm[m2]

Most experienced Mathematica users rarely use Print. To show results, just evaluate them.
A more compact, functional form is:
MatrixForm[m1 = IdentityMatrix[3]]
MatrixForm[m2 = 3 m1]
Same output as above.
edited Dec 28 '18 at 16:45
answered Dec 28 '18 at 16:20
John DotyJohn Doty
7,11811024
7,11811024
add a comment |
add a comment |
$begingroup$
Mat3isNull, sincePrint[…]always returnsNull. You might be interested inEcho, which always returns its argument. For the next time, try to look at the different values of the expression that containsNull- this way, you can easily trace the error back to its origin (theMat3=Print[…]line in this case). For this,Echois your friend, as you can just put it in front of anything you want to look at$endgroup$
– Lukas Lang
Dec 28 '18 at 15:33