Math 213 - Math with Mathematica

Name : Yan Duan
EMail : YanDuan101@gmail.com

Hello Yan, this is a nice project with how you have figured out how to block a manipulate from working; it is nice that you are figuring out how to use Mathematica to help you in your classes.   The programming is good, and this second version has an introduction and conclusion.  These sections are a little sparse; it would be good to expand these sections in order to help the reader along. Also, you do not cite any references that you used.  File grade: 90 A-

Resistance and Ohm's Law

Problem 1:

The  cross - sectional  area  of  the  copper  wire  in  a  household  wiring  system  is approximately  3 (mm^2).  Find  the  resistance  of  a  copper  wire  10 m  long,  if  the resistivity  of  copper  is  1.72×(10^(-8)) Ω - m.

Solution: To  solve  this  problem  we  use  the  relation

R = ρ (L/A)

where  R = resistance                   L = wire length

ρ  = resistivity                  A = cross sectional area

Solving for the resistance, R = (((1.72×(10^(-8))Ω-m ) (10  m))/(3 × (10^(-6))(m^2)))= 0.057 Ω

Program:

Creating fuctions to solve for each variable in the equation:

RR[ss_,R_,p_,L_,A_]:=If[ss==1,((p L )/A),R]  (* Fuction for R = ((p L)/A) *)

pp[ss_,R_,p_,L_,A_]:=If[ss==2,((R A)/L),p]  (* Fuction for ρ = ((R A)/L) *)

LL[ss_,R_,p_,L_,A_]:=If[ss==3, ((R A)/p),L]  (* Fuction for L = ((R A)/p) *)

AA[ss_,R_,p_,L_,A_]:=If[ss==4, ((p L)/(R )), A]  (* Fuction for A = ((p L)/R) *)
(* "ss" is assigned to each variable in order to be selected as the variables that needs to be solved *)

Manipulate[Pane[Column[{Framed[Text@Style[Row[{Style["R",Italic]," = ",Style["ρ (L/A)",Italic]}],38, Blue]],(* Shows the equation with the text size and color *)
Text@Style[Row[{Style["R",Italic]," = ",N[RR[ss,R,p,L,A]]," Ω"}],30,Purple],
Text@Style[Row[{Style["ρ",Italic]," = ",N[pp[ss,R,p,L,A]]," Ω-m"}],30,Purple],
Text@Style[Row[{Style["L",Italic]," = ",N[LL[ss,R,p,L,A]]," m"}],30,Purple],
Text@Style[Row[{Style["A",Italic]," = ",N[AA[ss,R,p,L,A]]," (m^2)"}],30,Purple]},Spacings->2],{300,350}  ],(* Shows each variable with their calculated numerical values and the unit for the corresponding variables, Ω for resistance, Ω-m for resistivity,  for lengh and (m^2) for cross sectional area *)
{{ss,1,"Solve for"},{1->Style["R",Italic],2->Style["ρ",Italic],3->Style["L",Italic],4->Style["A",Italic]},Setter},(* Relates the assigned "ss" to the "solve" for values in the control panel. Setter is used to enable selection of the variables *)
{{R,1,Style["R",Italic]},.0001,1000,.01,Appearance->"Labeled",Enabled->(ss≠1),ImageSize->Tiny},
{{p,1,Style["ρ",Italic]},.00000000001,1000,.01,Appearance->"Labeled",Enabled->(ss≠2),ImageSize->Tiny},
{{L,1,Style["L",Italic]},.001,1000,.01,Appearance->"Labeled",Enabled->(ss≠3),ImageSize->Tiny},{{A,1,Style["A",Italic]},.00000000001,1000,.01,Appearance->"Labeled",Enabled->(ss≠4),ImageSize->Tiny},
(* Setting the variable limits, starting values and disableing the "ss" fuction *)
TrackedSymbols:>{ss,R,p,L,A},
ControlPlacement->Top,SaveDefinitions->True,AutorunSequencing->{1,2,3,4}]

Problem 2:

Find  the  current  through  the  filament  of  a  light  bulb  with  a  resistance  of 240Ω  when  a  voltage  of  120V  is  applied  to  the  lamp.

Solution: To  solve  this  problem  we   use the  relation

V = IR

where  V = voltage

I  = current

R = resistance

Program:

Remove[R]

VVV[sss_,V_,I_,R_]:=If[sss==1,I R,V]

III[sss_,V_,I_,R_]:=If[sss==2,(V/R),I]

RRR[sss_,V_,I_,R_]:=If[sss==3, (V/I),R]

Manipulate[Pane[Column[{Framed[Text@Style[Row[{Style["V",Italic]," = ",Style["I R",Italic]}],38, Red]],
Text@Style[Row[{Style["V",Italic]," = ",N[VVV[sss,V,I,R]]," V"}],30,Orange],
Text@Style[Row[{Style["I",Italic]," = ",N[III[sss,V,I,R]]," A"}],30,Orange],
Text@Style[Row[{Style["R",Italic]," = ",N[RRR[sss,V,I,R]]," Ω"}],30,Orange]},Spacings->2],{300,350}  ],
{{sss,2,"Solve for"},{1->Style["V",Italic],2->Style["I",Italic],3->Style["R",Italic]},Setter},
{{V,120,Style["V",Italic]},.0001,1000,.01,Appearance->"Labeled",Enabled->(sss≠1),ImageSize->Tiny},
{{I,1,Style["I",Italic]},.00000000001,1000,.01,Appearance->"Labeled",Enabled->(sss≠2),ImageSize->Tiny},
{{R,240,Style["R",Italic]},.001,1000,.01,Appearance->"Labeled",Enabled->(sss≠3),ImageSize->Tiny},
TrackedSymbols:>{sss,V,I,R},
ControlPlacement->Top,SaveDefinitions->True,AutorunSequencing->{1,2,3}]