Mastodon Politics, Power, and Science

Thursday, January 23, 2014

A few good chemical engineers.

Son, we live in a world that has chemicals, and those chemicals have to be stored in un-inspected, leaky tanks. Who's gonna do it? You? The EPA? I have a greater responsibility than you could possibly fathom. You weep for Charleston, WV, and you curse the corporations. You have that luxury. You have the luxury of not knowing what I know. That Charleston, WV's death, while tragic, probably saved lives. And my existence, while grotesque and incomprehensible to you, saves lives. You don't want the truth because deep down in places you don't talk about at parties, you want me on that tank, you need me on that tank. We use words like honor, code, loyalty. We use these words as the backbone of a life spent defending capitalism. You use them as a punchline. I have neither the time nor the inclination to explain myself to a man who rises and sleeps under the blanket of the very products that I provide, and then questions the manner in which I provide it. I would rather you just said thank you, and went on your way, Otherwise, I suggest you start a company, and show me how to store chemicals. Either way, I don't give a damn what you think you are entitled to.

Monday, January 20, 2014

two consecutive numbers in an additive series plus an offset is equal to the larger numbers n value plus one to the size of the series.

Figured out the relationship between two consecutive numbers in a series and the next larger series.  It has to do with multiples of the triangular numbers.

https://github.com/BuckRogers1965/Examples/blob/master/Math/additiveSeries/additiveSeries-Relationships.c

