Burcin Erocal wrote: > On Friday 24 October 2008 15:17:57 Stan Schymanski wrote: >> That's interesting. It seems that the bug lies in the use of floating >> point numbers? By the way, simplify_trig and simplify_rational create >> the same mistake. I agree that the use of simplify_radical() is not >> very useful here, but if it makes such an obvious mistake, how >> confident can we be that it doesn't make mistakes in more complicated >> cases where we don't actually notice the mistake straight away? I >> thought about using something like simplify_full() on any equation to >> see if it can be simplified before I carry on with calculations. >> Perhaps this is the wrong strategy, anyway. Any comments? >> How could I actually get Sage to cancel out the 'a' in the equation? >> None of the methods I tried do the job. I don't like doing things by >> hand, because then I have to redo everything if I change an equation >> somewhere at the top of the notebook. > > In this case, expand seems to do what you want. I don't know if it will help > you with more complex expressions. > > sage: var("a,b,c") > (a, b, c) > sage: e = ((a*b - (1/2)*a*(b - c))/a); e > (a*b - a*(b - c)/2)/a > sage: e.expand() > c/2 + b/2 > > or with float coefficients: > > sage: e = ((a*b - (.5)*a*(b - c))/a); e > (a*b - 0.500000000000000*a*(b - c))/a > sage: e.expand() > 0.500000000000000*c + 0.500000000000000*b >
In general, I find that expand will end up simplifying things a lot more than the simplify functions will. I suppose it's like our secondary school math: when in doubt, multiply everything out and then see what cancels. Jason --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---