<jupyter_start><jupyter_text>$f_{2}(c,p) = \dfrac{1}{2}r_{c}c^{2}+\dfrac{1}{4}u_{c}c^{4}+\dfrac{1}{6}v_{c}c^{6}+\dfrac{1}{2}r_{p}p^{2}+\dfrac{1}{4}u_{p}p^{4}+\dfrac{1}{6}v_{p}p^{6}-\gamma cp-ec^{2}p^{2}-Ep$<jupyter_code>f2 = ((1/2)*r_c*c**2+(1/4)*u_c*c**4+(1/6)*v_c*c**6+(1/2)*r_p*p**2
      +(1/4)*u_p*p**4+(1/6)*v_p*p**6-E*p-gamma*c*p-e*c**2*p**2)
nsimplify(f2)<jupyter_output><empty_output><jupyter_text>Solve for $E(c,p)$ $\dfrac{\partial f_{2}(c,p)}{\partial p} = 0 = $<jupyter_code>E_c = solve(f2.diff(p),E)[0]
E_c<jupyter_output><empty_output><jupyter_text>Solve for $p_{min}(c)$ $\dfrac{\partial f_{2}(c,p)}{\partial c} = 0 = $<jupyter_code>p_min = nsimplify(solve(f2.diff(c),p)[0])
p_min<jupyter_output><empty_output><jupyter_text>Plug $p_{min}(c)$ into $E(p,c)$:<jupyter_code>E_c = nsimplify(E_c.subs(p,p_min))
E_c<jupyter_output><empty_output><jupyter_text>Series expand $E(p_{min}(c),c)$ in powers of $c$ to order 7:  Multiply this by gamma, then solve the same problem<jupyter_code>series(E_c,c,n=7)
Etrun = a*c+b*c**3+q*c**5
solve(Etrun.diff(c),c)
c_L = solve(Etrun.diff(c),c)[1]
c_U = solve(Etrun.diff(c),c)[3]
c_L,c_U
E_L = simplify(Etrun.subs(c,c_U))
E_U = simplify(Etrun.subs(c,c_L))
E_L,E_U
rc = (gamma**2+a*gamma)/r_p

B = (r_p*u_c/gamma+u_p*(r_c/gamma)**3-2*e*r_c/gamma-2*e*r_p*r_c**2/gamma**3)

Q = ((2*e*r_c)**2/gamma**3+8*r_p*e**2*r_c**3/gamma**5-2*e*u_c/gamma
     -4*e*r_c*r_p*u_c/gamma**3-6*e*u_p*r_c**4/gamma**5+r_p*v_c/gamma
     +3*u_c*u_p*r_c**2/gamma**3+v_p*(r_c/gamma)**5)
collect(expand(B.subs(r_c,rc)),a)
collect(expand(Q.subs(r_c,rc)),a)
b0 = (u_p*(gamma/r_p)**3-4*e*gamma/r_p+u_c*r_p/gamma)

b1 = (3*u_p*gamma**2/r_p**3-6*e/r_p)

b2 = (3*u_p*gamma/r_p**3-2*e/(gamma*r_p))

b3 = u_p/r_p**3

q0 = (v_p*(gamma/r_p)**5-6*e*u_p*gamma**3/r_p**4+3*(gamma/r_p**2)*(4*e**2+u_c*u_p)-6*e*u_c/gamma+v_c*r_p/gamma)

q1 = (5*v_p*gamma**4/r_p**5-24*e*u_p*gamma**2/r_p**4+2*(16*e**2+3*u_c*u_p)/r_p**2-4*e*u_c/gamma**2)

q2 = (10*v_p*gamma**3/r_p**5-36*e*u_p*gamma/r_p**4+(28*e**2+3*u_c*u_p)/(gamma*r_p**2))

q3 = (10*v_p*gamma**2/r_p**5-24*e*u_p/r_p**4+8*(e/(gamma*r_p))**2)

q4 = (5*v_p*gamma/r_p**5-6*e*u_p/(r_p**4*gamma))

q5 = v_p/r_p**5
uc = solve(b0-b_0,u_c)[0]
up = solve(b3-b_3,u_p)[0]
vc = solve(q0-q_0,v_c)[0]
vp = solve(q5-q_5,v_p)[0]
replacements = [(v_p,vp),(u_p,up),(u_c,uc)]
vc = simplify(vc.subs([i for i in replacements]))
expand(vc)
uc = simplify(uc.subs([i for i in replacements]))
expand(uc)
up
vp<jupyter_output><empty_output><jupyter_text>$b_0$<jupyter_code>b0<jupyter_output><empty_output><jupyter_text>$b_1$<jupyter_code>b1 = simplify(b1.subs(u_p,up))
b1<jupyter_output><empty_output><jupyter_text>$b_2$<jupyter_code>b2 = simplify(b2.subs(u_p,up))
b2<jupyter_output><empty_output><jupyter_text>$b_3$<jupyter_code>b3<jupyter_output><empty_output><jupyter_text>$B(a)$ i.t.o. $b_3$<jupyter_code>B_a = b_0+b1*a+b2*a**2+b_3*a**3
B_a<jupyter_output><empty_output><jupyter_text>$q_0$<jupyter_code>q0<jupyter_output><empty_output><jupyter_text>$q_1$<jupyter_code>q1 = simplify(q1.subs([i for i in replacements]))
q1<jupyter_output><empty_output><jupyter_text>$q_2$<jupyter_code>q2 = q2.subs([i for i in replacements])
expand(q2)<jupyter_output><empty_output><jupyter_text>$q_3$<jupyter_code>q3 = simplify(q3.subs([i for i in replacements]))
q3<jupyter_output><empty_output><jupyter_text>$q_4$<jupyter_code>q4 = simplify(q4.subs([i for i in replacements]))
q4<jupyter_output><empty_output><jupyter_text>$Q(a)$ i.t.o. $b_0$, $b_3$, $q_5$<jupyter_code>Q_a = q_0+q1*a+q2*a**2+q3*a**3+q4*a**4+q_5*a**5
collect(expand(Q_a),a)<jupyter_output><empty_output><jupyter_text>$R(a)$<jupyter_code>series(B_a**2-(20*a*Q_a/9),a,n=7)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2592994841162096, 'fraction_numerical': 0.05891935921802878, 'mean_word_length': 10.063063063063064, 'pattern_counts': {'":': 0, '<': 69, '<?xml version=': 0, '>': 69, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '17', 'dir': 'jupyter-structured-clean-dedup', 'id': '36308', 'license': 'MIT', 'n_tokens_mistral': 2191, 'n_tokens_neox': 2115, 'n_words': 154, 'path': 'Smectic/GenPolSympy.ipynb', 'repo_name': 'brettavedisian/Liquid-Crystals', 'size': '3683'}