Straight Wire (Griffiths)
You are given a wire along the $z$ axis, of radius $a$. For the magnetic field $B=B0(frac {y+a}{a})hat x$, the current density is $J=J0(frac{a-s}{a})hat z$.
a. Determine the current in the wire?
b. Determine the magnetic force on the wire.

$s$ stands for radial distance from the wire center $( J) ⃗=J_0*(a-r)/a*z ̂$
Total current that flows in the wire is
$dI=J*dS$ with $S= πr^2$ so that
$I=∫_0^aJ_0*(a-r)/a*(2π*dr)=(2πJ_0)/a (ar-r^2/2)_0^a=2πJ_0 a/2=πaJ_0$
Infinitesimal magnetic force is
$dF(y,r)=B*dI*L=B_0*(y+a)/a*J_0*(a-r)/a*dS*L$
In cylindrical coordinates $dS=r*dr*dθ$
$y=r*sin(θ)$ so that
$dF(r,θ)/L=(B_0 J_0)/a^2 (r*sin(θ)+a)(a-r)*(rdr*dθ)$
$dF(r)/L=(B_0 J_0)/a^2 (a-r)rdr∫_0^2π (r*sin〖θ+a)dθ=(B_0 J_0)/a^2 (a-r)*rdr*(2πa)$
$F/L=(2πB_0 J_0)/a ∫_0^a r(a-r)dr=(2πB_0 J_0)/a*a^3/6=(πa^2 B_0 J_0)/3$