Re: I don't understand in Mathematic
- To: mathgroup@smc.vnet.net
- Subject: [mg10632] Re: [mg10551] I don't understand in Mathematic
- From: Andrzej Kozlowski <andrzej@tuins.ac.jp>
- Date: Tue, 27 Jan 1998 03:09:56 -0500
At 4:53 PM -0500 1/20/98, alok. menghrajani wrote:
>Hi,
>
>I'm 16 and I can't understand how I (why me?) found this bug in
>mathematica. It's such a silly thing:
>
>Solve [x/x+x=1, x] returns x=0 but if x=0 then x/x has no sence!
>
>Bye, ALok
>
>(Pls reply to my email: robot@writeme.com)
Just for fun I have written a simple replacement for Solve which
correctly solves x/x+x==1 and similar stupid equations. Any comments?
solve[eqn_,var_]:=
Module[{e=Hold[eqn],v=var,u=Solve[eqn,var]},
If[Union[Flatten[ReleaseHold[e/.u]]]=={True},u,Null,"Stupid
equation!"]] SetAttributes[solve,HoldAll]
solve[x+1==0,x]
{{x->-1}}
solve[x/x+x==1,x]
....Error messages...
Stupid equation!