Thread: maths functions and spreadsheet
Readers, I want to store data in a database. Do I have to perform mathematical functions within the database, or can I use a spreadsheet (e.g. calc)? For example: spreadsheet with cells of a formula such as: sum=((database 1 table 1, row 2 colum 3)*(spreadsheet cell a1)/(database 2 table 2, row 3 column 4))-exp (spreadsheet cell b2)) Or must I perform all computations in the database and then create some sort of report to display the results? Yours, postgresql 826, pgadmin 3, openoffice 221, mandriva 2007 postgresqlnovice@conference.jabber.org
--- On Mon, 1/28/08, e-letter <inpost@gmail.com> wrote: > For example: > > spreadsheet with cells of a formula such as: > > sum=((database 1 table 1, row 2 colum 3)*(spreadsheet cell > a1)/(database 2 table 2, row 3 column 4))-exp (spreadsheet > cell b2)) > > Or must I perform all computations in the database and then > create some sort of report to display the results? If these are the type of calculations that you want to preform, you are probably better off sticking with a spreadsheet. Database *can* provide sophisticated calculations for analysis. But useful calculations are possible when a well designedrelational model implement in a database. It is the model that provides the mechanism for analyzing the data storedin the database. Regards, Richard Broersma Jr.
On 29/01/2008, e-letter <inpost@gmail.com> wrote: > I want to store data in a database. Do I have to perform mathematical > functions within the database, or can I use a spreadsheet (e.g. calc)? It depends. > sum=((database 1 table 1, row 2 colum 3)*(spreadsheet cell > a1)/(database 2 table 2, row 3 column 4))-exp (spreadsheet cell b2)) My immediate question here would be: "how do you assure that structure with the information stored within a database?" > Or must I perform all computations in the database and then create > some sort of report to display the results? That's another option, but this can't be answered w/o knowledge of a use-case. One nifty thing you may want to look into *if* you go with the "calculation within database" solution would be pl/R, which should enable you to output postscript graphs of your results as a report .... > Yours, Cheers, Andrej -- Please don't top post, and don't use HTML e-Mail :} Make your quotes concise. http://www.american.edu/econ/notes/htmlmail.htm
On 28/01/2008, Christopher Browne <cbbrowne@gmail.com> wrote: > On Jan 28, 2008 8:42 PM, e-letter <inpost@gmail.com> wrote: > > I am not sure what spreadsheet software you are using or imagining > using; I would be inclined to consider how the spreadsheet works when > considering this... > > - If your spreadsheet can dynamically grab data via ODBC/JDBC, (I > think Excel can do that), you could choose either to do the > calculation in the database, or have the formula in the spreadsheet. > > - If you don't have a particular spreadsheet in mind, and really just > intend to deploy "a report," then I'd be inclined to handle this > calculation in the database. That way, you don't need to worry about > the interactions between the reporting language and SQL. Now I use calc. Initially, I wanted to do the following: Use two input cells, a1 and a2, to enter data and the results to appear in cells b1, b2, b3, b4. If I add a value of x in a1, I want the value y in a2 to be calculated using some formula such as y=3x. Similarly if I enter a value y in a2, I want a1 to be calculated. I also want values of a, b, c, d to be calculated and displayed in cells b1, b2, b3, b4 respectively, depending on a formula based upon values of x and y (for example a=2x^y, b=x-y, etc). From what I've been told so far, the above task cannot be achieved using a spreadsheet, since missing arguments need to be considered. Hence trying to investigate if some sort of database may be appropriate. As a novice it is difficult to make a judgement as to whether the task I want to achieve is best perfomed in a spreadsheet, database, programming language (fortran?) or some combination. On 29-01-08 Andrej wrote: "...would be pl/R,..." I presume you mean perl and R, well I have R; presumably I could substitute perl for another programming language. Now I have a spreadsheet which consists of empirical data and fundamental physical values used through numerous worksheets. I thought that it may be more efficient to use a database to store the various tables of empirical data, physical values, etc. and then have some spreadsheet, document, etc. where I could enter my variables (a and/or b) and see the resulting output (a simple table initially). Hope that this explanation helps. Yours, René
On 29/01/2008, e-letter <inpost@gmail.com> wrote: > Use two input cells, a1 and a2, to enter data and the results to > appear in cells b1, b2, b3, b4. > If I add a value of x in a1, I want the value y in a2 to be calculated > using some formula such as y=3x. Similarly if I enter a value y in a2, > I want a1 to be calculated. > > I also want values of a, b, c, d to be calculated and displayed in > cells b1, b2, b3, b4 respectively, depending on a formula based upon > values of x and y (for example a=2x^y, b=x-y, etc). > > From what I've been told so far, the above task cannot be achieved > using a spreadsheet, since missing arguments need to be considered. > Hence trying to investigate if some sort of database may be > appropriate. > > As a novice it is difficult to make a judgement as to whether the task > I want to achieve is best perfomed in a spreadsheet, database, > programming language (fortran?) or some combination. Well now it depends on the amount of static data your computations require, but my guess would be that if you found a programmable calculator with a physics module you'd be best served by that. > On 29-01-08 Andrej wrote: > "...would be pl/R,..." > I presume you mean perl and R, well I have R; presumably I could > substitute perl for another programming language. No, I mean pl/R ... there's a project to embed R as a language into Postgres. > Now I have a spreadsheet which consists of empirical data and > fundamental physical values used through numerous worksheets. I > thought that it may be more efficient to use a database to store the > various tables of empirical data, physical values, etc. and then have > some spreadsheet, document, etc. where I could enter my variables (a > and/or b) and see the resulting output (a simple table initially). > Hope that this explanation helps. Yes, I see where you're heading, and I reckon that a bit of programming would be the way to go with this task. You could conceivably solve it with either a RDBMS and some programming (I think that would be overkill, frankly) or with a spreadsheet and its native scripting language, or with plain perl (python, .... ) & Tk (or GTK, wx, Qt or whatever you prefer). My gut-feeling says option 3 is most suited to the task at hand. Or, option four, search freshmeat for +calculator +physics and see what comes up :} ... maybe you don't need to re-invent the wheel after all? > Yours, > > René Cheers, Andrej -- Please don't top post, and don't use HTML e-Mail :} Make your quotes concise. http://www.american.edu/econ/notes/htmlmail.htm