Looking for Equation Solver

C

Chris

Hi,

does anybody know a Perl program or script that is able to solve
mathematical equations. So, if I input a string, say, $e = "2x+1=5";
the output would be "x=2".

If anybody knows about a program that can do something like this, please
let me know.

Thank you,
Chris
 
I

Ignoramus14363

I wrote one

http://www.algebra.com/services/rendering/simplifier.mpl

Besides simplifying, it shows work and plots math formulas. It is not
available publicly though. There is a Math::Symbolic module, but I
found it extremely lacking.

i

Hi,

does anybody know a Perl program or script that is able to solve
mathematical equations. So, if I input a string, say, $e = "2x+1=5";
the output would be "x=2".

If anybody knows about a program that can do something like this, please
let me know.

Thank you,
Chris


--
 
I

Ignoramus14363

Also, it doesn't give the right answer.

"Text form: ((x^2-6x+9)/(x^2-3x-10))/((x^2-5x+6)/(x^2-8x+15)) simplifies to
(x-3)/(x+2)"

No, it doesn't.

I will appreciate corrections and suggestions. What's the right answer
there?

i
 
K

Keith Keller

I will appreciate corrections and suggestions. What's the right answer
there?

If you can't figure it out on paper, why are you writing a program to do
it? Sheesh, I might as well go write an OS! :-\

--keith
 
I

Ignoramus14363

If you can't figure it out on paper, why are you writing a program to do
it? Sheesh, I might as well go write an OS! :-\

Let me know when you have something useful and substantial to say,
okay?

(hint, I did solve it on paper)

If you can explain why the above simplification is incorrect, I would
appreciate hearing that.

i
 
P

Paul Lalli

If you can explain why the above simplification is incorrect, I would
appreciate hearing that.

Uhm. Because it's not mathematically valid? Try any value of X. The
original does not produce the same result as the simplification. (Hint
- the easiest value to plug in would be 0, which gives -3/2 for the
simplification, but
(-9/10) / (6/15) = (-9/10) * (15/6) = (-3/2) * (3/2) = -9/4 for the
original).

fwiw, when I do it on paper I get:
(x^2 - 6x - 9) / (x^2 -4)

(Granted, it has been about 5 years since I last took a math class...)

Paul Lalli
 
D

Dave

BZ said:
Ignoramus14363 wrote in comp.lang.perl.misc:

(x-3)^2/(x-4)^2

No, Paul is right. It can also be written:
((x-3)^2)/((x+2)(x-2))
or
(x-3)^2/(x^2-4)
the latter of which is perhaps what BZ meant to type.
 
D

Dave

Ignoramus14363 said:
Let me know when you have something useful and substantial to say,
okay?

(hint, I did solve it on paper)

If you can explain why the above simplification is incorrect, I would
appreciate hearing that.

i

The error in the explanation this example is at the line:
'Canceled out common factors (x-(3)),(x-(3))'

Where (1) is left in each case instead of (x-3) and (x-2) in numerator and
denominator respectively.

The explantion would be clearer if you showed the factorisation before the
cancellation, and this error would have been more obvious too.

Hope this helps

Dave
 
X

xhoster

Ignoramus14363 said:
I will appreciate corrections and suggestions. What's the right answer
there?

I didn't solve it fully; I just set x to zero which was enough to show the
simplification was wrong.

It appears that the correct answer is (x-3)^2/(x-2)/(x+2). It seem like
your program realizes that (x-3) is a common factor in two of the quadratic
groups, but then "cancels out" both of those groups in their entirety,
rather than just the factor of x-3.

Xho
 
I

Ignoramus25850

Thanks guys (all of you). You got it. I corrected the solver, it was a
programming mistake. Thank you!

i

The error in the explanation this example is at the line:
'Canceled out common factors (x-(3)),(x-(3))'

Where (1) is left in each case instead of (x-3) and (x-2) in numerator and
denominator respectively.

The explantion would be clearer if you showed the factorisation before the
cancellation, and this error would have been more obvious too.

Hope this helps

Dave


--
 
P

Peyton Bland

Hi,

I'm coming to the party a bit late, but you guys are scaring me, so I
had to reply (!)...

