• Welcome to the new Internet Infidels Discussion Board, formerly Talk Freethought.

Having Fun With Math And Physics

steve_bank

Diabetic retinopathy and poor eyesight. Typos ...
Joined
Nov 9, 2017
Messages
13,771
Location
seattle
Basic Beliefs
secular-skeptic
In the 19th century Joule in his paddle wheel experiment demonstrated the equivalence of megapascal work and heat.

A similar experiment can be done using a resistor and a capacitor demonstrating the equivalence of electric potential energy and heat. Put a voltage on a capacitor, energy equaling .5*c*v^2. Discharge the capacitor and determining the power dissipated in the resistor.

To finish the experiment put the resistor in a container of water and measure the temperature rise. Calculate energy from q = m*c^dT.

Energy = Joules. Power in watts = Joules/second. Power dissipated in the resistor = i^2 *r. Interstate power to get total energy.

Conservation says the capacitor potential energy must equal the energy dissipated in the resistor. Mathematically the capacitor discharge is an exponential decay function which asymptotically approaches zero but never gets there. The integration carried out long enough would overflow.

Physically the amount of charge and energy on a capacitor is finite quantized by the unit charge, the electron. The energy will go to zero.

Joules Potential Energy 5000.00
Joules Simulated Dissipated Heat Energy 5000.50

Code:
#Python
import math

def trap(x,y):
        # trapezoidal integrqtion
        n = len(x) - 1
        integral  = 0
        for i in range(n):
            dx = x[i+1]-x[i]
            integral += dx * (y[i]  + ( (y[i+1]-y[i]) * .5 ))
        return  integral

n = 10000
t = n*[0]
p = n*[0]
tau = 1.  #  rc time constnt seconds
rc = 1. # resistor acrooss capacitor
c = 1 # capCITOR farads
Tmax = 10000 # seconds
dt = Tmax/(n-1)
vc = 100  # capacitor voltage
Ec = .5*c*(vc**2)  # potential energy in Joules on capacitor

for i in range(n):
    t[i] = i * dt
    ir = vc/rc  # instantaneous resistor current Ohm's Law v = i*r
    p[i] = (ir**2)*rc  # instantaneous resistor power  i^2*r watts
    dv = ir*dt/c  # solve i = c*dv/dt using differentials
    vc -= dv

Ept = trap(t,p)  # integrate power to get total energy
print("Joules Potential Energy  %f" %Ec)
print("Joules Sinulated Heat Energy  %.2f" %Ept)
 
Found a problem with over and under flow depending on n and Tmax.

If you run it add the if statement, make Tmax 100

Result
Joules Potential Energy 5000.000000
Joules Heat Energy 4975.13

Code:
for i in range(n):
    t[i] = i * dt
    ir[i] = vc/rc  # instantaneous resistor current Ohm's Law v = i*r
    p[i] =math.pow(ir[i],2)*rc  # instaneous resistor power  i^2*r watts
    dv = ir[i]*dt/c  # solve i = c*dv/dt using differntials
    vc -= dv
    if vc <= .0001: break
 
Back
Top Bottom