Software for mathematical calculations?

Software for mathematical calculations?

by N Hansen -
Number of replies: 14
I'm looking for freeware to do some calculations. They involve solving equations for two variables. I know the variables are 0 or higher and are whole numbers. I find online graphing solutions but it is hard to see where the whole numbers intersect. Does anyone know any freeware or online calculators that can do this?

For example, I have an equation like this:

11x+31y=1410

Now this one was simple enough for me to do in my head, and I got x=100, y=10. But I have some others that aren't so easy to do off the top of my head, like:

11x+31y=1277

I'm not one hundred percent certain that these will yield round numbers but I suspect they will and am looking for software that will show me potential solutions.

Now, if there is no such software available for free but there is a math professor or even grad student reading this who can do these kinds of calculations, I'd be happy to give you the calculations that need to be done and give you co-author credit on an article I plan to write once I finish these calculations.
Average of ratings: -
In reply to N Hansen

Re: Software for mathematical calculations?

by John Isner -
If you want only positive integral solutions and the coefficients are small numbers like the ones in your examples, you can do it easily using the brute force algorithm described below. Let's take your example:

(1) $$11x+31y=1410$$

Rewrite the equation so that the unknown with the smaller coefficient is on the left:

(2) $$x = \frac{1410 - 31y}{11}$$

For $$x$$ to be integral,

(3) $$\left( 1410 - 31y \right) % 11 = 0$$

which means that $$1410 - 31y$$ is evenly divisible by 11. To find all values of $$y$$ which satisfy (3), we only need to try y = 0, 1, 2, ... up to a maximum of $$\frac{1410}{31} = 45$$. Note that choosing the unknown with the smaller coefficient in (1) results in fewer iterations in the algorithm.

For each value of $$y$$ that satisfies (3), compute the corresponding value of $$x$$ by plugging $$y$$ into equation (2).

This algorithm can easily be translated into a few lines of code.



In reply to John Isner

Re: Software for mathematical calculations?

by John Isner -
I'm not a php programmer, but just for fun I was able to cobble together a little php function that does the job.

In reply to John Isner

Re: Software for mathematical calculations?

by N Hansen -
Thanks John! This function works, but it only gives one answer, and I know in at least one of the equations could have two possible answers because it was divisible by both 11 and 31 and so either x or y has to be 0. Another one it gave an answer that is highly unlikely to be the one I am looking for based on the context that it appears in, and so I suspect there must be another combination of two whole numbers that would fit the situation better. Is there a way to make the function spit out all possible answers and not stop after the first one?


In reply to N Hansen

Re: Software for mathematical calculations?

by John Isner -
This versions finds all the solutions.
In reply to John Isner

Re: Software for mathematical calculations?

by N Hansen -
John-Thanks, that works and was quite enlightening. I never realized some of these could produce so many results though! But in a couple cases there are 1.9 million or so of some commodity so I guess that is to be expected.

Now, I just have to come up with a theory as to which answer to choose as the possible one. I have a feeling those that can be divided by 20 or 27 or that are multiples of 10 are most likely. That seems to be the case for those that are clear cut and those that have only a few possibilities only seem to frequently have multiples of ten as one of the choices so it is likely in most cases they were bringing in the commodities in groups of 10, 100, 1000 etc.
In reply to N Hansen

Re: Software for mathematical calculations?

by John Isner -
Do you only want to see the (x,y) pairs in which

(a) x and y have a common factor (such as 10, 20, or 27)
or
(b) x has a factor of 10, 20, or 27 and y has a factor of 10, 20, or 27 (but not necessarily the same factor as that of x)

Your first example, 11x + 31y = 1410 gave us four pairs: (100,10), (69,21), (38,32), and (7,43). Under either (a) or (b) we get a single answer, (100,10).

In your second example, 11x + 31y = 1277, we got four pairs: (102,5), (71,16), (40,27), and (9,38). Under (a) we get no answer, while under (b) we get one answer: (40,27).

I can tweak the algorithm however you like. To make it easier for you to test the changes, I have uploaded the php file to my Web site:

In reply to John Isner

Re: Software for mathematical calculations?

by N Hansen -
John-I think it is safest I still see all the answers, because I am certain there are cases where these rules don't apply and I wouldn't want to miss them for some reason. But it would be nice if all the x values (assuming x is multiplied by 11) that could be divided by 20 were highlighted, and all the y values (assuming y is multiplied by 31) that could be divided by 27 were highlighted, and both sides that could be highlighted by 10 were highlighted. However, those that can be divided by 10 and 20 jump out pretty quickly to the eye.The problem is those divided by 27, I can't just scan it and find them easily and recognize those. If those in particular could be highlighted it would help a lot. I found a site that allows me to generate tables of multiples of 27 but still when I start to get into large numbers that is cumbersome to look up and compare.
In reply to N Hansen

