• user warning: Unknown column 'captcha_type' in 'field list' query: SELECT module, captcha_type FROM captcha_points WHERE form_id = 'search_theme_form' in /home/unitorga/public_html/coding/sites/all/modules/captcha/captcha.inc on line 60.
  • user warning: Unknown column 'captcha_type' in 'field list' query: SELECT module, captcha_type FROM captcha_points WHERE form_id = 'search_block_form' in /home/unitorga/public_html/coding/sites/all/modules/captcha/captcha.inc on line 60.

Javascript Algebra solver

So I created an algebra solver, I've done some more work on it recently that allows users to enter a much wider variety of equations into the boxes, and I've also discovered that it will quite happily solve the single variable case (with 1 equation), making it more useful than I originally intended. It will now also solve many quadratic equations as well, with some additional functionality I added today.

You can enter systems of equations such as:

2(a-2)+3a+3=13
2b+2+a=13

or

2(a-4)+(b+2c)+d=3(d-4)-3(a+2)+23
2a+(2b+4c)/2+3d/2=10/4
a+3b+c+d=20
a-b+c-d=10

etc... into the textarea, and it should solve all of these quite happily.

It will also solve quadratic equations such as:

x^2-6x+5=0

or the more complicated

2x^2-3(x-4)+3/4x-2x+(x-2)(2x+1)=3x^2-16

Please let me know if you spot any errors in the program.

Check it out here.

Comments

1/(x-3)=1 does not work

I couldn't get (2+3i)(1-4i) to work

Hey Luis: My algebra solver will not handle rational expressions unfortunately, but with some work I could have it handle simple expressions of the sort you tried. You'd have to multiply the denominator of the LHS over to the RHS. Macy: You need to set the expression equal to something to make it an equation. Try (2+3i)(1-4i) = 0. That seems to work.

This thing was a life saver! Thanks so much for this. Now I can get some sleep..

I can't make xy-5-x-y=0 work.

xy-5-x-y=0 has two reasons why it won't work. First it has 2 variables and 1 equation so it does not have a unique solution. Second, it involves a quadratic term with mixed variables which my solver cannot handle. Dave

I cannot do simple radicals such as √49x^10?

That's true. Parsing a radical is not too difficult to do but as this is my hobby, and I'm not being paid to do it, I haven't bothered adding the code. Basically, although my solver handles tonnes of cases, there are some that aren't worth the extra coding. For instance, it doesn't solve cubic equations either, even though there is a (relatively) straight forward procedure for doing so.

Tyler: I cannot get f(x)=2x^2+x-7 to work. Nor could i get r^2-5r-6/(r+1). I tried putting in =0 at the end but it came up with r1=0 and r2=0.

Hi Tyler: Yeah my solver won't handle rational expressions properly as its not that advanced. Also, your first expression isn't technically an equation, so it can't solve it either. Try: 0 = 2x^2 + x - 7 instead.

Links

Twitter Follow me on Twitter

Subscribe Subcribe to my blog