As you can see in the following example program:
 #include <stdio.h>


 int main () {


   int i, j, n, x;

   for (x=1; x<20; x++) {
     printf("\tFor additive series of size %d\n", x);
     printf("\tn\tadd\tseries\tformula\t\tnext\tf(n-1)\tf(n)\toffset\n");
     for (i = 1, j = 0, n =1 ; n<10; n++, i+=x ){
       j+=i;
       printf("\t%d\t%d\t%d\t%d\t\t%d\t%d\t%d\t%d\n", n, i, j, (x*n*n-(x-2)*n)/2,
       (x*(n-1)*(n-1)-(x-2)*(n-1))/2 + (x*n*n-(x-2)*n)/2 +(-x*n*n +3*x*n +n*n -3*n -2*x +2)/2,
       (x*(n-1)*(n-1)-(x-2)*(n-1))/2, (x*n*n-(x-2)*n)/2, (-x*n*n +3*x*n +n*n -3*n -2*x +2)/2 );
     }
     printf("\n\n");
   }

 }




 For additive series of size 1
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 2 3 3  4 1 3 0
 3 3 6 6  9 3 6 0
 4 4 10 10  16 6 10 0
 5 5 15 15  25 10 15 0
 6 6 21 21  36 15 21 0
 7 7 28 28  49 21 28 0
 8 8 36 36  64 28 36 0
 9 9 45 45  81 36 45 0


 For additive series of size 2
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 3 4 4  5 1 4 0
 3 5 9 9  12 4 9 -1
 4 7 16 16  22 9 16 -3
 5 9 25 25  35 16 25 -6
 6 11 36 36  51 25 36 -10
 7 13 49 49  70 36 49 -15
 8 15 64 64  92 49 64 -21
 9 17 81 81  117 64 81 -28


 For additive series of size 3
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 4 5 5  6 1 5 0
 3 7 12 12  15 5 12 -2
 4 10 22 22  28 12 22 -6
 5 13 35 35  45 22 35 -12
 6 16 51 51  66 35 51 -20
 7 19 70 70  91 51 70 -30
 8 22 92 92  120 70 92 -42
 9 25 117 117  153 92 117 -56


 For additive series of size 4
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 5 6 6  7 1 6 0
 3 9 15 15  18 6 15 -3
 4 13 28 28  34 15 28 -9
 5 17 45 45  55 28 45 -18
 6 21 66 66  81 45 66 -30
 7 25 91 91  112 66 91 -45
 8 29 120 120  148 91 120 -63
 9 33 153 153  189 120 153 -84


 For additive series of size 5
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 6 7 7  8 1 7 0
 3 11 18 18  21 7 18 -4
 4 16 34 34  40 18 34 -12
 5 21 55 55  65 34 55 -24
 6 26 81 81  96 55 81 -40
 7 31 112 112  133 81 112 -60
 8 36 148 148  176 112 148 -84
 9 41 189 189  225 148 189 -112


 For additive series of size 6
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 7 8 8  9 1 8 0
 3 13 21 21  24 8 21 -5
 4 19 40 40  46 21 40 -15
 5 25 65 65  75 40 65 -30
 6 31 96 96  111 65 96 -50
 7 37 133 133  154 96 133 -75
 8 43 176 176  204 133 176 -105
 9 49 225 225  261 176 225 -140


 For additive series of size 7
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 8 9 9  10 1 9 0
 3 15 24 24  27 9 24 -6
 4 22 46 46  52 24 46 -18
 5 29 75 75  85 46 75 -36
 6 36 111 111  126 75 111 -60
 7 43 154 154  175 111 154 -90
 8 50 204 204  232 154 204 -126
 9 57 261 261  297 204 261 -168


 For additive series of size 8
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 9 10 10  11 1 10 0
 3 17 27 27  30 10 27 -7
 4 25 52 52  58 27 52 -21
 5 33 85 85  95 52 85 -42
 6 41 126 126  141 85 126 -70
 7 49 175 175  196 126 175 -105
 8 57 232 232  260 175 232 -147
 9 65 297 297  333 232 297 -196


 For additive series of size 9
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 10 11 11  12 1 11 0
 3 19 30 30  33 11 30 -8
 4 28 58 58  64 30 58 -24
 5 37 95 95  105 58 95 -48
 6 46 141 141  156 95 141 -80
 7 55 196 196  217 141 196 -120
 8 64 260 260  288 196 260 -168
 9 73 333 333  369 260 333 -224


 For additive series of size 10
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 11 12 12  13 1 12 0
 3 21 33 33  36 12 33 -9
 4 31 64 64  70 33 64 -27
 5 41 105 105  115 64 105 -54
 6 51 156 156  171 105 156 -90
 7 61 217 217  238 156 217 -135
 8 71 288 288  316 217 288 -189
 9 81 369 369  405 288 369 -252


 For additive series of size 11
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 12 13 13  14 1 13 0
 3 23 36 36  39 13 36 -10
 4 34 70 70  76 36 70 -30
 5 45 115 115  125 70 115 -60
 6 56 171 171  186 115 171 -100
 7 67 238 238  259 171 238 -150
 8 78 316 316  344 238 316 -210
 9 89 405 405  441 316 405 -280


 For additive series of size 12
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 13 14 14  15 1 14 0
 3 25 39 39  42 14 39 -11
 4 37 76 76  82 39 76 -33
 5 49 125 125  135 76 125 -66
 6 61 186 186  201 125 186 -110
 7 73 259 259  280 186 259 -165
 8 85 344 344  372 259 344 -231
 9 97 441 441  477 344 441 -308


 For additive series of size 13
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 14 15 15  16 1 15 0
 3 27 42 42  45 15 42 -12
 4 40 82 82  88 42 82 -36
 5 53 135 135  145 82 135 -72
 6 66 201 201  216 135 201 -120
 7 79 280 280  301 201 280 -180
 8 92 372 372  400 280 372 -252
 9 105 477 477  513 372 477 -336


 For additive series of size 14
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 15 16 16  17 1 16 0
 3 29 45 45  48 16 45 -13
 4 43 88 88  94 45 88 -39
 5 57 145 145  155 88 145 -78
 6 71 216 216  231 145 216 -130
 7 85 301 301  322 216 301 -195
 8 99 400 400  428 301 400 -273
 9 113 513 513  549 400 513 -364


 For additive series of size 15
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 16 17 17  18 1 17 0
 3 31 48 48  51 17 48 -14
 4 46 94 94  100 48 94 -42
 5 61 155 155  165 94 155 -84
 6 76 231 231  246 155 231 -140
 7 91 322 322  343 231 322 -210
 8 106 428 428  456 322 428 -294
 9 121 549 549  585 428 549 -392


 For additive series of size 16
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 17 18 18  19 1 18 0
 3 33 51 51  54 18 51 -15
 4 49 100 100  106 51 100 -45
 5 65 165 165  175 100 165 -90
 6 81 246 246  261 165 246 -150
 7 97 343 343  364 246 343 -225
 8 113 456 456  484 343 456 -315
 9 129 585 585  621 456 585 -420


 For additive series of size 17
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 18 19 19  20 1 19 0
 3 35 54 54  57 19 54 -16
 4 52 106 106  112 54 106 -48
 5 69 175 175  185 106 175 -96
 6 86 261 261  276 175 261 -160
 7 103 364 364  385 261 364 -240
 8 120 484 484  512 364 484 -336
 9 137 621 621  657 484 621 -448


 For additive series of size 18
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 19 20 20  21 1 20 0
 3 37 57 57  60 20 57 -17
 4 55 112 112  118 57 112 -51
 5 73 185 185  195 112 185 -102
 6 91 276 276  291 185 276 -170
 7 109 385 385  406 276 385 -255
 8 127 512 512  540 385 512 -357
 9 145 657 657  693 512 657 -476


 For additive series of size 19
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 20 21 21  22 1 21 0
 3 39 60 60  63 21 60 -18
 4 58 118 118  124 60 118 -54
 5 77 195 195  205 118 195 -108
 6 96 291 291  306 195 291 -180
 7 115 406 406  427 291 406 -270
 8 134 540 540  568 406 540 -378
 9 153 693 693  729 540 693 -504



