Elektricna poljska jakost in potencial v okolici krogelne lupine s konstantno prostorsko gostoto nabojev

µ0 = 8.854 * 10^ -12 ;

ρ = 10^-6 ;

r1 = 1 ;

r2 = 3 ;

Er[r_] := Which[r < r1, 0, r < r2, ρ/(3 * µ0) * ((r^3 - r1^3)/r^2), r >= r2, ρ/(3 * µ0) * ((r2^3 - r1^3)/r^2)]

Pomoc za funkcijo Which:

Which [test1, value1, test2, value2, ...] evaluates each of the test in turn, returning the value of the value corresponding to the first one that yields True.

Plot[Er[r], {r, 0, 5}]

[Graphics:HTMLFiles/index_7.gif]

-Graphics -

V[r_] := Which[r < r1, ρ/(2 * µ0) * (r2^2 - r1^1), r < r2, ρ/(3 * µ0) * (-r^2/2 + 3/2 * r2^2 - r1^3/r), r >= r2, ρ/(2 * µ0) * (r2^2 - r1^1)/r]

Plot[V[r], {r, 0, 5}]

[Graphics:HTMLFiles/index_11.gif]

-Graphics -


Converted by Mathematica  (January 28, 2004)