[QUOTE= said:
I will appreciate corrections and suggestions. What's the right answer
there?

I didn't solve it fully; I just set x to zero which was enough to show the
simplification was wrong.[/QUOTE]

I did this, too, and got -1 when x = 0. What did you get, Xho?
It appears that the correct answer is (x-3)^2/(x-2)/(x+2). It seem like
your program realizes that (x-3) is a common factor in two of the quadratic
groups, but then "cancels out" both of those groups in their entirety,
rather than just the factor of x-3.

Have another look... I get (x+2)/(x-2) . Hopefully, no one coerced
the software in question to yield any of these other answers given
earlier.

Cheers,
Peyton Bland
 
P

Paul Lalli

Peyton said:
I'm coming to the party a bit late, but you guys are scaring me, so I
had to reply (!)...

It may have been wise to figure out what you're talking about before
reviving a 3 month old thread.
[QUOTE= said:
Also, it doesn't give the right answer.

"Text form: ((x^2-6x+9)/(x^2-3x-10))/((x^2-5x+6)/(x^2-8x+15))
simplifies to (x-3)/(x+2)"

No, it doesn't.

I will appreciate corrections and suggestions. What's the right answer
there?

I didn't solve it fully; I just set x to zero which was enough to show the
simplification was wrong.

I did this, too, and got -1 when x = 0. What did you get, Xho?[/QUOTE]

My guess would be the correct answer that we all gave three months ago.
-9/4

((x^2-6x+9)/(x^2-3x-10))/((x^2-5x+6)/(x^2-8x+15))


(0^2-6*0+9)/(0^2-3*0-10)
------------------------
(0^2-5*0+6)/(0^2-8*0+15)

9 / -10
------
6 / 15

9 15
- -- * --
10 6

135 27 9
- --- = - -- = - -
60 12 4


(make sure you view the above in a fixed-width font)
Have another look... I get (x+2)/(x-2) .

Yes, well, you're wrong. See previous responses for how and why.
Hopefully, no one coerced
the software in question to yield any of these other answers given
earlier.

Yes, improving the buggy software would certainly be worse than using a
working one to begin with.

Paul Lalli
 
X

xhoster

Peyton Bland said:
Hi,

I'm coming to the party a bit late, but you guys are scaring me, so I
had to reply (!)...

That being the case, you might want to spend some more time explaining
what it is you are trying to say. It is hard to just pick up a thread
after 3 months.
[QUOTE= said:
On 03 Sep 2005 22:51:13 GMT, (e-mail address removed) <[email protected]>
wrote:
I wrote one

http://www.algebra.com/services/rendering/simplifier.mpl

Besides simplifying, it shows work and plots math formulas. It is
not available publicly though.

Also, it doesn't give the right answer.

"Text form: ((x^2-6x+9)/(x^2-3x-10))/((x^2-5x+6)/(x^2-8x+15))
simplifies to (x-3)/(x+2)"

No, it doesn't.

I will appreciate corrections and suggestions. What's the right
answer there?

I didn't solve it fully; I just set x to zero which was enough to show
the simplification was wrong.

I did this, too, and got -1 when x = 0. What did you get, Xho?[/QUOTE]

Well, for the original full form, I got -9/4. For the original incorrect
simplification I got -3/2. For the correct simplification I got
(obviously) -9/4. For your new incorrect simplification I got -1.

Have another look...

Are you trying to tell me to double check my work, or are you telling me
that the bug has been fixed and I should go look at the original web page
again?

I get (x+2)/(x-2) .

Which is obiously wrong, as (setting x=0) -9/4 != -1.
Hopefully, no one coerced
the software in question to yield any of these other answers given
earlier.

I have no idea what that means.

Xho
 
P

Peyton Bland

Paul said:
It may have been wise to figure out what you're talking about before
reviving a 3 month old thread.

My sincere apologies to the group. I carelessly mis-read the
expression (the ratio of polynomials).
My guess would be the correct answer that we all gave three months ago.
-9/4

((x^2-6x+9)/(x^2-3x-10))/((x^2-5x+6)/(x^2-8x+15))


(0^2-6*0+9)/(0^2-3*0-10)
------------------------
(0^2-5*0+6)/(0^2-8*0+15)

9 / -10
------
6 / 15

9 15
- -- * --
10 6

135 27 9
- --- = - -- = - -
60 12 4


(make sure you view the above in a fixed-width font)


Yes, well, you're wrong. See previous responses for how and why.


Yes, improving the buggy software would certainly be worse than using a
working one to begin with.

Paul Lalli

Peyton Bland
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top