Wednesday, January 15, 2014

General formula for additive series

I couldn't sleep, so instead I figured out the formulas for a whole family of additive series. (x* n ^2 - (x-2)n )/2 where x is the amount you add each time, starting with one and n is the count of the series. This is a general solution to any fixed addition series counting from one. It was really amazing when I changed the program to work with the next entry in the series and it just worked.

https://github.com/BuckRogers1965/Examples/blob/master/Math/additiveSeries/additiveSeries.c

#include <stdio.h>


int main () {


  int i, j, n, x;

  for (x=1; x<20; x++) {
    printf("for additive series of size %d\n", x);
    for (i = 1, j = 0, n =1 ; n<10; n++, i+=x ){
      j+=i;
      printf("%d  %d  %d  %d \n", n, i, j, (x*n*n-(x-2)*n)/2);
    }
    printf("\n\n");
  }

}

Output:
for additive series of size 1

1  1  1  1 

2  2  3  3 

3  3  6  6 

4  4  10  10 

5  5  15  15 

6  6  21  21 

7  7  28  28 

8  8  36  36 

9  9  45  45 





for additive series of size 2

1  1  1  1 

2  3  4  4 

3  5  9  9 

4  7  16  16 

5  9  25  25 

6  11  36  36 

7  13  49  49 

8  15  64  64 

9  17  81  81 





for additive series of size 3

1  1  1  1 

2  4  5  5 

3  7  12  12 

4  10  22  22 

5  13  35  35 

6  16  51  51 

7  19  70  70 

8  22  92  92 

9  25  117  117 





for additive series of size 4

1  1  1  1 

2  5  6  6 

3  9  15  15 

4  13  28  28 

5  17  45  45 

6  21  66  66 

7  25  91  91 

8  29  120  120 

9  33  153  153 





for additive series of size 5

1  1  1  1 

2  6  7  7 

3  11  18  18 

4  16  34  34 

5  21  55  55 

6  26  81  81 

7  31  112  112 

8  36  148  148 

9  41  189  189 





for additive series of size 6

1  1  1  1 

2  7  8  8 

3  13  21  21 

4  19  40  40 

5  25  65  65 

6  31  96  96 

7  37  133  133 

8  43  176  176 

9  49  225  225 





for additive series of size 7

1  1  1  1 

2  8  9  9 

3  15  24  24 

4  22  46  46 

5  29  75  75 

6  36  111  111 

7  43  154  154 

8  50  204  204 

9  57  261  261 





for additive series of size 8

1  1  1  1 

2  9  10  10 

3  17  27  27 

4  25  52  52 

5  33  85  85 

6  41  126  126 

7  49  175  175 

8  57  232  232 

9  65  297  297 





for additive series of size 9

1  1  1  1 

2  10  11  11 

3  19  30  30 

4  28  58  58 

5  37  95  95 

6  46  141  141 

7  55  196  196 

8  64  260  260 

9  73  333  333 





for additive series of size 10

1  1  1  1 

2  11  12  12 

3  21  33  33 

4  31  64  64 

5  41  105  105 

6  51  156  156 

7  61  217  217 

8  71  288  288 

9  81  369  369 





for additive series of size 11

1  1  1  1 

2  12  13  13 

3  23  36  36 

4  34  70  70 

5  45  115  115 

