Generatore delle figure incluse nei vari capitoli

<< Geometry`Rotations`

Clear[Resistenza, Generatore, Induttanza, Molla]
\(Resistenza[a_, b_, S_String] := 

      Module[{d = \@\(\((b - a)\) . \((b - a)\)\), α, n = 5, l, c, 
          ofs}, 
α = 
          If[a[\([1]\)] == b[\([1]\)], π\/2, 
            ArcTan[\(b[\([2]\)] - a[\([2]\)]\)\/\(b[\([1]\)] - a[\([1]\)]\)]]; 
ofs = {1.3 
               Sign[Sin[α]], \(-1.3\)}; 
c = \(d\/3\) {Cos[α], Sin[α]} + 
            a; 
l = \(d/3\)\/\(2  n + 2\); 
p = 
          Join[{{0, 0}}, 
            Table[{l \((1 + 2  k)\), \(-\((\(-1\))\)\^k\) l}, {k, 0, 
                n}], {{d\/3, 0}}]; 
{Line[
            Join[{a}, 
              Map[c + # &, 
                Map[Rotate2D[#, \(-α\), {0, 0}] &, p]], {b}]], 
          Text[S, \(a + b\)\/2, ofs]}
]\)
\(Induttanza[a_, b_, S_String] := 

      Module[{d = \@\(\((b - a)\) . \((b - a)\)\), α, x, y, t, 
          v = 0.3, l, c, s = 0.04, n = 5, k, ofs}, 
k = 
          2  n + 1; 
α = 
          If[a[\([1]\)] == b[\([1]\)], π\/2, 
            ArcTan[\(b[\([2]\)] - a[\([2]\)]\)\/\(b[\([1]\)] - a[\([1]\)]\)]]; 
ofs = {2.3 
               Sign[Sin[α]], \(-2.3\)}; 
c = 
          a + \(b - a\)\/3; 
x[
            t_] = \(\(d/3\)\/\(2 + k\ π\ v\)\) \((\(-Cos[t]\) + v\ \ t + 
                  1)\) + c[\([1]\)]; 
y[t_] = 
          s\ Sin[t] + 
            c[\([2]\)]; 
l = \(ParametricPlot[{x[t], 
                y[t]}, {t, 0, k\ π}, 
              DisplayFunction -> Identity]\)[\([1, 1, 1, 
              1]\)]; 
{Line[
            Join[{a}, Map[Rotate2D[#, \(-α\), c] &, l], {b}]], 
          Text[S, \(a + b\)\/2, ofs]}
]\)
Capacita[a_, b_, 
        S_String] := 
Module[{α, h = 0.05, 
          ofs}, 
α = 
          If[a[[1]] == b[[1]], (π/2), 
            ArcTan[((b[[2]] - a[[2]])/(b[[1]] - a[[1]]))]]; 
ofs = {-1, -3}; 
{Line[{a + h {Sin[α], Cos[α]}, 
              a - h {Sin[α], Cos[α]}}], 
          Line[{b + h {Sin[α], Cos[α]}, 
              b - h {Sin[α], Cos[α]}}], 
          Text[S, ((a + b)/2), 
            ofs]}
]
Generatore[a_, b_, 
        S_String] := 
Module[{α, h = 0.08, d = 0.05, 
          ofs}, 
α = 
          If[a[[1]] == b[[1]], (π/2), 
            ArcTan[((b[[2]] - a[[2]])/(b[[1]] - a[[1]]))]]; 
ofs = {-1, -3}; 
{Line[{a + h {Sin[α], Cos[α]}, 
              a - h {Sin[α], Cos[α]}}], Thickness[ .02], 
          Line[{b + d {Sin[α], Cos[α]}, 
              b - d {Sin[α], Cos[α]}}], 
          Text[S, b, ofs]}
]
\(Molla[x1_, x2_, a_:  0.1] := 

      Module[{x, y, t, 
          v = 0.3}, 
x[
            t_] = \(\(x2 - x1\)\/\(2 + 7  π\ v\)\) \((\(-Cos[t]\) + 
                  v\ \ t + 1)\) + x1; 
y[t_] = 
          a\ Sin[t]; 
\(ParametricPlot[{x[t], y[t]}, {t, 0, 
              7  π}, 
            DisplayFunction -> Identity]\)[\([1]\)]
]\)

Figura 2.12.1

\(\(Fig2121 := 
Module[{
O = {0, 0}, 
            Q = {0.35, 0.6}, P = {1.3, 4}, 
            Px = {1, 
                0}}, 
r = \(1\/2\) \@\(\((Q - O)\) . \((Q - O)\)\); 
φ = 
            ArcTan[Q[\([2]\)]\/Q[\([1]\)]]; 
SetOptions[
            Text, FormatType -> 
              TraditionalForm]; 
Show[
            Graphics[{
Circle[O, 
                  1], 
Circle[O, 
                  r, {0, φ}], 
PointSize[0.02], 
                Point[Q], 
                Point[P], 
Text["r", \((O + Q)\)/
                    2, {0, \(-1\)}], 
Text["R", \((P + 
                        Q)\)/2, {0, \(-3\)}], 
Text["φ", O, {\(-3\), \(-1\)}], 
Text["O", 
                  O, {1, 0}], 
Text["Q(r,φ)", 
                  Q, {\(-1.2\), 0}], 
Text["P(x,y,z)", 
                  P, {\(-1.2\), 0}], 
Line[{O, Px}], 
                Line[{O, Q}], 
                Line[{Q, 
                    P}], 
Text[\*""dV=(1/(4  π(Subscript[ϵ, 0])))(dq/R)"", {0, 4}, {1.78, 
                    0}], 
Text["dq=σdxdy=rdrdφ", {0, 3.6}, {1.3, 
                    0}], 
Text[\*""R=\!\(\@\(\((x - r\\ Cos \((φ)\))\)\^2 + \((r - r\\ Sin \((φ)\))\)\^2 + z\^2\)\)"", {0, 3.2}, {0, 0}]}
], 
            AspectRatio -> 1.5, ImageSize -> {250, 300}, 
            PlotRange -> All]];\)\)

Figura 2.3

\(\(Fig23 := 
Module[{a = {0, 0}, b = {1, 0}, 
            c = {1, 0.7}}, 

          Show[Graphics[{
	Line[{a, b, c, a}], 
	
                Text[StyleForm["a", , 
                    FontSize -> 12], \(b + c\)\/2, {\(-1\), 0}], 
                Text["b", \(b + a\)\/2, {0, \(-1\)}], 
                Text["400", \(a + c\)\/2, {1, 0}], 
                Text["35°", a + {0.13, 0.03}]
}], 
            PlotRange -> All]];\)\)

Figura 2.4

Fig24 := Fig23

Figura 2.20

Fig220 := Fig2121

Figura 3.14.1

\(\(Fig3141 := 
Module[{A = {0, \(-0.3\)}, 
            C = {0.1, 0.3}, B = {0.1, 0}, D = {0.2, 0}, E = {0.5, 0}, 
            F = {0.6, 0}, G = {0.9, 0}, 
            H = {0.95, 0}}, 
Show[
            Graphics[{
RGBColor[0.70, 0.70, 0.70], 
                Rectangle[A, C], 
                RGBColor[0, 0, 
                  0], 
Line[{B, 
                    D}], 
Molla[D[\([1]\)], 
                  E[\([1]\)]], 
Line[{E, 
                    F}], 
PointSize[0.02], 
                Point[\(E + F\)\/2], 
Text[\*""(Subscript[m, 1])"", \((E + F)\)/
                    2, {0, \(-2\)}], 
Molla[F[\([1]\)], 
                  G[\([1]\)]], 
Line[{G, 
                    H}], 
Point[
                  H], 
Text[\*""(Subscript[m, 2])"", 
                  H, {0, \(-2\)}]
}], AspectRatio -> Automatic, 
            PlotRange -> All]];\)\)

Figura 3-13

\(\(Fig313 := 
Module[{h = {0.48, 0. }, a = {0. , 0. }, 
            b = {0. , 0.75}, c = {0.5, 1. }, d = {0.5, 0.5}, e = {1, 0.75}, 
            f = {1. , 0. }, g = {0.52, 0. }}, 

          Show[Graphics[{
	
                Line[{h, a, b}], 
Line[{e, f, g}], 
	
                Resistenza[b, c, \*""\!\(R\_1\)""], 
	
                Resistenza[c, e, \*""\!\(R\_2\)""], 
	
                Resistenza[d, e, \*""\!\(R\_4\)""], 
	
                Resistenza[b, d, \*""\!\(R\_3\)""], 
	
                Resistenza[d, c, \*""\!\(R\_5\)""], 
	
                Generatore[h, g, \*""\!\(E\_m\)""]
}], 
            AspectRatio -> Automatic, 
            PlotRange -> All]];\)\)

Figura 3-14

\(\(Fig314 := 
Module[{h = {0.33, 0.33}, 
            a = {0. , 1. }, b = {0.33, 1. }, c = {1. , 1. }, d = {1. , 0.33}, 
            e = {1, 0. }, f = {0.33, 0. }, g = {0. , 0. }, f1 = {0.2, 1. }, 
            g1 = {0.24, 1. }, f2 = {1. , 0.26}, g2 = {1. , 0.22}}, 

          Show[Graphics[{
	Line[{a, f1}], 
	Line[{g1, c}], 
	
                Line[{f, g}], 
	Line[{d, f2}], 
	Line[{g2, e}], 
	
                Resistenza[g, a, \*""\!\(R\_1\)""], 
	
                Resistenza[h, b, \*""\!\(R\_2\)""], 
	
                Resistenza[f, h, \*""\!\(R\_3\)""], 
	
                Resistenza[h, d, \*""\!\(R\_4\)""], 
	
                Resistenza[d, c, \*""\!\(R\_5\)""], 
	
                Resistenza[f, e, \*""\!\(R\_6\)""], 
	
                Capacita[f1, g1, "C"], 
Generatore[f2, 
                  g2, \*""\!\(E\_2\)""]
}], 
            AspectRatio -> Automatic, 
            PlotRange -> All]];\)\)

{Fig2121, Fig23, Fig24, Fig220, Fig3141, Fig313, 
        Fig314};