I am trying to figure out a way to put a two dimensional array (using python) into an sqlite database. My array:

['hello', 'hello', 'hello'], ['hello', 'hello', 'hello']


What I want is for each tuple of 'hello's would a new row with each 'hello' being its own attribute. I'm not sure what I'm trying to do is even possible (I hope it is). I tried following a few other posts but I keep getting the error:

sqlite3.InterfaceError: Error binding parameter 0 - probably unsupported type.


Does anyone know how to insert a multidimensional array into a sqlite database? Any help would be appreciated. Here is my code:

import sqlite3

array2d = [['hello' for x in xrange(3)] for x in xrange(3)] 

var_string = ', '.join('?' * len(array2d))

conn = sqlite3.connect('sample.db')
c = conn.cursor()

c.execute('''CREATE TABLE sample (Name TEXT, Line_1 TEXT, Line_2 TEXT)''')

query_string = 'INSERT INTO sample VALUES (%s);' % var_string

c.execute(query_string, array2d)



Question: How do you prove $S=-\sum p\ln p$?
Answer: Approaching this from a purely Physics perspective, this is the Gibbs entropy of a system. Firstly, although the concept of entropy can be extended we are usually discussing equilibrium thermodynamics, and this is certainly where the Gibbs entropy is first introduced.

You are of course right that technically the dynamics could be fully described by their equations of motion, but then there wouldn't really be much need for the subject of thermodynamics. I mean thermodynamics in some ways is not as "fundamental" as other subjects in physics, in that it does not try to give a complete description of everything about the system you're studying. You're usually discussing large systems (and so looking for macroscopic properties), or small systems interacting with a large environment. (for example, it doesn't make a huge amount of sense to talk about the temperature of an electron) In reality it is entirely impractical to search for a deterministic description of such systems (even without Chaos theory and quantum mechanics the number of equations would just be too enormous) and so you use thermodynamics.

With equilibrium statistical thermodynamics (which is looking for a justification of classical thermodynamics based on averages of a microscopic description), you start with the principle of equal a priori probabilities which says for an isolated system which has been left alone for along time (vague, but basically that it's in equilibrium) every microstate available to the system is equally likely to be occupied. This is a big assumption, and there are a lot of people who would like to be able to justify it properly, but it's often argued on symmetry (with the information you have there is no reason to assume one particular microstate would be more likely than any other). More than that, it just works. 

The entropy of an isolated system was then postulated to be $S=k \ ln(\Omega)$ by Boltzmann where $\Omega$ is the number of microstates available to the system (it's easier to build this up assuming a discrete number of microstates, especially if you are talking about Boltzmann/Gibbs entropy). It's a postulate, but it needs to be consistent with the classical thermodynamic entropy. The Gibbs entropy is a natural extension of this when you consider systems which are in thermal contact with an environment and the microstate probabilities are no longer equal. You can show that it is consistent with the classical thermodynamic entropy for a number of systems, and really shows how entropy can be considered to be a measure of uncertainty about the microscopic details of the system.