6  56  171  171 

7  67  238  238 

8  78  316  316 

9  89  405  405 





for additive series of size 12

1  1  1  1 

2  13  14  14 

3  25  39  39 

4  37  76  76 

5  49  125  125 

6  61  186  186 

7  73  259  259 

8  85  344  344 

9  97  441  441 





for additive series of size 13

1  1  1  1 

2  14  15  15 

3  27  42  42 

4  40  82  82 

5  53  135  135 

6  66  201  201 

7  79  280  280 

8  92  372  372 

9  105  477  477 





for additive series of size 14

1  1  1  1 

2  15  16  16 

3  29  45  45 

4  43  88  88 

5  57  145  145 

6  71  216  216 

7  85  301  301 

8  99  400  400 

9  113  513  513 





for additive series of size 15

1  1  1  1 

2  16  17  17 

3  31  48  48 

4  46  94  94 

5  61  155  155 

6  76  231  231 

7  91  322  322 

8  106  428  428 

9  121  549  549 





for additive series of size 16

1  1  1  1 

2  17  18  18 

3  33  51  51 

4  49  100  100 

5  65  165  165 

6  81  246  246 

7  97  343  343 

8  113  456  456 

9  129  585  585 





for additive series of size 17

1  1  1  1 

2  18  19  19 

3  35  54  54 

4  52  106  106 

5  69  175  175 

6  86  261  261 

7  103  364  364 

8  120  484  484 

9  137  621  621 





for additive series of size 18

1  1  1  1 

2  19  20  20 

3  37  57  57 

4  55  112  112 

5  73  185  185 

6  91  276  276 

7  109  385  385 

8  127  512  512 

9  145  657  657 





for additive series of size 19

1  1  1  1 

2  20  21  21 

3  39  60  60 

4  58  118  118 

5  77  195  195 

6  96  291  291 

7  115  406  406 

8  134  540  540 

9  153  693  693 




Thursday, December 19, 2013

Created my first 3D printer design. An external RFID case.

I am planning on playing around with RFID to open the door to my house.  The RFID board I am using is just a circuit board, so I needed something to mount and protect it outside the door. I didn't see anything on Thingiverse, and I had just looked at an openscad tutorial, so I went through step by step and made an enclosure I thought would work for me.

Downloadable from here:

http://www.thingiverse.com/thing:207213


Building a framework to manage Hackmaster character sheet management

I'm working on a project with a friend to manage the Hackmaster RPG character sheets on the web.

We are working to set up a basic framework for the site.  We want a single page to be updated dynamically with no reloads at all.

Our thought is to use MongoDB using Perl on the web server back-end as the presistant data store.  Then use jquery to pass data to and from the server to the web page.  Finally Use knockoutjs to update the data elements in the page.

How to install mongodb on Ubuntu:  http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/

How to install knockoutjs: http://knockoutjs.com/downloads/index.html

Testing if mongodb works:

> Mongo
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
    http://docs.mongodb.org/
Questions? Try the support group
    http://groups.google.com/group/mongodb-user
Server has startup warnings:
Mon Sep  2 22:30:58.039 [initandlisten]
Mon Sep  2 22:30:58.039 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.
Mon Sep  2 22:30:58.040 [initandlisten] **       32 bit builds are limited to less than 2GB of data (or less with --journal).
Mon Sep  2 22:30:58.040 [initandlisten] **       Note that journaling defaults to off for 32 bit and is currently off.
Mon Sep  2 22:30:58.040 [initandlisten] **       See http://dochub.mongodb.org/core/32bit
Mon Sep  2 22:30:58.040 [initandlisten]
> db.test.save( { a: 1 } )
> db.test.find()
{ "_id" : ObjectId("52254b79b578d8dc54e545ac"), "a" : 1 }
> quit
function quit() { [native code] }
> quit()
Next thing I need to do is to write a little perl cgi script to act as a gateway between the web page and mongo. 

How to redesign the future.

One of the major problems in people's lives is that too much stuff we use is not designed to work together. The people who design the different systems in our houses (heaters, dishwashers, clothes washers, dryers, fridges, freezers), our cars, our phones, and our computers are all work independently, with no concept of managing the houses power.  This inefficiency in design makes the modern house nearly impossible to convert to alternative energy systems.

