# How to create a database in Mathematica

1. Feb 1, 2012

### NRedacted

Hi All,

I have to solve a system of non-linear equations for a wide range of parameter space. I'm using FindRoot which is sensitive to initial conditions so I have to do it by hand and by trial and error and plotting, rather than putting the equations in a loop or in a table.

So what I want to do is create a databse or a Matrix with a fixed number of columns but variable number of rows so I can keep appending it with new results as and when I solve for them.

I've looked at a few mathematica books and their online reference but they only teach me how to create a table or a matrix already filled with some numbers or text or functions. What I want to create is a blank variable of the matrix type to which I can keep adding more and more rows (or records) and my database develops to add my solutions for the varying parameter space. Can someone please tell me how I can create a matrix type variable, declare it to be a matrix and then at my own leisure append rows or records to it.

Thanks a lot
N

2. Feb 4, 2012

### Bill Simpson

Create an empty list for your database.
Then construct a new row for the database, perhaps using Solve or other methods.
Use [[]] to extract elements from your database.

In[30]:= database={};
In[31:= newrow={1,2,5,4,3,7,1,1,1,1};
In[32]:= database=Join[database,{newrow}]
Out[32]= {{1,2,5,4,3,7,1,1,1,1}}