<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Excercises Electric Machinery Fundamentals
Chapter 1
Problem 1-8
Step1:  Description
A core with three legs is shown in Figure P1-5 below
Step2:  SOLUTION
This core can be divided up into four regions. Let
Step3:  The reluctances of the regions in core are
Step4:  And the reluctances are hence
Step5:  Then the total reluctance of the core is $\mathcal{R}_\text{TOT} = \mathcal{R}_1 + \frac{(\mathcal{R}_2 + \mathcal{R}_3)\mathcal{R}_4}{\mathcal{R}_2 + \mathcal{R}_3 + \mathcal{R}_4}$.
Step6:  and the magnetomotive force is $\mathcal{F} = \mathcal{N} \mathcal{I}$
Step7:  The total flux in the core $\phi_\text{TOT}$ is equal to the flux in the left leg $\phi_\text{left} = \frac{\mathcal{F}}{\mathcal{R}_\text{TOT}}$ , which is
Step8:  The fluxes in the center and right legs can be found by the "flux divider rule", which is analogous to the current divider rule.
Thus the flux in the left leg $\phi_\text{center} = \frac{ \mathcal{R}4}{\mathcal{R}_2 + \mathcal{R}_3 + \mathcal{R}_4}\phi\text{TOT}$ is
Step9:  The flux in the right leg $\phi_\text{right} = \frac{\mathcal{R}2 + \mathcal{R}_3}{\mathcal{R}_2 + \mathcal{R}_3 + \mathcal{R}_4}\phi\text{TOT}$ is
Step10:  The flux densities $B = \frac{\phi}{A}$ are
<ASSISTANT_TASK:>
Python Code:
%pylab notebook
%precision 4
from scipy import constants as c   # we like to use some constants
Explanation: Excercises Electric Machinery Fundamentals
Chapter 1
Problem 1-8
End of explanation
mu_r = 2000
mu = mu_r * c.mu_0
Explanation: Description
A core with three legs is shown in Figure P1-5 below:
<img src="figs/FigC_P1-5.jpg" width="70%">
Its depth is 5 cm, and there are 100 turns on the leftmost
leg. The relative permeability of the core can be assumed to be 2000 and constant. 
What flux exists in each of the three legs of the core? 
What is the flux density in each of the legs? 
Assume a 5% increase in the effective area of the air gap due to fringing effects.
End of explanation
l1 = 1.08    # [m]
l2 = 0.34    # [m]
l3 = 0.0005  # [m]
l4 = 1.08    # [m]
Explanation: SOLUTION
This core can be divided up into four regions. Let:
$\mathcal{R}_1$ be the reluctance of the left-hand portion of the core,
$\mathcal{R}_2$ be the reluctance of the center leg of the core,
$\mathcal{R}_3$ be the reluctance of the center airgap, and
$\mathcal{R}_4$ be the reluctance of the right-hand portion of the core.
If we assume that the mean path length of the flux is in the center of each leg of the core, and if we ignore spreading at the corners of the core, then the path lengths are:
End of explanation
A1 = 0.09 * 0.05         # [m²]
A2 = 0.15 * 0.05         # [m²]
A3 = 0.15 * 0.05 * 1.05  # [m²] 5% fringing
A4 = 0.09 * 0.05         # [m²]
Explanation: The reluctances of the regions in core are: $\mathcal{R}_\text{CORE} = \frac{l}{\mu_0 \mu_r A}$, 
The reluctances of the regions in the air gaps are: $\mathcal{R}_\text{GAP} = \frac{l}{\mu_0 A }$.
The areas can be calculated as:
End of explanation
R1 = l1 / (mu * A1)     # At /Wb  = At/Vs
R2 = l2 / (mu * A2)     # At /Wb  = At/Vs
R3 = l3 / (c.mu_0 * A3) # At /Wb  = At/Vs
R4 = l4 / (mu * A4)     # At /Wb  = At/Vs
print('R1 = {:.1f} kAt/Wb'.format(R1/1000) )
print('R2 = {:.1f} kAt/Wb'.format(R2/1000) )
print('R3 = {:.1f} kAt/Wb'.format(R3/1000) )
print('R4 = {:.1f} kAt/Wb'.format(R4/1000) )
Explanation: And the reluctances are hence:
End of explanation
Rtot = R1 + ((R2 + R3) * R4) / (R2 + R3 + R4)
print('Rtot = {:.1f} kAt/Wb'.format(Rtot/1000))
Explanation: Then the total reluctance of the core is $\mathcal{R}_\text{TOT} = \mathcal{R}_1 + \frac{(\mathcal{R}_2 + \mathcal{R}_3)\mathcal{R}_4}{\mathcal{R}_2 + \mathcal{R}_3 + \mathcal{R}_4}$.
End of explanation
N = 100   # t   given in description
I = 2.0   # A   given in description
F = N * I
Explanation: and the magnetomotive force is $\mathcal{F} = \mathcal{N} \mathcal{I}$:
End of explanation
phi_left = F / Rtot 
print('phi_left = {:.3f} mWb'.format(phi_left*1000))
Explanation: The total flux in the core $\phi_\text{TOT}$ is equal to the flux in the left leg $\phi_\text{left} = \frac{\mathcal{F}}{\mathcal{R}_\text{TOT}}$ , which is:
End of explanation
phi_center = R4 / (R2 + R3 + R4) * phi_left
print('phi_center = {:.3f} mWb'.format(phi_center*1000))
Explanation: The fluxes in the center and right legs can be found by the "flux divider rule", which is analogous to the current divider rule.
Thus the flux in the left leg $\phi_\text{center} = \frac{ \mathcal{R}4}{\mathcal{R}_2 + \mathcal{R}_3 + \mathcal{R}_4}\phi\text{TOT}$ is:
End of explanation
phi_right = (R2 + R3) / (R2 + R3 + R4) * phi_left
print('phi_right = {:.3f} mWb'.format(phi_right*1000))
Explanation: The flux in the right leg $\phi_\text{right} = \frac{\mathcal{R}2 + \mathcal{R}_3}{\mathcal{R}_2 + \mathcal{R}_3 + \mathcal{R}_4}\phi\text{TOT}$ is:
End of explanation
B_left = phi_left / A1
B_center = phi_center / A2
B_right = phi_right / A4
print('B_left   = {:.3f} T'.format(B_left))
print('B_center = {:.3f} T'.format(B_center))
print('B_right  = {:.3f} T'.format(B_right))
Explanation: The flux densities $B = \frac{\phi}{A}$ are:
End of explanation
<END_TASK>