Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Looking for Equation Solver

Reply
Thread Tools

Looking for Equation Solver

 
 
Chris
Guest
Posts: n/a
 
      09-03-2005
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
 
Reply With Quote
 
 
 
 
Ignoramus14363
Guest
Posts: n/a
 
      09-03-2005
I wrote one

http://www.algebra.com/services/rend...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

On Sat, 03 Sep 2005 19:49:43 +0200, Chris <no@spam> wrote:
> 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



--

 
Reply With Quote
 
 
 
 
xhoster@gmail.com
Guest
Posts: n/a
 
      09-03-2005
Ignoramus14363 <ignoramus14363@NOSPAM.14363.invalid> wrote:
> I wrote one
>
> http://www.algebra.com/services/rend...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.

Xho

--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
 
Reply With Quote
 
Ignoramus14363
Guest
Posts: n/a
 
      09-03-2005

On 03 Sep 2005 22:51:13 GMT, http://www.velocityreviews.com/forums/(E-Mail Removed) <(E-Mail Removed)> wrote:
> Ignoramus14363 <ignoramus14363@NOSPAM.14363.invalid> wrote:
>> I wrote one
>>
>> http://www.algebra.com/services/rend...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

 
Reply With Quote
 
Keith Keller
Guest
Posts: n/a
 
      09-04-2005
On 2005-09-03, Ignoramus14363 <ignoramus14363@NOSPAM.14363.invalid> wrote:
>
> On 03 Sep 2005 22:51:13 GMT, (E-Mail Removed) <(E-Mail Removed)> wrote:
>>
>> 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?


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

--
http://www.velocityreviews.com/forums/(E-Mail Removed)-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom
see X- headers for PGP signature information

 
Reply With Quote
 
Ignoramus14363
Guest
Posts: n/a
 
      09-04-2005
On Sat, 3 Sep 2005 22:47:50 -0700, Keith Keller <(E-Mail Removed)-francisco.ca.us> wrote:
> On 2005-09-03, Ignoramus14363 <ignoramus14363@NOSPAM.14363.invalid> wrote:
>>
>> On 03 Sep 2005 22:51:13 GMT, (E-Mail Removed) <(E-Mail Removed)> wrote:
>>>
>>> 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?

>
> 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

 
Reply With Quote
 
BZ
Guest
Posts: n/a
 
      09-04-2005
Ignoramus14363 wrote in comp.lang.perl.misc:
> > "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?


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

--
BZ
 
Reply With Quote
 
Paul Lalli
Guest
Posts: n/a
 
      09-04-2005
Ignoramus14363 wrote:
> Keith Keller wrote:
> > Ignoramus14363 wrote:
> >> (E-Mail Removed) wrote:
> >>>
> >>> 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.
> >>


> 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

 
Reply With Quote
 
Dave
Guest
Posts: n/a
 
      09-04-2005

"BZ" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Ignoramus14363 wrote in comp.lang.perl.misc:
>> > "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?

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


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.



 
Reply With Quote
 
Dave
Guest
Posts: n/a
 
      09-04-2005

"Ignoramus14363" <ignoramus14363@NOSPAM.14363.invalid> wrote in message
news:bdwSe.98947$(E-Mail Removed).. .
> On Sat, 3 Sep 2005 22:47:50 -0700, Keith Keller
> <(E-Mail Removed)-francisco.ca.us> wrote:
>> On 2005-09-03, Ignoramus14363 <ignoramus14363@NOSPAM.14363.invalid>
>> wrote:
>>>
>>> On 03 Sep 2005 22:51:13 GMT, (E-Mail Removed) <(E-Mail Removed)>
>>> wrote:
>>>>
>>>> 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?

>>
>> 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
>


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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pell's equation solver in Ruby Takeshi NISHIMATSU Ruby 0 12-01-2009 08:34 AM
Linear Equation solver Guenther Sohler C Programming 1 09-19-2005 05:22 PM
How to run Excel Solver function from Python Aaron Python 1 09-19-2004 11:58 AM
peg triangle puzzle solver eggie2486 C++ 4 05-20-2004 11:00 PM
quartic polynomial solver Lothar Leidner Java 2 12-22-2003 11:02 PM



Advertisments