Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Welcome to LinuxQuestions.org, a friendly and active Linux Community.

You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!

Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.

If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.

Having a problem logging in? Please visit this page to clear all LQ-related cookies.

Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.

Exclusive for LQ members, get up to 45% off per month. Click here for more info.

I have an elaborate spreadsheet that computes income tax based on a given gross. The gross input is entered in one cell, and the whole spreadsheet derives results from it.

The problem is the input cell can only hold one value. I want the spreadsheet to act as a function, so hundreds of values can be input, and output range of values.

It appears that no mainstream spreadsheets can do this. I've looked at oocalc, excel, and googledocs.

Are there any math tools that can model a function with a spreadsheet-like presentation, and handle a series of inputs?

Hello,
I don't know if I fully understand what you want, but I would recommend Giac/Xcas : http://www-fourier.ujf-grenoble.fr/~parisse/giac.html
wich is a computer algebra system.
It has a spreadsheet functionnality and you can eventually define cells that are functions, you put something like "x->x^2+1" in the A0 cell and in the A1 cell put "A0(3)" and the value of A1 will be the evaluation of the function defined in A0, i.e 10.
I hope this tool will help you.

Hello,
I don't know if I fully understand what you want, but I would recommend Giac/Xcas : http://www-fourier.ujf-grenoble.fr/~parisse/giac.html
wich is a computer algebra system.
It has a spreadsheet functionnality and you can eventually define cells that are functions, you put something like "x->x^2+1" in the A0 cell and in the A1 cell put "A0(3)" and the value of A1 will be the evaluation of the function defined in A0, i.e 10.
I hope this tool will help you.

At first glance, this appears to be exactly what I need. Thanks, I'll check it out. Might be a pain though, since there doesn't seem to be an etch version.

I was able to get it installed.. had to create a 32 bit chroot jail running lenny.

I thought Xcas would work, but now that I'm actually trying to use it I'm not so sure. Suppose the taxable income is in cell B2, and the resulting tax ends up in cell B30.

I want cell B2 to get as input the values 2000, 2500, 3000, 3500, for example. How is that specified? I could do a series in a column (A0..A3), but when I enter A0..A3 in cell B2, the range is referenced literally in every cell that references B2. And cell B20 has garbage. I would like the results to be put in say E0..E3.

You seem to think I want the spreadsheet to use a function. I actually want the spreadsheet to /become/ the function.

I understand your problem better now. I don't see how to do exactly what you want (consider the spreadsheet as a function) with xcas.
But I have two solutions for your problem :
1) Write down the full function that computes your income tax and map it to a list. You don't even need a spreadsheet.

But I presume that something makes you want to preserve the use of a spreadsheet, so here's solution 2, also answering your question :

Quote:

I want cell B2 to get as input the values 2000, 2500, 3000, 3500, for example. How is that specified?

2) Put a list in B2 for example "=[2000, 2500, 3000, 3500]". And do all you computations bearing in mind that your values are lists.
You can still apply operations like "sum" or "mean" over a list of lists, they will be applied element by element on the lists.
And you can map functions to a list with "map([2000, 2500, 3000, 3500], x -> x^2)" for example.
Using that you will be able to do all your computations on each element of the input list and get the list of results at the end.

I hope this will help.

Last edited by antegallya; 11-01-2009 at 10:37 AM.

It may have worked, but there was a significant warning about dependencies on different versions of low level libraries like libc type of stuff. The warning implied that chance of success was not great. I could have forced the installation, but I will not risk destroying the fragile hack of a system that I have running well at the moment. In the 32bit chroot jail running lenny, there was no such warning, and it went smoothly.

Quote:

Originally Posted by antegallya

I understand your problem better now. I don't see how to do exactly what you want (consider the spreadsheet as a function) with xcas.
But I have two solutions for your problem :
1) Write down the full function that computes your income tax and map it to a list. You don't even need a spreadsheet.

The spreadsheet gave me the presentation and portability that I was after, but since today's tools are unsuitable for expressing a function as a spreadsheet, I broke down and decided to write a traditional function using a programming language instead.

Quote:

Originally Posted by antegallya

But I presume that something makes you want to preserve the use of a spreadsheet, so here's solution 2, also answering your question :

2) Put a list in B2 for example "=[2000, 2500, 3000, 3500]". And do all you computations bearing in mind that your values are lists.

I was after more flexibility and encapsulation. I didn't want every operation in the spreadsheet to be designed to operate on more than one input. Just like in programming languages, it's a good design (for simplicity) for a function to only have awareness of one input value or record at a time, and output exactly one value (essentially, a pure math function). So I was originally after a mechanism that would copy the first value of a list to the input cell, evaluate the spreadsheet, capture the corresponding output cell, and iterate to the next value.

It would be a useful capability to have. Sometimes I quickly come up with a spreadsheet, which evolves, and then as an afterthought I want to do more advanced things like feed a series through it. I find it surprising that it's not a common enough need for mainstream spreadsheets to simply have that kind of feature.

LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.