Equivalences. Re: Checking equivilence of equalities
Subject: Equivalences. Re: Checking equivilence of equalities
From: Stavros Macrakis
Date: Wed, 8 Feb 2012 12:20:15 -0500
Careful! The given solution has some problematic cases:
listofvars(a+b=1) => [a, b]
listofvars(b=1-a) => [b, a]
So first(listofvars(...)) is not going to work.
You could look at solutions in *all* variables, and sort the
variables: sort(listofvars(...))); or the solutions: sort(solve(...)).
More robustly, you might want to perform the symmdifference of the
solution sets.
If there is a family of solutions, they are parameterized:
solve(a+b=1,[a,b]) => [[a = 1 - %r3, b = %r3]]
solve(a+b=1,[a,b]) => [[a = 1 - %r4, b = %r4]] <<< new free variable names
You may need to play with %rnum_list to handle this.
Another big problem is that solve doesn't solve a lot of cases, e.g.
solve(sin(x)^2+cos(x)^2=0,x) should give the empty set, but in fact just
returns the equations.
Are you interested in real solutions only? Solve generally gives all
solutions, including complex.
Solve uses arc-trig functions.
etc.
On Wed, Feb 8, 2012 at 12:02, Jaime Villate <villate at fe.up.pt> wrote:
> On 02/08/2012 04:37 PM, Gerd Kortemeyer wrote:
>
>> Hi,
>>
>> On Feb 8, 2012, at 11:31 AM, Jaime Villate wrote:
>>
>> In some sense in this second case you are also solving the equations and
>>> comparing them:
>>>
>>> (%i1) solve(f+4=g+6, f);
>>> (%o1) [f = g + 2]
>>> (%i2) solve(f-2=g, f);
>>> (%o2) [f = g + 2]
>>>
>>> And again, this second example worked because we were able to find the
>>> solution.
>>>
>> I agree. That's what I ended up doing for the LON-CAPA integration:
>>
>> http://www.math.utexas.edu/**pipermail/maxima/2012/027556.**html<http://www.math.utexas.edu/pipermail/maxima/2012/027556.html>
>>
>> Works well,
>>
>> In e-learning systems, you can check that the equations you are
> expecting as an answer to
> your questions can be solved with solve() and then you can confidently use
> an implementation
> like the following (unless you have genius students who can come up with
> equivalent algebraic
> equations that solve cannot handle).
>
> (%i2) equivp(e,f):= is(equal(solve(e,first(**
> listofvars(e))),solve(f,first(**listofvars(f)))))$
>
> (%i3) e1: x^2-3*x+2=0$
> (%i4) e2: 6*x-2*x^2-4=0$
> (%i5) equivp(e1,e2);
> (%o5) true
>
> (%i6) e3: x+y=1$
> (%i7) e4: x=1-y$
> (%i8) equivp(e3,e4);
> (%o8) true
>
> (%i9) e5: x^2=1+y^2-2*y$
> (%i10) e6: 4*y+2*x^2=2*y^2+2$
> (%i11) equivp(e5,e6);
> (%o11) true
>
> But keep in mind that x=2 is not equivalent to x^2=4.
>
> Regards,
> Jaime
>
> ______________________________**_________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/**mailman/listinfo/maxima<http://www.math.utexas.edu/mailman/listinfo/maxima>
>