If I were running a huge high tech company,  I would take in 100 random families from every area in the country, 2 per state, and build them 10 different  styles of housing, ecologically sound and sustainable, something that reuses a lot things we think of us as waste today.  The initial building should be engineered to last 100 years. I would design these houses so that even if they were torn down, everything that went in them could be used again in another house.

The houses should each be independent, off the grid and not connected to any utilities. They should have sufficient solar panels and wind generators to power the house and to recharge the electrical vehicles and electric mowers, and electric power tools.

I would roll out 10 versions, to 10 families each, of a complete set of technologies, and create a single environment that spans from smart phones, to pad computers, to TVs, to laptops, to desktop machines. An environment that would make it impossible to lose data, that securely shared info anywhere in the world, proof even against the best intelligence agency/corporate spying.  That could scale up temporarily using shared cloud processors to inexpensively perform massive calculations in the blink of an eye.

This environment would span all the house systems, including the appliances, heating, cooling, and hot water generation.  By centrally managing when each system is drawing their highest amount of power so that they take turns you could reduce the maximum amount of amps needed to run a home by a factor of 10.  Just by taking turns, not running the the washer up in a spin cycle when the freezer compressor is running, you can massively reduce the maximum level of required amps. By using LED lighting, and light pipes to bring in ambient sunlight you could reduce the power required for lighting to about 1/4 of that required for florescent lights. Half the energy used in a house goes to heating water. By using solar water heaters you could make the cost of generating hot water essentially free.

Such a house could easily be powered by a many fewer solar panels and a much smaller set of lead acid batteries than a standard house that does not intelligently manage its power requirements.  This makes the return on investment of the solar and wind power generation system pay back in just a few years instead of in decades.

I would combine the best features and requests of all these different groups of people, fix any problems they run into, and finally roll out a complete solution to living, that uses tech as a tool to make people's lives better and more complete.  The reuse and recycling of common waste items would create entire new sectors of our economy. I would radically redesign everything from scratch, creating a house that can be build and maintained for much less than anything mass produced today.

Finally I would redo how houses are built. I would manage the way houses are build centrally, for economies of scale. Think car manufacture, not house contractor for the model I would use to roll out these new methods of living. But the houses would be designed online by the customer, then the blueprints generated would be approved by an engineer and an architect, working with the customer to quickly nail down any issues, any custom construction built in a large building and shipped to the customer site where a uniformed professional work crew that makes a living wage would assemble the homes.

Thursday, August 1, 2013

Today's Sensor is the Joy Stick!

I am slowly going through all 37 of the modules in the Sunfounder lab kit, one a day. 

Tonight I wired up the joystick, and tried out the sketch from the documentation.  The markings on the board were good, and with the help of the sketch I was quickly reading the analog values, but the digital button seemed to not work.  I remembered that there is a built in 20K ohm resistor inside the Arduino.  This means that the pin will normally be high, and then go low when you press the button.



Save this file as Joystick.ino inside a Joystick directory in your Arduino folder.
int jX = 0; // Analog pins for X and Y axis.
int jY = 1;
int jZ = 7; // Digital pin on Z axis.

void setup ()
{
  pinMode (jX, INPUT);
  pinMode (jY, INPUT);
  pinMode (jZ, INPUT);
  digitalWrite(jZ, HIGH);  // This was missing.
  // The above line sets the pin high
  // and engages an internal resistor.
  Serial.begin (9600);
}

void loop ()
{
  int x, y, z;
  static int px, py, pz;
  x = analogRead (jX) / 10.24 - 50;
  y = analogRead (jY) / 10.24 - 50;
  z = digitalRead (jZ) ;
 
  if ( px!=x || py!=y || pz!=z ){
    Serial.print (x, DEC);
    Serial.print (",");
    Serial.print (y, DEC);
    Serial.print (",");
    Serial.println (z, DEC);
  
    px=x;
    py=y;
    pz=z;
  }
 
  delay (200);
}



I added in some logic to only report when there is a change, the static keyword only allocates the variables once, and then stores the old value. I also scaled the range from 0 to 99 on the x and y axis, and then subtracted 50 so that center scale is zero.

The pin out markings were good on this one.

Player Portal in Mega Mappers

Codex Engine: Player Portal, Auth, Rules-as-MCP & AI NPCs (Pure Node-Tree Edition) Defining game rulesets (D&D 5e, Pathfinder, Cyber...