Amperian loop for different situations Why are amperian loops always taken as circles? What if we take it as a triangle or rectangle? Give an example by taking amperian loop as rectangle for current carrying straight wire and derive equation for magnetic field? How will the equation change?
 A: An Amperian loop can be any closed path. Ampere's law is true for any closed path.
$$\oint \vec{B}\cdot d\vec{l} = \mu_0 I_{\rm enc} $$
Whether the law is useful or not depends on whether you are able to easily calclulate the LHS (the closed line integral of the B-field around the loop), and the RHS (the total current passing through that loop).
It is usually the LHS that determines what shape of loop you should choose. The ideal case would be where the B-field is either parallel or perpendicular to the loop line element, all the way around the loop, and/or of constant magnitude. That makes the LHS easy to calculate.
In the case of a long wire, there is symmetry around the axis of the wire, such that the B-field curves around the the wire and thus is constant in magnitude at a given distance from the wire and will always be parallel to the line element on a circular path. Thus
$$\oint \vec{B}\cdot d\vec{l} \rightarrow 2\pi r B_r\ .$$
There are examples where non-circular loops are used. The most well known would be the long solenoid. A rectangular loop placed with one of its straight sides along the axis of the solenoid and its opposite side outside the solenoid is most useful here, since the B-field in the solenoid is directed along the axis and the B-field outside the solenoid is $\sim 0$. Thus
$$\oint \vec{B}\cdot d\vec{l} \rightarrow L B_z\ , $$
where $L$ is the length of the rectangle.
