You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
How introduce column vector in M-file?
2 views (last 30 days)
Show older comments
how I improved my file to get { temp1<<1}, I am stuck here.
i gto sugestion to introduce column vector for temp0 but i am fail in this stage
7 Comments
Walter Roberson
on 19 Feb 2023
ket = sum(tmpI(:,2:D),2);
The sum over the second dimension of a 2d array is going to be a column vector.
temp0 = symsum(exp(-abs(alpha(k))^2 * alpha(k)^n / sqrt(factorial(n)) ), n, 0, 14)*ket;
symsum of a scalar expression is going to give a scalar result. You then multiply by the column vector, and that will give you a column vector result.
It therefore appears that your temp0 is already a column vector.
Image Analyst
on 19 Feb 2023
whos temp1
What does that show? Does it show many rows and 1 column?
Abu Zar
on 19 Feb 2023
Edited: Abu Zar
on 19 Feb 2023
modify this?thanks
disp(temp1)
0
- (9*exp(-(94143178827*479001600^(1/2))/1203125000000000000000000000000))/50 - (9*exp(-(3486784401*3628800^(1/2))/10937500000000000000000000))/50 - (9*exp(-(1594323*120^(1/2))/31250000000000))/50 - (9*exp(-(7625597484987*87178291200^(1/2))/547421875000000000000000000000000000))/50 - (9*exp(-(6561*2^(1/2))/12500000))/50 - (9*exp(-(177147*24^(1/2))/125000000000))/50 - (9*exp(-(19683*6^(1/2))/625000000))/50 - (9*exp(-81/2500))/50 - (9*exp(-729/125000))/50 - (9*exp(-(387420489*362880^(1/2))/21875000000000000000000))/50 - (9*exp(-(43046721*5040^(1/2))/1093750000000000000))/50 - (9*exp(-(847288609443*6227020800^(1/2))/782031250000000000000000000000000))/50 - (9*exp(-(387420489*40320^(1/2))/437500000000000000000))/50 - (9*exp(-(31381059609*39916800^(1/2))/6015625000000000000000000000))/50 - (9*exp(-(4782969*720^(1/2))/3125000000000000))/50
2^(1/2)*(exp(-(94143178827*479001600^(1/2))/1203125000000000000000000000000) + exp(-(3486784401*3628800^(1/2))/10937500000000000000000000) + exp(-(1594323*120^(1/2))/31250000000000) + exp(-(7625597484987*87178291200^(1/2))/547421875000000000000000000000000000) + exp(-(6561*2^(1/2))/12500000) + exp(-(177147*24^(1/2))/125000000000) + exp(-(19683*6^(1/2))/625000000) + exp(-81/2500) + exp(-729/125000) + exp(-(387420489*362880^(1/2))/21875000000000000000000) + exp(-(43046721*5040^(1/2))/1093750000000000000) + exp(-(847288609443*6227020800^(1/2))/782031250000000000000000000000000) + exp(-(387420489*40320^(1/2))/437500000000000000000) + exp(-(31381059609*39916800^(1/2))/6015625000000000000000000000) + exp(-(4782969*720^(1/2))/3125000000000000)) - (9*exp(-(3486784401*3628800^(1/2))/10937500000000000000000000))/50 - (9*exp(-(1594323*120^(1/2))/31250000000000))/50 - (9*exp(-(7625597484987*87178291200^(1/2))/547421875000000000000000000000000000))/50 - (9*exp(-(6561*2^(1/2))/12500000))/50 - (9*exp(-(177147*24^(1/2))/125000000000))/50 - (9*exp(-(19683*6^(1/2))/625000000))/50 - (9*exp(-81/2500))/50 - (9*exp(-729/125000))/50 - (9*exp(-(387420489*362880^(1/2))/21875000000000000000000))/50 - (9*exp(-(43046721*5040^(1/2))/1093750000000000000))/50 - (9*exp(-(847288609443*6227020800^(1/2))/782031250000000000000000000000000))/50 - (9*exp(-(387420489*40320^(1/2))/437500000000000000000))/50 - (9*exp(-(31381059609*39916800^(1/2))/6015625000000000000000000000))/50 - (9*exp(-(4782969*720^(1/2))/3125000000000000))/50 - (9*exp(-(94143178827*479001600^(1/2))/1203125000000000000000000000000))/50
3^(1/2)*(exp(-(94143178827*479001600^(1/2))/1203125000000000000000000000000) + exp(-(3486784401*3628800^(1/2))/10937500000000000000000000) + exp(-(1594323*120^(1/2))/31250000000000) + exp(-(7625597484987*87178291200^(1/2))/547421875000000000000000000000000000) + exp(-(6561*2^(1/2))/12500000) + exp(-(177147*24^(1/2))/125000000000) + exp(-(19683*6^(1/2))/625000000) + exp(-81/2500) + exp(-729/125000) + exp(-(387420489*362880^(1/2))/21875000000000000000000) + exp(-(43046721*5040^(1/2))/1093750000000000000) + exp(-(847288609443*6227020800^(1/2))/782031250000000000000000000000000) + exp(-(387420489*40320^(1/2))/437500000000000000000) + exp(-(31381059609*39916800^(1/2))/6015625000000000000000000000) + exp(-(4782969*720^(1/2))/3125000000000000)) - (9*exp(-(3486784401*3628800^(1/2))/10937500000000000000000000))/50 - (9*exp(-(1594323*120^(1/2))/31250000000000))/50 - (9*exp(-(7625597484987*87178291200^(1/2))/547421875000000000000000000000000000))/50 - (9*exp(-(6561*2^(1/2))/12500000))/50 - (9*exp(-(177147*24^(1/2))/125000000000))/50 - (9*exp(-(19683*6^(1/2))/625000000))/50 - (9*exp(-81/2500))/50 - (9*exp(-729/125000))/50 - (9*exp(-(387420489*362880^(1/2))/21875000000000000000000))/50 - (9*exp(-(43046721*5040^(1/2))/1093750000000000000))/50 - (9*exp(-(847288609443*6227020800^(1/2))/782031250000000000000000000000000))/50 - (9*exp(-(387420489*40320^(1/2))/437500000000000000000))/50 - (9*exp(-(31381059609*39916800^(1/2))/6015625000000000000000000000))/50 - (9*exp(-(4782969*720^(1/2))/3125000000000000))/50 - (9*exp(-(94143178827*479001600^(1/2))/1203125000000000000000000000000))/50
(91*exp(-(94143178827*479001600^(1/2))/1203125000000000000000000000000))/50 + (91*exp(-(3486784401*3628800^(1/2))/10937500000000000000000000))/50 + (91*exp(-(1594323*120^(1/2))/31250000000000))/50 + (91*exp(-(7625597484987*87178291200^(1/2))/547421875000000000000000000000000000))/50 + (91*exp(-(6561*2^(1/2))/12500000))/50 + (91*exp(-(177147*24^(1/2))/125000000000))/50 + (91*exp(-(19683*6^(1/2))/625000000))/50 + (91*exp(-81/2500))/50 + (91*exp(-729/125000))/50 + (91*exp(-(387420489*362880^(1/2))/21875000000000000000000))/50 + (91*exp(-(43046721*5040^(1/2))/1093750000000000000))/50 + (91*exp(-(847288609443*6227020800^(1/2))/782031250000000000000000000000000))/50 + (91*exp(-(387420489*40320^(1/2))/437500000000000000000))/50 + (91*exp(-(31381059609*39916800^(1/2))/6015625000000000000000000000))/50 + (91*exp(-(4782969*720^(1/2))/3125000000000000))/50
5^(1/2)*(exp(-(94143178827*479001600^(1/2))/1203125000000000000000000000000) + exp(-(3486784401*3628800^(1/2))/10937500000000000000000000) + exp(-(1594323*120^(1/2))/31250000000000) + exp(-(7625597484987*87178291200^(1/2))/547421875000000000000000000000000000) + exp(-(6561*2^(1/2))/12500000) + exp(-(177147*24^(1/2))/125000000000) + exp(-(19683*6^(1/2))/625000000) + exp(-81/2500) + exp(-729/125000) + exp(-(387420489*362880^(1/2))/21875000000000000000000) + exp(-(43046721*5040^(1/2))/1093750000000000000) + exp(-(847288609443*6227020800^(1/2))/782031250000000000000000000000000) + exp(-(387420489*40320^(1/2))/437500000000000000000) + exp(-(31381059609*39916800^(1/2))/6015625000000000000000000000) + exp(-(4782969*720^(1/2))/3125000000000000)) - (9*exp(-(3486784401*3628800^(1/2))/10937500000000000000000000))/50 - (9*exp(-(1594323*120^(1/2))/31250000000000))/50 - (9*exp(-(7625597484987*87178291200^(1/2))/547421875000000000000000000000000000))/50 - (9*exp(-(6561*2^(1/2))/12500000))/50 - (9*exp(-(177147*24^(1/2))/125000000000))/50 - (9*exp(-(19683*6^(1/2))/625000000))/50 - (9*exp(-81/2500))/50 - (9*exp(-729/125000))/50 - (9*exp(-(387420489*362880^(1/2))/21875000000000000000000))/50 - (9*exp(-(43046721*5040^(1/2))/1093750000000000000))/50 - (9*exp(-(847288609443*6227020800^(1/2))/782031250000000000000000000000000))/50 - (9*exp(-(387420489*40320^(1/2))/437500000000000000000))/50 - (9*exp(-(31381059609*39916800^(1/2))/6015625000000000000000000000))/50 - (9*exp(-(4782969*720^(1/2))/3125000000000000))/50 - (9*exp(-(94143178827*479001600^(1/2))/1203125000000000000000000000000))/50
6^(1/2)*(exp(-(94143178827*479001600^(1/2))/1203125000000000000000000000000) + exp(-(3486784401*3628800^(1/2))/10937500000000000000000000) + exp(-(1594323*120^(1/2))/31250000000000) + exp(-(7625597484987*87178291200^(1/2))/547421875000000000000000000000000000) + exp(-(6561*2^(1/2))/12500000) + exp(-(177147*24^(1/2))/125000000000) + exp(-(19683*6^(1/2))/625000000) + exp(-81/2500) + exp(-729/125000) + exp(-(387420489*362880^(1/2))/21875000000000000000000) + exp(-(43046721*5040^(1/2))/1093750000000000000) + exp(-(847288609443*6227020800^(1/2))/782031250000000000000000000000000) + exp(-(387420489*40320^(1/2))/437500000000000000000) + exp(-(31381059609*39916800^(1/2))/6015625000000000000000000000) + exp(-(4782969*720^(1/2))/3125000000000000)) - (9*exp(-(3486784401*3628800^(1/2))/10937500000000000000000000))/50 - (9*exp(-(1594323*120^(1/2))/31250000000000))/50 - (9*exp(-(7625597484987*87178291200^(1/2))/547421875000000000000000000000000000))/50 - (9*exp(-(6561*2^(1/2))/12500000))/50 - (9*exp(-(177147*24^(1/2))/125000000000))/50 - (9*exp(-(19683*6^(1/2))/625000000))/50 - (9*exp(-81/2500))/50 - (9*exp(-729/125000))/50 - (9*exp(-(387420489*362880^(1/2))/21875000000000000000000))/50 - (9*exp(-(43046721*5040^(1/2))/1093750000000000000))/50 - (9*exp(-(847288609443*6227020800^(1/2))/782031250000000000000000000000000))/50 - (9*exp(-(387420489*40320^(1/2))/437500000000000000000))/50 - (9*exp(-(31381059609*39916800^(1/2))/6015625000000000000000000000))/50 - (9*exp(-(4782969*720^(1/2))/3125000000000000))/50 - (9*exp(-(94143178827*479001600^(1/2))/1203125000000000000000000000000))/50
7^(1/2)*(exp(-(94143178827*479001600^(1/2))/1203125000000000000000000000000) + exp(-(3486784401*3628800^(1/2))/10937500000000000000000000) + exp(-(1594323*120^(1/2))/31250000000000) + exp(-(7625597484987*87178291200^(1/2))/547421875000000000000000000000000000) + exp(-(6561*2^(1/2))/12500000) + exp(-(177147*24^(1/2))/125000000000) + exp(-(19683*6^(1/2))/625000000) + exp(-81/2500) + exp(-729/125000) + exp(-(387420489*362880^(1/2))/21875000000000000000000) + exp(-(43046721*5040^(1/2))/1093750000000000000) + exp(-(847288609443*6227020800^(1/2))/782031250000000000000000000000000) + exp(-(387420489*40320^(1/2))/437500000000000000000) + exp(-(31381059609*39916800^(1/2))/6015625000000000000000000000) + exp(-(4782969*720^(1/2))/3125000000000000)) - (9*exp(-(3486784401*3628800^(1/2))/10937500000000000000000000))/50 - (9*exp(-(1594323*120^(1/2))/31250000000000))/50 - (9*exp(-(7625597484987*87178291200^(1/2))/547421875000000000000000000000000000))/50 - (9*exp(-(6561*2^(1/2))/12500000))/50 - (9*exp(-(177147*24^(1/2))/125000000000))/50 - (9*exp(-(19683*6^(1/2))/625000000))/50 - (9*exp(-81/2500))/50 - (9*exp(-729/125000))/50 - (9*exp(-(387420489*362880^(1/2))/21875000000000000000000))/50 - (9*exp(-(43046721*5040^(1/2))/1093750000000000000))/50 - (9*exp(-(847288609443*6227020800^(1/2))/782031250000000000000000000000000))/50 - (9*exp(-(387420489*40320^(1/2))/437500000000000000000))/50 - (9*exp(-(31381059609*39916800^(1/2))/6015625000000000000000000000))/50 - (9*exp(-(4782969*720^(1/2))/3125000000000000))/50 - (9*exp(-(94143178827*479001600^(1/2))/1203125000000000000000000000000))/50
2*2^(1/2)*(exp(-(94143178827*479001600^(1/2))/1203125000000000000000000000000) + exp(-(3486784401*3628800^(1/2))/10937500000000000000000000) + exp(-(1594323*120^(1/2))/31250000000000) + exp(-(7625597484987*87178291200^(1/2))/547421875000000000000000000000000000) + exp(-(6561*2^(1/2))/12500000) + exp(-(177147*24^(1/2))/125000000000) + exp(-(19683*6^(1/2))/625000000) + exp(-81/2500) + exp(-729/125000) + exp(-(387420489*362880^(1/2))/21875000000000000000000) + exp(-(43046721*5040^(1/2))/1093750000000000000) + exp(-(847288609443*6227020800^(1/2))/782031250000000000000000000000000) + exp(-(387420489*40320^(1/2))/437500000000000000000) + exp(-(31381059609*39916800^(1/2))/6015625000000000000000000000) + exp(-(4782969*720^(1/2))/3125000000000000)) - (9*exp(-(3486784401*3628800^(1/2))/10937500000000000000000000))/50 - (9*exp(-(1594323*120^(1/2))/31250000000000))/50 - (9*exp(-(7625597484987*87178291200^(1/2))/547421875000000000000000000000000000))/50 - (9*exp(-(6561*2^(1/2))/12500000))/50 - (9*exp(-(177147*24^(1/2))/125000000000))/50 - (9*exp(-(19683*6^(1/2))/625000000))/50 - (9*exp(-81/2500))/50 - (9*exp(-729/125000))/50 - (9*exp(-(387420489*362880^(1/2))/21875000000000000000000))/50 - (9*exp(-(43046721*5040^(1/2))/1093750000000000000))/50 - (9*exp(-(847288609443*6227020800^(1/2))/782031250000000000000000000000000))/50 - (9*exp(-(387420489*40320^(1/2))/437500000000000000000))/50 - (9*exp(-(31381059609*39916800^(1/2))/6015625000000000000000000000))/50 - (9*exp(-(4782969*720^(1/2))/3125000000000000))/50 - (9*exp(-(94143178827*479001600^(1/2))/1203125000000000000000000000000))/50
(141*exp(-(94143178827*479001600^(1/2))/1203125000000000000000000000000))/50 + (141*exp(-(3486784401*3628800^(1/2))/10937500000000000000000000))/50 + (141*exp(-(1594323*120^(1/2))/31250000000000))/50 + (141*exp(-(7625597484987*87178291200^(1/2))/547421875000000000000000000000000000))/50 + (141*exp(-(6561*2^(1/2))/12500000))/50 + (141*exp(-(177147*24^(1/2))/125000000000))/50 + (141*exp(-(19683*6^(1/2))/625000000))/50 + (141*exp(-81/2500))/50 + (141*exp(-729/125000))/50 + (141*exp(-(387420489*362880^(1/2))/21875000000000000000000))/50 + (141*exp(-(43046721*5040^(1/2))/1093750000000000000))/50 + (141*exp(-(847288609443*6227020800^(1/2))/782031250000000000000000000000000))/50 + (141*exp(-(387420489*40320^(1/2))/437500000000000000000))/50 + (141*exp(-(31381059609*39916800^(1/2))/6015625000000000000000000000))/50 + (141*exp(-(4782969*720^(1/2))/3125000000000000))/50
10^(1/2)*(exp(-(94143178827*479001600^(1/2))/1203125000000000000000000000000) + exp(-(3486784401*3628800^(1/2))/10937500000000000000000000) + exp(-(1594323*120^(1/2))/31250000000000) + exp(-(7625597484987*87178291200^(1/2))/547421875000000000000000000000000000) + exp(-(6561*2^(1/2))/12500000) + exp(-(177147*24^(1/2))/125000000000) + exp(-(19683*6^(1/2))/625000000) + exp(-81/2500) + exp(-729/125000) + exp(-(387420489*362880^(1/2))/21875000000000000000000) + exp(-(43046721*5040^(1/2))/1093750000000000000) + exp(-(847288609443*6227020800^(1/2))/782031250000000000000000000000000) + exp(-(387420489*40320^(1/2))/437500000000000000000) + exp(-(31381059609*39916800^(1/2))/6015625000000000000000000000) + exp(-(4782969*720^(1/2))/3125000000000000)) - (9*exp(-(3486784401*3628800^(1/2))/10937500000000000000000000))/50 - (9*exp(-(1594323*120^(1/2))/31250000000000))/50 - (9*exp(-(7625597484987*87178291200^(1/2))/547421875000000000000000000000000000))/50 - (9*exp(-(6561*2^(1/2))/12500000))/50 - (9*exp(-(177147*24^(1/2))/125000000000))/50 - (9*exp(-(19683*6^(1/2))/625000000))/50 - (9*exp(-81/2500))/50 - (9*exp(-729/125000))/50 - (9*exp(-(387420489*362880^(1/2))/21875000000000000000000))/50 - (9*exp(-(43046721*5040^(1/2))/1093750000000000000))/50 - (9*exp(-(847288609443*6227020800^(1/2))/782031250000000000000000000000000))/50 - (9*exp(-(387420489*40320^(1/2))/437500000000000000000))/50 - (9*exp(-(31381059609*39916800^(1/2))/6015625000000000000000000000))/50 - (9*exp(-(4782969*720^(1/2))/3125000000000000))/50 - (9*exp(-(94143178827*479001600^(1/2))/1203125000000000000000000000000))/50
11^(1/2)*(exp(-(94143178827*479001600^(1/2))/1203125000000000000000000000000) + exp(-(3486784401*3628800^(1/2))/10937500000000000000000000) + exp(-(1594323*120^(1/2))/31250000000000) + exp(-(7625597484987*87178291200^(1/2))/547421875000000000000000000000000000) + exp(-(6561*2^(1/2))/12500000) + exp(-(177147*24^(1/2))/125000000000) + exp(-(19683*6^(1/2))/625000000) + exp(-81/2500) + exp(-729/125000) + exp(-(387420489*362880^(1/2))/21875000000000000000000) + exp(-(43046721*5040^(1/2))/1093750000000000000) + exp(-(847288609443*6227020800^(1/2))/782031250000000000000000000000000) + exp(-(387420489*40320^(1/2))/437500000000000000000) + exp(-(31381059609*39916800^(1/2))/6015625000000000000000000000) + exp(-(4782969*720^(1/2))/3125000000000000)) - (9*exp(-(3486784401*3628800^(1/2))/10937500000000000000000000))/50 - (9*exp(-(1594323*120^(1/2))/31250000000000))/50 - (9*exp(-(7625597484987*87178291200^(1/2))/547421875000000000000000000000000000))/50 - (9*exp(-(6561*2^(1/2))/12500000))/50 - (9*exp(-(177147*24^(1/2))/125000000000))/50 - (9*exp(-(19683*6^(1/2))/625000000))/50 - (9*exp(-81/2500))/50 - (9*exp(-729/125000))/50 - (9*exp(-(387420489*362880^(1/2))/21875000000000000000000))/50 - (9*exp(-(43046721*5040^(1/2))/1093750000000000000))/50 - (9*exp(-(847288609443*6227020800^(1/2))/782031250000000000000000000000000))/50 - (9*exp(-(387420489*40320^(1/2))/437500000000000000000))/50 - (9*exp(-(31381059609*39916800^(1/2))/6015625000000000000000000000))/50 - (9*exp(-(4782969*720^(1/2))/3125000000000000))/50 - (9*exp(-(94143178827*479001600^(1/2))/1203125000000000000000000000000))/50
2*3^(1/2)*(exp(-(94143178827*479001600^(1/2))/1203125000000000000000000000000) + exp(-(3486784401*3628800^(1/2))/10937500000000000000000000) + exp(-(1594323*120^(1/2))/31250000000000) + exp(-(7625597484987*87178291200^(1/2))/547421875000000000000000000000000000) + exp(-(6561*2^(1/2))/12500000) + exp(-(177147*24^(1/2))/125000000000) + exp(-(19683*6^(1/2))/625000000) + exp(-81/2500) + exp(-729/125000) + exp(-(387420489*362880^(1/2))/21875000000000000000000) + exp(-(43046721*5040^(1/2))/1093750000000000000) + exp(-(847288609443*6227020800^(1/2))/782031250000000000000000000000000) + exp(-(387420489*40320^(1/2))/437500000000000000000) + exp(-(31381059609*39916800^(1/2))/6015625000000000000000000000) + exp(-(4782969*720^(1/2))/3125000000000000)) - (9*exp(-(3486784401*3628800^(1/2))/10937500000000000000000000))/50 - (9*exp(-(1594323*120^(1/2))/31250000000000))/50 - (9*exp(-(7625597484987*87178291200^(1/2))/547421875000000000000000000000000000))/50 - (9*exp(-(6561*2^(1/2))/12500000))/50 - (9*exp(-(177147*24^(1/2))/125000000000))/50 - (9*exp(-(19683*6^(1/2))/625000000))/50 - (9*exp(-81/2500))/50 - (9*exp(-729/125000))/50 - (9*exp(-(387420489*362880^(1/2))/21875000000000000000000))/50 - (9*exp(-(43046721*5040^(1/2))/1093750000000000000))/50 - (9*exp(-(847288609443*6227020800^(1/2))/782031250000000000000000000000000))/50 - (9*exp(-(387420489*40320^(1/2))/437500000000000000000))/50 - (9*exp(-(31381059609*39916800^(1/2))/6015625000000000000000000000))/50 - (9*exp(-(4782969*720^(1/2))/3125000000000000))/50 - (9*exp(-(94143178827*479001600^(1/2))/1203125000000000000000000000000))/50
13^(1/2)*(exp(-(94143178827*479001600^(1/2))/1203125000000000000000000000000) + exp(-(3486784401*3628800^(1/2))/10937500000000000000000000) + exp(-(1594323*120^(1/2))/31250000000000) + exp(-(7625597484987*87178291200^(1/2))/547421875000000000000000000000000000) + exp(-(6561*2^(1/2))/12500000) + exp(-(177147*24^(1/2))/125000000000) + exp(-(19683*6^(1/2))/625000000) + exp(-81/2500) + exp(-729/125000) + exp(-(387420489*362880^(1/2))/21875000000000000000000) + exp(-(43046721*5040^(1/2))/1093750000000000000) + exp(-(847288609443*6227020800^(1/2))/782031250000000000000000000000000) + exp(-(387420489*40320^(1/2))/437500000000000000000) + exp(-(31381059609*39916800^(1/2))/6015625000000000000000000000) + exp(-(4782969*720^(1/2))/3125000000000000)) - (9*exp(-(3486784401*3628800^(1/2))/10937500000000000000000000))/50 - (9*exp(-(1594323*120^(1/2))/31250000000000))/50 - (9*exp(-(7625597484987*87178291200^(1/2))/547421875000000000000000000000000000))/50 - (9*exp(-(6561*2^(1/2))/12500000))/50 - (9*exp(-(177147*24^(1/2))/125000000000))/50 - (9*exp(-(19683*6^(1/2))/625000000))/50 - (9*exp(-81/2500))/50 - (9*exp(-729/125000))/50 - (9*exp(-(387420489*362880^(1/2))/21875000000000000000000))/50 - (9*exp(-(43046721*5040^(1/2))/1093750000000000000))/50 - (9*exp(-(847288609443*6227020800^(1/2))/782031250000000000000000000000000))/50 - (9*exp(-(387420489*40320^(1/2))/437500000000000000000))/50 - (9*exp(-(31381059609*39916800^(1/2))/6015625000000000000000000000))/50 - (9*exp(-(4782969*720^(1/2))/3125000000000000))/50 - (9*exp(-(94143178827*479001600^(1/2))/1203125000000000000000000000000))/50
14^(1/2)*(exp(-(94143178827*479001600^(1/2))/1203125000000000000000000000000) + exp(-(3486784401*3628800^(1/2))/10937500000000000000000000) + exp(-(1594323*120^(1/2))/31250000000000) + exp(-(7625597484987*87178291200^(1/2))/547421875000000000000000000000000000) + exp(-(6561*2^(1/2))/12500000) + exp(-(177147*24^(1/2))/125000000000) + exp(-(19683*6^(1/2))/625000000) + exp(-81/2500) + exp(-729/125000) + exp(-(387420489*362880^(1/2))/21875000000000000000000) + exp(-(43046721*5040^(1/2))/1093750000000000000) + exp(-(847288609443*6227020800^(1/2))/782031250000000000000000000000000) + exp(-(387420489*40320^(1/2))/437500000000000000000) + exp(-(31381059609*39916800^(1/2))/6015625000000000000000000000) + exp(-(4782969*720^(1/2))/3125000000000000)) - (9*exp(-(3486784401*3628800^(1/2))/10937500000000000000000000))/50 - (9*exp(-(1594323*120^(1/2))/31250000000000))/50 - (9*exp(-(7625597484987*87178291200^(1/2))/547421875000000000000000000000000000))/50 - (9*exp(-(6561*2^(1/2))/12500000))/50 - (9*exp(-(177147*24^(1/2))/125000000000))/50 - (9*exp(-(19683*6^(1/2))/625000000))/50 - (9*exp(-81/2500))/50 - (9*exp(-729/125000))/50 - (9*exp(-(387420489*362880^(1/2))/21875000000000000000000))/50 - (9*exp(-(43046721*5040^(1/2))/1093750000000000000))/50 - (9*exp(-(847288609443*6227020800^(1/2))/782031250000000000000000000000000))/50 - (9*exp(-(387420489*40320^(1/2))/437500000000000000000))/50 - (9*exp(-(31381059609*39916800^(1/2))/6015625000000000000000000000))/50 - (9*exp(-(4782969*720^(1/2))/3125000000000000))/50 - (9*exp(-(94143178827*479001600^(1/2))/1203125000000000000000000000000))/50
Walter Roberson
on 19 Feb 2023
double() or vpa()
The exp() terms I tested were exp(-1e-9) to exp(-1e-15). Precision is low in that range but the values should be distinguishable from 1.
Accepted Answer
Sulaymon Eshkabilov
on 19 Feb 2023
Here is the corrected code:
D = 15;
tmpI = eye(D);
ket = sum(tmpI(:,2:D),2);
syms n
ct = 6;
creation = circshift(diag(sqrt(0:1:(D-1))),-1);
annihilation = creation';
Vnorm = zeros(1,ct);
alpha = 0.03*(1:ct);
%loop for calculation
for k = 1:ct
temp0 = double(symsum(exp(-abs(alpha(k))^2 * alpha(k)^n / sqrt(factorial(n)) ), n, 0, 14)*ket);
ketalpha(k,:) = temp0; % Data from each iteration is stored
temp1 = annihilation*temp0 - alpha(k)*temp0;
V(k,:) = temp1; % Data from each iteration is stored
Vnorm(k) = temp1'*temp1;
end
plot(alpha,Vnorm, '-*k')
xlim([0 0.21])
xlabel('$\alpha$', 'Interpreter', 'latex', 'Color', 'b', 'FontSize', 15)
ylabel('Vnorm', 'Color', 'b', 'FontSize', 15)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1300260/image.png)
whos temp0 ketalpha temp1 V Vnorm
Name Size Bytes Class Attributes
V 6x15 720 double
Vnorm 1x6 48 double
ketalpha 6x15 720 double
temp0 15x1 120 double
temp1 15x1 120 double
More Answers (0)
See Also
Categories
Find more on Gate-Based Quantum Computing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)