Substitute Functions

Home Up 
This free JavaScript tutorial teaches scripting, electronics, and numeric-analysis simultaneously. It teaches pure JavaScript for scientific and technical calculations.  You should be able to program calculations using  only Notepad and Internet Explorer in one or two hours.

 

 

 

Substituting Functions

You can change the formula for Parallel resistance to Series resistance, Series Capacitance or Capacitance Reactance , by making changes only to the black text of JS1.html
Declare variables as required.

Parallel Resistance
1/Rt =  1/R1 + 1/R2 + 1/R3;

Series Resistors
R(t) = R1 + R2 + R3 + R4 + R5 + R6

function mathgeneral(){
R(t) = R1 + R2 + R3 + R4 + R5 + R6; Alpha = ("Rtotal is "+Rt);
document.B1.T1.value = Alpha}

Series Capacitors
1/Ct =
1/C1 + 1/C2 + 1/C3
function mathgeneral(){
recipCt = 1/C1 + 1/C2 + 1/C3;
Ct = 1/recipCt ; Alpha = ("Ct is "+Ct);
document.B1.T1.value = Alpha}

Capacitance Reactance(Xc)
Xc = 1/(2*Pi*F*C)   Pi = 3.141, F = frequency, C = capacitance

function mathgeneral(){
Xc = 1/(2*Pi*F*C) ; Alpha = ("C is "+C);
document.B1.T1.value = Alpha}


Exercise: Develop a new program using functions above. Save (Safe As) giving each file its own name. Enter any values in variables that you like. Check your program results by performing same calculation by hand (with calculator of course.) 

 

 

 

 


        
Questions or problems regarding this web site should be directed to BilPat4342@AOL.com

Copyright ©2003 Science Ebooks All rights reserved.
Last modified: Wednesday December 06, 2006.