No. 1: From Dr. Robert Murray
a) Acetone (1/2 liter)
b) Polyethelene Glycol - Brake Fluid - 20 ml
c) Cellulose Acetate - Cigarette Filter - 10g
d) Pure Silica - 5 liters
No. 2: From Aquion Battery
a) Synthetic Cotton - Rayon
No. 3: From Lead Acid Batteries
a) Vulcan Rubber (Tires)
Sunday, November 17, 2019
Sunday, October 6, 2019
Baseline Voltages of Battery Materials
The following are the baseline voltages and polarities of various possible battery materials using common table salt (Sodium Chloride) as electrolyte:
(1) Copper (+) and Graphene (-) = 0.11v
(2) Aluminum (+) and Concrete Nail / Zinc (-) = 0.2v
(3) Graphite (+) and Graphene (-) = 0.43v to 0.5v (basis for all carbon battery)
(4) Graphite (+) and Aluminum (-) = 1.0v
(5) Copper (+) and Aluminum (-) = 0.5v
(6) Graphite (+) and Concrete Nail / Zinc (-) = 1.06v to 1.27v
(7) Graphite (+) and Copper (-) = 0.43v to 0.51v
(8) Graphene (+) and Aluminum (-) = 0.25v
(9) Copper (+) and Concrete Nail / Zinc = 0.73v
(10) Graphite (+) and Activated Carbon (-) with Aluminum as current collector = 0.6v (Basis for All carbon battery
(11) Graphite Plastic (+) and Aluminum (-) with Sodium Sulfate as electrolyte = 1.2v
Note: The material (Concrete Nail) is carbon steel coated with zinc
Experiment No. 1
Aluminum
Potassium Hydroxide
Separator (Polyolefin)
Vinegar
Graphite
Result: 1.1v-1.2v (0.8v); 2mA (0.2mA)
Experiment No. 2
Aluminum
Separator (Polyolefin)
Potassium Hydroxide
Graphite
Aluminum as Current Collector
Result: 1.1v-1.2v (1.12v); 5mA (1mA)
Experiment No. 3
Aluminum
Separator (Polyolefin)
Potassium Hydroxide
Separator (Polyolefin)
Graphite
Aluminum as Current Collector
Result: 1.4v-1.5v (1.35v); 0.5mA (0.1mA)
Experiment No. 4
Aluminum
Separator (Tissue Paper) + Potassium Hydroxide
Graphite Plastic
Aluminum
Result: 1.0v (0.8v); 9.5mA-10mA (9.5mA)
Experiment No. 5
Aluminum
Separator (Tissue Paper) + Potassium Hydroxide
Graphite Plastic
Result: 1.4v (1.4v); 10mA (13mA)
Experiment No. 6
Stainless Steel Screen
Separator (Corrogated Carton) + Potassium Hydroxide
Graphite Plastic
Result: 1.7v-1.8v (1.5v-1.6v); 15mA-16mA (13mA); Stainless Steel Screen was consumed by the chemical reaction; More exposed areas to the air tends to make the voltage and amps higher.
Experiment No.7 (Fuel Cell - Single Cell; Test-Scale)
Aluminum in Glass Jar (Anode -)
Water (Tap Water)
Graphite Rod (Cathode +)
Charge Voltage: 12v-18v
Voltage: 1.8v-2.2v (0.7v after 6 hrs; with Hydrogen gas)
Amps: 1.2mA (0.4mA after 6 hrs; with Hydrogen gas)
Result: Observable Redox reaction. Visible bubbles of Hydrogen and Oxygen after 5 minutes.
Experiment No.8 (Fuel Cell - Single Cell; Slightly bigger surface area of Anode and Cathode)
Stainless Steel Mesh / Screen in Glass Jar (Anode -)
Water (Tap Water)
Stainless Steel Mesh / Screen in Glass Jar (Cathode +)
Note: Stainless Screen Size is 1/2 of door size at Anode and 1/4 of door size at Cathode; Bigger surface area
Charge Voltage: 12v-18v for 5 hrs
Voltage: 0.7v-0.8v (0.6v after a few minutes with Hydrogen gas at Anode and Oxygen at Cathode)
Amps: 6.0-8.0mA (4.0-5.0mA after a few minutes; with Hydrogen gas at Anode and Oxygen at Cathode)
Result: Observable Redox reaction. Visible bubbles of Hydrogen and Oxygen after 5 minutes.
(1) Copper (+) and Graphene (-) = 0.11v
(2) Aluminum (+) and Concrete Nail / Zinc (-) = 0.2v
(3) Graphite (+) and Graphene (-) = 0.43v to 0.5v (basis for all carbon battery)
(4) Graphite (+) and Aluminum (-) = 1.0v
(5) Copper (+) and Aluminum (-) = 0.5v
(6) Graphite (+) and Concrete Nail / Zinc (-) = 1.06v to 1.27v
(7) Graphite (+) and Copper (-) = 0.43v to 0.51v
(8) Graphene (+) and Aluminum (-) = 0.25v
(9) Copper (+) and Concrete Nail / Zinc = 0.73v
(10) Graphite (+) and Activated Carbon (-) with Aluminum as current collector = 0.6v (Basis for All carbon battery
(11) Graphite Plastic (+) and Aluminum (-) with Sodium Sulfate as electrolyte = 1.2v
Note: The material (Concrete Nail) is carbon steel coated with zinc
Experiment No. 1
Aluminum
Potassium Hydroxide
Separator (Polyolefin)
Vinegar
Graphite
Result: 1.1v-1.2v (0.8v); 2mA (0.2mA)
Experiment No. 2
Aluminum
Separator (Polyolefin)
Potassium Hydroxide
Graphite
Aluminum as Current Collector
Result: 1.1v-1.2v (1.12v); 5mA (1mA)
Experiment No. 3
Aluminum
Separator (Polyolefin)
Potassium Hydroxide
Separator (Polyolefin)
Graphite
Aluminum as Current Collector
Result: 1.4v-1.5v (1.35v); 0.5mA (0.1mA)
Experiment No. 4
Aluminum
Separator (Tissue Paper) + Potassium Hydroxide
Graphite Plastic
Aluminum
Result: 1.0v (0.8v); 9.5mA-10mA (9.5mA)
Experiment No. 5
Aluminum
Separator (Tissue Paper) + Potassium Hydroxide
Graphite Plastic
Result: 1.4v (1.4v); 10mA (13mA)
Experiment No. 6
Stainless Steel Screen
Separator (Corrogated Carton) + Potassium Hydroxide
Graphite Plastic
Result: 1.7v-1.8v (1.5v-1.6v); 15mA-16mA (13mA); Stainless Steel Screen was consumed by the chemical reaction; More exposed areas to the air tends to make the voltage and amps higher.
Experiment No.7 (Fuel Cell - Single Cell; Test-Scale)
Aluminum in Glass Jar (Anode -)
Water (Tap Water)
Graphite Rod (Cathode +)
Charge Voltage: 12v-18v
Voltage: 1.8v-2.2v (0.7v after 6 hrs; with Hydrogen gas)
Amps: 1.2mA (0.4mA after 6 hrs; with Hydrogen gas)
Result: Observable Redox reaction. Visible bubbles of Hydrogen and Oxygen after 5 minutes.
Experiment No.8 (Fuel Cell - Single Cell; Slightly bigger surface area of Anode and Cathode)
Stainless Steel Mesh / Screen in Glass Jar (Anode -)
Water (Tap Water)
Stainless Steel Mesh / Screen in Glass Jar (Cathode +)
Note: Stainless Screen Size is 1/2 of door size at Anode and 1/4 of door size at Cathode; Bigger surface area
Charge Voltage: 12v-18v for 5 hrs
Voltage: 0.7v-0.8v (0.6v after a few minutes with Hydrogen gas at Anode and Oxygen at Cathode)
Amps: 6.0-8.0mA (4.0-5.0mA after a few minutes; with Hydrogen gas at Anode and Oxygen at Cathode)
Result: Observable Redox reaction. Visible bubbles of Hydrogen and Oxygen after 5 minutes.
Wednesday, May 29, 2019
Simple Regression using SQL
A. Calculating for the Slope
Given the following data in the MariaDB database table named "simreg":
Where X is the independent variable and Y is the dependent variable, the slope can be calculated using the following SQL command:
This query produces the following output:
If we want to have the forecast side by side with the original Y, we can just add the Y into the query as:
Likewise, if we want to get the forecast error, we can just modify the query a bit to deduct the 'Y Original' with the 'Y Forecast' as follows:
SELECT c_intercept()+c_slope()*x AS 'Y Forecast', y AS 'Y Original', (c_intercept()+c_slope()*x) - y AS 'Y Error' FROM simreg;
This will produce the following output:
D. Calculating the Mean Absolute Difference
We can calculate the Mean Absolute Difference (MAD) as a means to compare the "Simple Regression Method" with other forecasting methods. The SQL command to get the MAD is:
SELECT avg(abs((c_intercept()+c_slope()*x) - y)) AS 'MAD' FROM simreg;
Which produces the output:
E. Calculating the Root Mean Square Error
G. Correlation Coefficient
The Correlation Coefficient is designated in Statistics by the symbol R and this is for a good reason. It means that if we have already the Coefficient of Determination, which is designated by R-Squared, we can readily derive R by just squaring the value of the R-Squared. Thus, we can create the following function in SQL to get R:
DELIMITER |
CREATE FUNCTION c_r() RETURNS DOUBLE
BEGIN
DECLARE myres DOUBLE;
SELECT sqrt( c_r_squared() ) INTO myres;
return myres;
END |
DELIMITER ;
After creating the c_r() function, we can get the Correlation Coefficient by issuing the command:
SELECT c_r() AS 'Correlation';
This produces the output:
The F Statistic is the difference between the regression mean square (RMS) and the error mean square (EMS). Since the RMS is equal to the regression sum of square (RSS), we just need to create a function to derive the EMS as follows:
DELIMITER |
CREATE FUNCTION c_ems() RETURNS DOUBLE
BEGIN
DECLARE myres DOUBLE;
SELECT sum(power(y-(c_intercept()+c_slope()*x),2)) / (count(x)-2) INTO myres FROM simreg;
return myres;
END |
DELIMITER ;
After this, the function that will create the F Statistic can be created as:
Then, the following command to calculate the F Statistic can be invoke:
SELECT c_f_stat() AS 'F Statistic';
This produces the following output;
I. The Student's t Statistic
In a simple regression equation, the relation between t and F statistic is that the square of the t Statistic is equal to the F Statistic. Therefore, if we got the F, the t can be derived by just getting the square root of F. This is undertaken by the following function:
DELIMITER |
CREATE FUNCTION c_t_stat() RETURNS DOUBLE
BEGIN
DECLARE myres DOUBLE;
SELECT sqrt(c_rss()/c_ems()) INTO myres;
return myres;
END |
DELIMITER ;
The Student's t Statistic can be calculated by issuing the following command:
SELECT c_t_stat() AS 't Statistic';
This produces the following output:
J. Putting it all together
To put it all together, we can create the procedure:
DELIMITER |
CREATE PROCEDURE c_simple_regression()
BEGIN
SELECT c_intercept() as 'Intercept',c_slope() as 'Slope',c_t_stat() as 't Stat',c_r_squared() as 'R Squared',c_r() as 'Correlation', c_f_stat() as 'F Stat';
END |
DELIMITER ;
Note:
Given the following data in the MariaDB database table named "simreg":
X | Y |
1 | 1234 |
2 | 1768 |
3 | 2234 |
4 | 2555 |
5 | 2800 |
Where X is the independent variable and Y is the dependent variable, the slope can be calculated using the following SQL command:
SELECT (sum((x - (select avg(x) from simreg)) * (y - (select avg(y) from simreg)))) / sum(power(x - (select avg(x) from simreg),2)) AS 'Slope' FROM simreg;
This query produces the following output:
This query produces the following output:
Slope |
391.9 |
The slope value of 391.9 is correct. We can convert the query into an SQL function as follows:
DELIMITER |
CREATE FUNCTION c_slope() RETURNS DOUBLE
BEGIN
DECLARE myres DOUBLE;
SELECT (sum((x - (select avg(x) from simreg)) * (y - (select avg(y) from simreg)))) / sum(power(x - (select avg(x) from simreg),2)) INTO myres FROM simreg;
RETURN myres;
END |
DELIMITER ;
Such will create the function c_slope() and can be queried using the command:
SELECT c_slope() AS 'Slope';
B. Calculating for the Intercept
The Intercept can be calculated by issuing the following SQL command:
SELECT avg(y) - (sum((x - (select avg(x) from simreg)) * (y - (select avg(y) from simreg)))) / (sum((x - (select avg(x) from simreg))* (x - (select avg(x) from simreg)))) * avg(x) AS 'Intercept' FROM simreg;
B. Calculating for the Intercept
The Intercept can be calculated by issuing the following SQL command:
SELECT avg(y) - (sum((x - (select avg(x) from simreg)) * (y - (select avg(y) from simreg)))) / (sum((x - (select avg(x) from simreg))* (x - (select avg(x) from simreg)))) * avg(x) AS 'Intercept' FROM simreg;
This query produces the following output:
Intercept |
942.5 |
The Intercept value of 942.5 is correct. Such query can be converted into an SQL function as follows:
DELIMITER |
CREATE FUNCTION c_intercept() RETURNS DOUBLE
BEGIN
DECLARE myres DOUBLE;
SELECT avg(y) - (sum((x - (select avg(x) from simreg)) * (y - (select avg(y) from simreg)))) / (sum((x - (select avg(x) from simreg))* (x - (select avg(x) from simreg)))) * avg(x) INTO myres FROM simreg;
RETURN myres;
END |
DELIMITER ;
Likewise, such will create the function c_intercept() and can be queried using the command:
SELECT c_intercept() AS 'Intercept';
C. Forecasting
Given the Slope (b) and Intercept (a), the equation of the straight line is "Y = a + b X". We can use this equation to forecast the value of Y by supplying the value of X. To execute this in SQL, the command is:
SELECT c_intercept()+c_slope()*x AS 'Y Forecast' FROM simreg;
This query produces the following output:
SELECT c_intercept() AS 'Intercept';
C. Forecasting
Given the Slope (b) and Intercept (a), the equation of the straight line is "Y = a + b X". We can use this equation to forecast the value of Y by supplying the value of X. To execute this in SQL, the command is:
SELECT c_intercept()+c_slope()*x AS 'Y Forecast' FROM simreg;
This query produces the following output:
Y Forecast |
1334.4 |
1726.3 |
2118.2 |
2510.1 |
2902 |
If we want to have the forecast side by side with the original Y, we can just add the Y into the query as:
SELECT c_intercept()+c_slope()*x AS 'Y Forecast', y AS 'Y Original' FROM simreg;
This will produce the following output:
Y Forecast | Y Original |
1334.4 | 1234 |
1726.3 | 1768 |
2118.2 | 2234 |
2510.1 | 2555 |
2902 | 2800 |
Likewise, if we want to get the forecast error, we can just modify the query a bit to deduct the 'Y Original' with the 'Y Forecast' as follows:
SELECT c_intercept()+c_slope()*x AS 'Y Forecast', y AS 'Y Original', (c_intercept()+c_slope()*x) - y AS 'Y Error' FROM simreg;
This will produce the following output:
Y Forecast | Y Original | Y Error |
1334.4 | 1234 | 100.40000000000009 |
1726.3 | 1768 | -41.700000000000045 |
2118.2 | 2234 | -115.80000000000018 |
2510.1 | 2555 | -44.90000000000009 |
2902 | 2800 | 102 |
D. Calculating the Mean Absolute Difference
We can calculate the Mean Absolute Difference (MAD) as a means to compare the "Simple Regression Method" with other forecasting methods. The SQL command to get the MAD is:
SELECT avg(abs((c_intercept()+c_slope()*x) - y)) AS 'MAD' FROM simreg;
Which produces the output:
MAD |
80.96000000000008 |
E. Calculating the Root Mean Square Error
As an alternative the MAD, we can also get the Root Mean Square Error (RMSE) of the method. The SQL command is:
SELECT SQRT(AVG(POWER((c_intercept()+c_slope()*x - y),2))) AS 'RMSE' FROM simreg;
Which produces the output:
RMSE |
86.77407446927921 |
F. Coefficient of Determination
The Coefficient of Determination, also commonly referred to as R-Squared, is the percentage of the variation in the dependent variable (Y) that can be explained by the independent variable (X). The higher percentage and closer the value to 1, the better. To be precise, R-Squared is the Regression Sum of Squares (RSS) over the Total Sum of Squares (TSS).
To calculate R-Squared, the following SQL functions needs to be created to facilitate the query.
a) Mean of X function
DELIMITER |
CREATE FUNCTION c_avex() RETURNS DOUBLE
BEGIN
DECLARE myres DOUBLE;
SELECT avg(x) INTO myres FROM simreg;
return myres;
END |
DELIMITER ;
b) Mean of Y function
DELIMITER |
CREATE FUNCTION c_avey() RETURNS DOUBLE
BEGIN
DECLARE myres DOUBLE;
SELECT avg(y) INTO myres FROM simreg;
return myres;
END |
DELIMITER ;
c) Regression Sum of Squares (RSS) function
DELIMITER |
CREATE FUNCTION c_rss() RETURNS DOUBLE
BEGIN
DECLARE myres DOUBLE;
SELECT sum(power(((c_intercept()+c_slope()*x) - c_avey()),2)) INTO myres FROM simreg;
return myres;
END |
DELIMITER ;
d) Total Sum of Squares (TSS) function
DELIMITER |
CREATE FUNCTION c_tss() RETURNS DOUBLE
BEGIN
DECLARE myres DOUBLE;
SELECT sum(power(y-c_avey(),2)) INTO myres FROM simreg;
return myres;
END |
DELIMITER ;
e) R-Squared function
DELIMITER |
CREATE FUNCTION c_r_squared() RETURNS DOUBLE
BEGIN
DECLARE myres DOUBLE;
SELECT c_rss()/c_tss() INTO myres;
return myres;
END |
DELIMITER ;
After creating all these SQL functions, R-Squared can be calculated by issuing the following command:
SELECT c_r_squared() AS 'R-Squared';
This produces the following output:
R-Squared |
0.9760733246803284 |
G. Correlation Coefficient
The Correlation Coefficient is designated in Statistics by the symbol R and this is for a good reason. It means that if we have already the Coefficient of Determination, which is designated by R-Squared, we can readily derive R by just squaring the value of the R-Squared. Thus, we can create the following function in SQL to get R:
DELIMITER |
CREATE FUNCTION c_r() RETURNS DOUBLE
BEGIN
DECLARE myres DOUBLE;
SELECT sqrt( c_r_squared() ) INTO myres;
return myres;
END |
DELIMITER ;
After creating the c_r() function, we can get the Correlation Coefficient by issuing the command:
SELECT c_r() AS 'Correlation';
This produces the output:
Correlation |
0.9879642448615398 |
H. Calculating the F Statistic
The F Statistic is the difference between the regression mean square (RMS) and the error mean square (EMS). Since the RMS is equal to the regression sum of square (RSS), we just need to create a function to derive the EMS as follows:
DELIMITER |
CREATE FUNCTION c_ems() RETURNS DOUBLE
BEGIN
DECLARE myres DOUBLE;
SELECT sum(power(y-(c_intercept()+c_slope()*x),2)) / (count(x)-2) INTO myres FROM simreg;
return myres;
END |
DELIMITER ;
After this, the function that will create the F Statistic can be created as:
DELIMITER |
CREATE FUNCTION c_f_stat() RETURNS DOUBLE
BEGIN
DECLARE myres DOUBLE;
SELECT c_rss()/c_ems() INTO myres;
return myres;
END |
DELIMITER ;
CREATE FUNCTION c_f_stat() RETURNS DOUBLE
BEGIN
DECLARE myres DOUBLE;
SELECT c_rss()/c_ems() INTO myres;
return myres;
END |
DELIMITER ;
Then, the following command to calculate the F Statistic can be invoke:
SELECT c_f_stat() AS 'F Statistic';
This produces the following output;
F Statistic |
122.38319782621953 |
I. The Student's t Statistic
In a simple regression equation, the relation between t and F statistic is that the square of the t Statistic is equal to the F Statistic. Therefore, if we got the F, the t can be derived by just getting the square root of F. This is undertaken by the following function:
DELIMITER |
CREATE FUNCTION c_t_stat() RETURNS DOUBLE
BEGIN
DECLARE myres DOUBLE;
SELECT sqrt(c_rss()/c_ems()) INTO myres;
return myres;
END |
DELIMITER ;
The Student's t Statistic can be calculated by issuing the following command:
SELECT c_t_stat() AS 't Statistic';
This produces the following output:
t Statistic |
11.062693967846148 |
J. Putting it all together
To put it all together, we can create the procedure:
DELIMITER |
CREATE PROCEDURE c_simple_regression()
BEGIN
SELECT c_intercept() as 'Intercept',c_slope() as 'Slope',c_t_stat() as 't Stat',c_r_squared() as 'R Squared',c_r() as 'Correlation', c_f_stat() as 'F Stat';
END |
DELIMITER ;
and the simple regression statistics can be calculated by issuing the command:
CALL c_simple_regression();
which produces the output:
CALL c_simple_regression();
which produces the output:
Intercept | Slope | t Stat | R Squared | Correlation | F Stat |
942.5 | 391.9 | 11.062693 | 0.976073 | 0.987964 | 122.383197 |
Note:
The above-mentioned procedure has been tested in MariaDB 10.3 database. My guess is, it should also work with MySQL, PostgreSQL and other SQL databases with little modification and with some differences in precision mathematics.
Friday, February 22, 2019
Creating Self-Signed Certificates for the Apache Web Server
Use the OpenSSL package. Issue the following commands in the Linux terminal:
# openssl req -new > ca.csr
# openssl rsa -in privkey.pem -out ca.key
# openssl x509 -in ca.csr -out ca.crt -req -signkey ca.key -days 720
These commands creates the SSL certificates good for 720 days with the files ca.csr, ca.crt, and ca.key. Copy these files to the SSL directory of your Apache web server. In my Linux system, this is located in /etc/apache2/ssl
# cp ca.* /etc/apache2/ssl
Then, restart the Apache webserver for the new certificates to take effect.
# service apache2 restart
Thursday, February 21, 2019
Mounting Remote SSH Filesystem
This is how to mount remote SSH (Secure Sockets Host) filesystem on your local directory (e.g., /home/clemrasul/remoteserv) on Linux. Mounting remote directories in this way allows you to do server side programming with ease since source code can be edited using your favorite GUI text editor. The text editor need not have the feature of being able to log on to an SSH server. Here are the steps:
Step 1: Install the sshfs software
On Ubuntu, this is done using the command apt-get.
# apt-get install sshfs
Step 2: Place it in the Linux module and give permissions
# modprobe fuse
# adduser clemrasul fuse
# chown root:fuse /dev/fuse
# chmod +x /dev/fuse
This assumes a username of "clemrasul" that is added to the "fuse" group.
Step 3: Create the directory where the remove SSH filesystem will be mounted
# cd /home/clemrasul
# mkdir ~/remoteserv
This assumes a remove directory name of "remoteserv".
Step 4: Mount the remote SSH directory as follows:
# sshfs {fully qualified SSH username}:{default directory} {local directory mount point}
Example:
# sshfs clemrasul@taocoven.com:/home/clemrasul/html ~/remoteserv
You will be prompted by the remote SSH server for password. Once authenticated, the remote directory can be seen in the local directory as:
# cd /home/clemrasul/remoteserv/
Step 1: Install the sshfs software
On Ubuntu, this is done using the command apt-get.
# apt-get install sshfs
Step 2: Place it in the Linux module and give permissions
# modprobe fuse
# adduser clemrasul fuse
# chown root:fuse /dev/fuse
# chmod +x /dev/fuse
This assumes a username of "clemrasul" that is added to the "fuse" group.
Step 3: Create the directory where the remove SSH filesystem will be mounted
# cd /home/clemrasul
# mkdir ~/remoteserv
This assumes a remove directory name of "remoteserv".
Step 4: Mount the remote SSH directory as follows:
# sshfs {fully qualified SSH username}:{default directory} {local directory mount point}
Example:
# sshfs clemrasul@taocoven.com:/home/clemrasul/html ~/remoteserv
You will be prompted by the remote SSH server for password. Once authenticated, the remote directory can be seen in the local directory as:
# cd /home/clemrasul/remoteserv/
Subscribe to:
Posts (Atom)