# Generate LogLinearPlot for the following function?

Posted 4 years ago
4261 Views
|
|
0 Total Likes
|
 I am an M.Sc. student doing a project on mathematica. It is an extremely lengthy code but there are no mistakes in the maths part. Somewhere I have done wrong coding and I am not able to find it out. Most likely I have used wrong syntax due to which It is giving me a blank graph. If anyone could help me then it would be a very great help for me. pAA = 0.5*(1 - l) + l pBB = 0.5*(l - 1) + 1 pAB = 1 - pBB pBA = 1 - pAA bA = 0.99*x^2/(3*((1 + (3.92*x^2)/9)^0.5 - 1)) bB = 3.24*10^(-5)*x^2/(3*((1 + (4.2*10^(-9)*x^2)/9)^0.5 - 1)) D1 = (bA + bB)/2 D2 = (bA - bB)/2 alpha = 0.5*(bA + bB)/(bA*bB) beta = 0.5*(bA - bB)/(bA*bB) X = 0.25*beta*x l1 = 0.5*(pAA*Exp[-X] + pBB*Exp[X] + ((pAA*Exp[-X] + pBB*Exp[X])^2 - 4*l)^0.5) l2 = 0.5*(pAA*Exp[-X] + pBB*Exp[X] - ((pAA*Exp[-X] + pBB*Exp[X])^2 - 4*l)^0.5) C1 = 1 + (pAA*Exp[-X] - l1)^2/(pAB*pBA) C2 = 1 + (pAA*Exp[-X] - l2)^2/(pAB*pBA) phi1 = (pAA*Exp[-X] - l1)/(pAB*Exp[-X]) phi1$= (pAA*Exp[-X] - l1)/(pBA*Exp[X]) phi2 = (pAA*Exp[-X] - l2)/(pAB*Exp[-X]) phi2$ = (pAA*Exp[-X] - l2)/(pBA*Exp[X]) shi1 = (pAA*Exp[-X] - l1)/(pAB*Exp[X]) shi1$= (pAA*Exp[-X] - l1)/(pBA*Exp[-X]) shi2 = (pAA*Exp[-X] - l2)/(pAB*Exp[X]) shi2$ = (pAA*Exp[-X] - l2)/(pBA*Exp[-X]) EE = l1^49*(1/C1)*(0.5 - 0.5*phi1$)*(Exp[-X] - phi1*Exp[X]) + l2^49*(1/C2)*(0.5 - 0.5*phi2$)*(Exp[-X] - phi2*Exp[X]) k1 = (Exp[-X]*(1 - phi1)) + (Exp[X]*((-shi1*phi1) + (shi1*phi1*phi1$))) k2 = (-Exp[-X]* shi1$*(1 - phi1)) - (Exp[ X]*((-phi1*shi1*shi1$) + (phi1*phi1$*shi1*shi1$))) k3 = (Exp[-X]*(1 - phi1)) + (Exp[X]*((-shi2*phi1) + (shi2*phi1*phi1$))) k4 = (-Exp[-X]* shi2$*(1 - phi1)) - (Exp[ X]*((-phi1*shi2*shi2$) + (phi1*phi1$*shi2*shi2$))) k5 = (Exp[-X]*(1 - phi2)) + (Exp[X]*((-shi1*phi2) + (shi1*phi2*phi2$))) k6 = (-Exp[-X]* shi1$*(1 - phi2)) - (Exp[ X]*((-phi2*shi1*shi1$) + (phi2*phi2$*shi1*shi1$))) k7 = (Exp[-X]*(1 - phi2)) + (Exp[X]*((-shi2*phi2) + (shi2*phi2*phi2$))) k8 = (-Exp[-X]* shi2$*(1 - phi2)) - (Exp[ X]*((-phi2*shi2*shi2$) + (phi2*phi2$*shi2*shi2$))) T1 = 0.5*(((1/C1)^2)*50*(l1^(49))*(k1 + k2) + ((1/C1)*(1/C2)*((l1^50 - l2^50)/(l1 - l2))*(k3 + k4) + ((1/C1)*(1/C2)*((l2^50 - l1^50)/(l2 - l1))*(k5 + k6)) + ((1/C2)^2)*50*(l2^49)*(k7 + k8))) p1 = (((49*l1^49 - ((49*l1^49 - 49)*(l2/l1)^50))/(1 - (l2/l1))) - (l2/ l1)*((1 - (l2/l1)^49)/(1 - (l2/l1)^2))) p2 = (((49*l2^49 - ((49*l2^49 - 49)*(l2/l1)^50))/(1 - (l2/l1))) - (l1/ l2)*((1 - (l1/l2)^49)/(1 - (l2/l1)^2))) T2 = 0.5*((((1/C1)^2)*1225*(l1^(49))*(k1 + k2) + ((1/C1)*(1/C2)* p1*(k3 + k4) + ((1/C1)*(1/C2)* p2*(k5 + k6)) + ((1/C2)^2)*1225*(l2^(49))*(k7 + k8)))) p3 = (((49*l2^50 - ((49*l2^50 - 48)*(l1/l2)^49))/(1 - (l1/l2))) - (l1/ l2)*((1 - (l1/l2)^48)/(1 - (l1/l2)^2))) p4 = (((49*l1^50 - ((49*l1^50 - 48)*(l2/l1)^49))/(1 - (l2/l1))) - (l2/ l1)*((1 - (l2/l1)^48)/(1 - (l2/l1)^2))) T3 = 0.5*( (((1/C1)^2)*1225*(l1^(49))*(k1 + k2) + ((1/C1)*(1/C2)* p3*(k3 + k4) + ((1/C2)*(1/C1)* p4*(k5 + k6)) + ((1/C2)^2)*1225*(l2^49)*(k7 + k8)))) k9 = (k1*pAA*Exp[-X]) + (k2*pBA*Exp[-X]) k10 = (-k1*pAB*Exp[X]) - (k2*pBB*Exp[X]) k11 = (k3*pAA*Exp[-X]) + (k4*pBA*Exp[-X]) k12 = (-k3*pAB*Exp[X]) - (k4*pBB*Exp[X]) k13 = (k5*pAA*Exp[-X]) + (k6*pBA*Exp[-X]) k14 = (-k5*pAB*Exp[X]) - (k6*pBB*Exp[X]) k15 = (k7*pAA*Exp[-X]) + (k8*pBA*Exp[-X]) k16 = (-k7*pAB*Exp[X]) - (k8*pBB*Exp[X]) k17 = k9 - shi1*k10 - shi1$*k9 + shi1*shi1$*k10 k18 = k9 - shi2*k10 - shi2$*k9 + shi2*shi2$*k10 k19 = k11 - shi1*k12 - shi1$*k11 + shi1*shi1$*k12 k20 = k11 - shi2*k12 - shi2$*k11 + shi2*shi2$*k12 k21 = k13 - shi1*k14 - shi1$*k13 + shi1*shi1$*k14 k22 = k13 - shi2*k14 - shi2$*k13 + shi2*shi2$*k14 k23 = k15 - shi1*k16 - shi1$*k15 + shi1*shi1$*k16 k24 = k15 - shi2*k16 - shi2$*k15 + shi2*shi2$*k16 gec = 1225*l1^48 ged = (((49*l1^48) - (49*l1^48 - 48)*(l2/l1)^49)/(1 - (l2/ l1))) - ((l2/l1)*(1 - (l2/l1)^48)/(1 - (l2/l1))^2) gfc = (((49*l1^48) - (49*l1^48 - 48)*(l2/l1)^49)/(1 - (l2/ l1))) - ((l2/l1)*(1 - (l2/l1)^48)/(1 - (l2/l1))^2) hec = (((49*l1^48) - (49*l1^48 - 48)*(l2/l1)^49)/(1 - (l2/ l1))) - ((l2/l1)*(1 - (l2/l1)^48)/(1 - (l2/l1))^2) gfd = (((49*l2^48) - (49*l2^48 - 48)*(l1/l2)^49)/(1 - (l1/ l2))) - ((l1/l2)*(1 - (l1/l2)^48)/(1 - (l1/l2))^2) hed = (((49*l2^48) - (49*l2^48 - 48)*(l1/l2)^49)/(1 - (l1/ l2))) - ((l1/l2)*(1 - (l1/l2)^48)/(1 - (l1/l2))^2) hfc = (((49*l2^48) - (49*l2^48 - 48)*(l1/l2)^49)/(1 - (l1/ l2))) - ((l1/l2)*(1 - (l1/l2)^48)/(1 - (l1/l2))^2) hfd = 1225*l2^48 T4 = 0.5*(gec*k17 + ged*k18 + gfc*k19 + gfd*k20 + hec*k21 + hed*k22 + hfc*k23 + hfd*k24) f[x_, l_] := ((1.5*50*alpha + 0.25*50*x^2*(alpha^2 + beta^2) - 1.5*(1/EE)*beta*(1 + 0.33*alpha*x^2)*T1 + 0.25*50*49*alpha^2*x^2 - 0.5*(1/EE)*x^2*(alpha*beta*(T2 + T3)) + beta^2*T4)^0.5)/50 p = LogLinearPlot[f[x, 0.0], {x, 0.01, 10^8}, PlotRange -> All]  Attachments:
 Your code has been messed up by copy-and-paste. This is my attempt at inserting multiplication signs * where they seemed to belong: pAA = 0.5*(1 - l) + l; pBB = 0.5*(l - 1) + 1; pAB = 1 - pBB; pBA = 1 - pAA; bA = 0.99 x^2/(3 ((1 + (3.92*x^2)/9)^0.5 - 1)); bB = 3.2410^(-5) x^2/(3 ((1 + (4.210^(-9)*x^2)/9)^0.5 - 1)); D1 = (bA + bB)/2; D2 = (bA - bB)/2; alpha = 0.5 (bA + bB)/(bA*bB); beta = 0.5 (bA - bB)/(bA*bB); X = 0.25 beta*x; l1 = 0.5 (pAA*Exp[-X] + pBB*Exp[X] + ((pAA*Exp[-X] + pBB*Exp[X])^2 - 4 l)^0.5); l2 = 0.5 (pAA*Exp[-X] + pBB*Exp[X] - ((pAA*Exp[-X] + pBB*Exp[X])^2 - 4 l)^0.5); C1 = 1 + (pAA*Exp[-X] - l1)^2/(pAB*pBA); C2 = 1 + (pAA*Exp[-X] - l2)^2/(pAB*pBA); phi1 = (pAA*Exp[-X] - l1)/(pAB*Exp[-X]); phi1$= (pAA*Exp[-X] - l1)/(pBA*Exp[X]); phi2 = (pAA*Exp[-X] - l2)/(pAB*Exp[-X]); phi2$ = (pAA*Exp[-X] - l2)/(pBA*Exp[X]); shi1 = (pAA*Exp[-X] - l1)/(pAB*Exp[X]); shi1$= (pAA*Exp[-X] - l1)/(pBA*Exp[-X]); shi2 = (pAA*Exp[-X] - l2)/(pAB*Exp[X]); shi2$ = (pAA*Exp[-X] - l2)/(pBA*Exp[-X]); EE = l1^49 (1/C1) (0.5 - 0.5 phi1$) (Exp[-X] - phi1*Exp[X]) + l2^49 (1/C2) (0.5 - 0.5 phi2$) (Exp[-X] - phi2*Exp[X]); k1 = (Exp[-X] (1 - phi1)) + (Exp[ X] ((-shi1*phi1) + (shi1*phi1*phi1$))); k2 = (-Exp[-X]* shi1$*(1 - phi1)) - (Exp[ X] ((-phi1*shi1*shi1$) + (phi1*phi1$*shi1*shi1$))); k3 = (Exp[-X] (1 - phi1)) + (Exp[ X] ((-shi2*phi1) + (shi2*phi1*phi1$))); k4 = (-Exp[-X]* shi2$*(1 - phi1)) - (Exp[ X] ((-phi1*shi2*shi2$) + (phi1*phi1$*shi2*shi2$))); k5 = (Exp[-X] (1 - phi2)) + (Exp[ X] ((-shi1*phi2) + (shi1*phi2*phi2$))); k6 = (-Exp[-X]* shi1$*(1 - phi2)) - (Exp[ X] ((-phi2*shi1*shi1$) + (phi2*phi2$*shi1*shi1$))); k7 = (Exp[-X] (1 - phi2)) + (Exp[ X] ((-shi2*phi2) + (shi2*phi2*phi2$))); k8 = (-Exp[-X]* shi2$*(1 - phi2)) - (Exp[ X] ((-phi2*shi2*shi2$) + (phi2*phi2$*shi2*shi2$))); T1 = 0.5 (((1/C1)^2) 50 (l1^(49)) (k1 + k2) + ((1/C1) (1/C2) ((l1^50 - l2^50)/(l1 - l2)) (k3 + k4) + ((1/C1) (1/C2) ((l2^50 - l1^50)/(l2 - l1)) (k5 + k6)) + ((1/C2)^2) 50 (l2^49)*(k7 + k8))); p1 = (((49 l1^49 - ((49 l1^49 - 49)*(l2/l1)^50))/(1 - (l2/l1))) - (l2/ l1)*((1 - (l2/l1)^49)/(1 - (l2/l1)^2))); p2 = (((49 l2^49 - ((49 l2^49 - 49)*(l2/l1)^50))/(1 - (l2/l1))) - (l1/ l2)*((1 - (l1/l2)^49)/(1 - (l2/l1)^2))); T2 = 0.5 ((((1/C1)^2) 1225 (l1^(49)) (k1 + k2) + ((1/C1) (1/C2) p1 (k3 + k4) + ((1/C1) (1/C2)* p2 (k5 + k6)) + ((1/C2)^2) 1225 (l2^(49)) (k7 + k8)))); p3 = (((49 l2^50 - ((49 l2^50 - 48)*(l1/l2)^49))/(1 - (l1/l2))) - (l1/ l2)*((1 - (l1/l2)^48)/(1 - (l1/l2)^2))); p4 = (((49 l1^50 - ((49 l1^50 - 48)*(l2/l1)^49))/(1 - (l2/l1))) - (l2/ l1)*((1 - (l2/l1)^48)/(1 - (l2/l1)^2))); T3 = 0.5 ((((1/C1)^2) 1225 (l1^(49)) (k1 + k2) + ((1/C1) (1/C2) p3 (k3 + k4) + ((1/C2) (1/C1)* p4 (k5 + k6)) + ((1/C2)^2) 1225 (l2^49) (k7 + k8)))); k9 = (k1*pAA*Exp[-X]) + (k2*pBA*Exp[-X]); k10 = (-k1*pAB*Exp[X]) - (k2*pBB*Exp[X]); k11 = (k3*pAA*Exp[-X]) + (k4*pBA*Exp[-X]); k12 = (-k3*pAB*Exp[X]) - (k4*pBB*Exp[X]); k13 = (k5*pAA*Exp[-X]) + (k6*pBA*Exp[-X]); k14 = (-k5*pAB*Exp[X]) - (k6*pBB*Exp[X]); k15 = (k7*pAA*Exp[-X]) + (k8*pBA*Exp[-X]); k16 = (-k7*pAB*Exp[X]) - (k8*pBB*Exp[X]); k17 = k9 - shi1*k10 - shi1$*k9 + shi1*shi1$*k10; k18 = k9 - shi2*k10 - shi2$*k9 + shi2*shi2$*k10; k19 = k11 - shi1*k12 - shi1$*k11 + shi1*shi1$*k12; k20 = k11 - shi2*k12 - shi2$*k11 + shi2*shi2$*k12; k21 = k13 - shi1*k14 - shi1$*k13 + shi1*shi1$*k14; k22 = k13 - shi2*k14 - shi2$*k13 + shi2*shi2$*k14; k23 = k15 - shi1*k16 - shi1$*k15 + shi1*shi1$*k16; k24 = k15 - shi2*k16 - shi2$*k15 + shi2*shi2$*k16; gec = 1225*l1^48; ged = (((49 l1^48) - (49 l1^48 - 48)*(l2/l1)^49)/(1 - (l2/ l1))) - ((l2/l1)*(1 - (l2/l1)^48)/(1 - (l2/l1))^2); gfc = (((49 l1^48) - (49 l1^48 - 48)*(l2/l1)^49)/(1 - (l2/ l1))) - ((l2/l1)*(1 - (l2/l1)^48)/(1 - (l2/l1))^2); hec = (((49 l1^48) - (49 l1^48 - 48)*(l2/l1)^49)/(1 - (l2/ l1))) - ((l2/l1)*(1 - (l2/l1)^48)/(1 - (l2/l1))^2); gfd = (((49 l2^48) - (49 l2^48 - 48)*(l1/l2)^49)/(1 - (l1/ l2))) - ((l1/l2)*(1 - (l1/l2)^48)/(1 - (l1/l2))^2); hed = (((49 l2^48) - (49 l2^48 - 48)*(l1/l2)^49)/(1 - (l1/ l2))) - ((l1/l2)*(1 - (l1/l2)^48)/(1 - (l1/l2))^2); hfc = (((49 l2^48) - (49 l2^48 - 48)*(l1/l2)^49)/(1 - (l1/ l2))) - ((l1/l2)*(1 - (l1/l2)^48)/(1 - (l1/l2))^2); hfd = 1225*l2^48; T4 = 0.5 (gec*k17 + ged*k18 + gfc*k19 + gfd*k20 + hec*k21 + hed*k22 + hfc*k23 + hfd*k24); Clear[f]; f[x_, l_] = ((1.550 alpha + 0.2550 x^2 (alpha^2 + beta^2) - 1.5 (1/EE) beta (1 + 0.33 alpha*x^2) T1 + 0.255049 alpha^2 x^2 - 0.5 (1/EE) x^2 (alpha*beta (T2 + T3)) + beta^2*T4)^0.5)/50; p = LogLinearPlot[f[x, 0.0], {x, 0.01, 10^8}, PlotRange -> All] I have also redefined f with underscores and immediate assignment. However, the f that I got seems to have complex values, not real. The culprit may lie somewhere in those powers ^0.5.