When I run this code, Nk displays simple numerical values for n=1,2,4 and 5, but displays a value for n=3 that is instead an equation (consisting of only numbers, no variables). The solution to the equation is of the same order as the other numerical values, so the issues doesn't seem to be catastrophic cancellation or something of that ilk: Wolfram
Code:
for n = 1:5k = 50.37; % Constant at start of N
T = 1e16; % Characteristic energy scale
B = 3.495e67; % constant for potential
L1 = (2*n*(2*n-1))^(n/4); %top of log for 1st half of N
L2 = (2*N+2*n-1)/(2*n-1); %second log
VA = (2*n*(2*N+2*n-1))^(n+1); %algebra for V
V = (B*n^2)./VA;V2 = ((T^2*exp(2*(N-k)))./(L1^2*L2^2))^2;Nk=solve(V-V2 == 0) %assings solution to N*
VA2 = (2*n*(2*Nk+2*n-1))^(n+1); %redefines VA in terms of Nk
V0 = ((B*Nk^2)./VA2)^(1/4) %solution to V0
endT=table(Nk,V0)
Output:
1Nk =54.587520560507798727717301906819V0 =38269419168929696.686353001207992 2Nk =53.033456412586034572167306062259V0 =5865729109906268.5364512437212995 3Nk =log((568392988925525712716364010727016105677005258752*exp(5037/25))/542101086242752217003726400434970855712890625)/4V0 =((2184375000000000050682263628770112625380923754565506923392495779840*log((568392988925525712716364010727016105677005258752*exp(5037/25))/542101086242752217003726400434970855712890625)^2)/(3*log((568392988925525712716364010727016105677005258752*exp(5037/25))/542101086242752217003726400434970855712890625) + 30)^4)^(1/4) 4Nk =51.408355779435985633476452024765V0 =115260533332952.51336375186114595 5Nk =50.834875713866133896178560340504V0 =14890156979567.434795879619732417T = Nk V0 _________ _________ [1x1 sym] [1x1 sym]
I am using R2014a.
Any help would be appreciated,
Thanks
Best Answer