Re: Software for mathematical calculations?

by John Isner -
I had assumed that the coefficients a and b of the equation ax + by = c could be any numbers. Are they always either 11 or 31? Or can they be arbitrary values? The script assumes a and b are arbitrary. For the script to highlight certain solutions, it would need a general rule for highlighting. What you have given me is a very specific rule:

If one of the a coefficients is 11, highlight the value of the corresponding variable if it is divisible by 20

If one of the coefficients is 31, highlight the value of the corresponding variable if it is divisible by 27.

Here are two examples using your rule:

Example 1:

11x + 31y = 1277
x = 102 y = 5
x = 71 y = 16
x = 40 y = 27
x = 9 y = 38

Example 2:

11x + 31y = 1410
x = 100 y = 10
x = 69 y = 21
x = 38 y = 32
x = 7 y = 43


Let me know if 11 and 31 are the only possible values and I'll implement these rules. Otherwise, let me know the general rule.


In reply to John Isner

Re: Software for mathematical calculations?

by N Hansen -
Yes, they are always 11 and 31. One festival took place 11 years in a row for 20 days each time and the other festival took place for 31 years, 27 days each time. I'm trying to separate out the commodities used in each festival that have been lumped together in the totals.
In reply to N Hansen

Re: Software for mathematical calculations?

by John Isner -
That actually makes the program much simpler. The equation is now 11x + 31y = $c where $c is the single variable input by the user. Highlighting is done according to the rules you specified.
In reply to N Hansen

Re: Software for mathematical calculations?

by David Wright -
It is possible to get a calculator skin that does all of the calculator functions.  At our school, we use this picture of the calculator along with a smart board and go through the process of solving all sorts of equations.  Here is the link to where you can get a variety of calculators:  http://www.ticalc.org/pub/win/vtiskins/  You can then manipulate the calculator to solve any number of functions.
In reply to N Hansen

Re: Software for mathematical calculations?

by Cristina Berisso -

I use a nice piece of software that is free for instructors. It emulates a graphing calculator and has a great "evaluate" tool which allows me to go very fast over the integers for x-values, and display the y values. For example the answer to your integer answer to your second equation (11x+31y=1277) is x=40, y=27.

This is an on-line graphing tool and calculator which does also matrix algebra and regressions. The graphing part has parametrics and polars, and the most wonderful thing is that it doesn't do the Algebra for the students! So I use it in all my online and Hybrid Math classes and do not accept TI hand held calculators any more.

If you send me the equations you need I can do them in no time. You may also want to ask the author of the code directly if he could send you the tool (it is free for the instructors, and if you want to use it for your online Math classes so the students can use it for the length of the course, there is a nominal fee - something like $20 for the semester and that includes all of the student users of absolutely all of your Math classes). The program is being renamed and updated now (new name is "MathStuCalc"). It is absolutely great for the students to save the graphs and plots that they create as JPG's with a click. Then they attach the image to any e-mail or submission to me...

The author is Greg Mushial (a PhD in Math and software developer) and his e-mail is gmushial@gmdr.com.

Have fun!

Cristina

In reply to Cristina Berisso

Re: Software for mathematical calculations?

by N Hansen -
Christina-That result is more likely to be the one I am looking for than the one John's function spit out, because x in this context is more likely to be a multiple of 20 and y a multiple of 27, although that doesn't always seem to be the case, especially when dealing with raw materials. Does this calculator you used give more than one possible answer?

What I am dealing with is totals of commodities used in two ancient Egyptian festivals. They aren't separately listed but the fact that one festival was celebrated for 11 years and lasted 20 days each time, and the other was celebrated 31 years and lasted 27 days makes it possible to do these algebraic equations on the totals and come up with possible divisions-in some cases it is quite clear that the commodities were used in only one of the festivals because they are divisible by 11 or 31 (or in some cases 27 so they seem to have been used only in certain years but every day) but there are some cases like this example where the totals obviously refer to both festivals and in this case, a large tray of bread-2 were used each day in one festival and 1 each day in the other festival. By performing these calculations I hope to be able to produce two separate lists of what was used in each particular festival.
In reply to N Hansen

Re: Software for mathematical calculations?

by Cristina Berisso -

Sure, you can quickly search over all the positive answers in one unit steps.

For example for the equation 11x+31y=1277

I get : (9,38), (40,27), (71,16) and (102,5)

For the equation 11x+31y=1410

I get: (7,43), (38,32), (69,21), (100,10)