simplify



I think it worked perfectly in your case.

Yes, ideally transformations should be applied to combinations of  
parts of a sum or a product, however this would be very slow (I  
imagine) with user level functions. Probably a lot of these functions  
do that themselves already.

I don't know enough about Maxima internals to write a more low level  
simplify, but even applying user level functions to subexpressions  
gives good results most of the time.

Simplify should be smarter about which functions to use - for  
instance I know very little about how expensive various functions are  
(I would have to inspect the source code of each), so I'm not the  
right guy for writing a very well done Maxima's simplify... I was  
hoping that some experienced developer would pick up my idea and  
develop it into something more sophisticated to include it into  
Maxima. Even my primitive version could be included in Maxima perhaps  
- its not that bad compared to some other algorithms that are part of  
Maxima (and remain unimproved). I think it would certainly be useful  
for many users, especially beginners. But statistically it has a slim  
chance being included in Maxima, considering my previous (failed)  
efforts.. :)

Regards,
Ziga


On Sep 13, 2009, at 3:03 PM, Constantine Frangos wrote:

>
>
> Hi Ziga,
>
> I have applied your simplify() function to one example (see below)  
> and the
> expected simplification is obtained (number of characters in each  
> expression
> (string) is also indicated).
>
> The command:  matrixmap(simplify, sym_matrix), works.
>
> As a suggestion, try also to develop a number of alternative  
> versions of
> simplify(), using an increasingly extensive approach - you spoke  
> about "brute
> force", combinations of terms, etc. Did you mean applying simplify 
> () to all
> possible combinations of n terms in an expression, n=2,3,4,...., in
> sequence ?
>
> Regards,
>
> C. Frangos.
>
>
>
> z = dphi*Iwr1*Lc^2
>         *(-8*ddelta3*cos(delta3)*sin(delta3)*L2^2
>          -4*ddelta3*cos(2*delta3)*Lc*L2)
>   /(-4*sin(delta3)^2*L2^2-2*sin(2*delta3)*Lc*L2-Lc^2)^2
>   -ddelta3*dphi*Iwr1*Lc^2
>           *(-8*cos(delta3)*sin(delta3)*L2^2-4*cos(2*delta3)*Lc*L2)
>    /(-4*sin(delta3)^2*L2^2-2*sin(2*delta3)*Lc*L2-Lc^2)^2
>   -2*ddelta3*Iwr1*Lc^4
>     *(-8*ddelta3*cos(delta3)*sin(delta3)*L2^2-4*ddelta3*cos 
> (2*delta3)*Lc*L2)
>    /(-4*sin(delta3)^2*L2^2-2*sin(2*delta3)*Lc*L2-Lc^2)^3
>   +ddelta3^2*Iwr1*Lc^4*(-8*cos(delta3)*sin(delta3)*L2^2-4*cos 
> (2*delta3)*Lc*L2)
>    /(-4*sin(delta3)^2*L2^2-2*sin(2*delta3)*Lc*L2-Lc^2)^3
>
> nz = 545
>
> zsimp = -4*ddelta3^2*Iwr1*Lc^4*L2*(sin(2*delta3)*L2+cos(2*delta3)*Lc)
>       /(4*sin(delta3)^2*L2^2+2*sin(2*delta3)*Lc*L2+Lc^2)^3
>
> nzsimp = 113
>
> pause
>
>
> On Saturday 12 September 2009 01:09:39 pm ?iga Lenar?i? wrote:
>> Hi!
>>
>> On unix-like systems you put the file into ~/.maxima/ folder and then
>> 'load(simplify);' finds it. On Windows, I don't know where exactly
>> could you put the file. Perhaps if you put it inside /maxima/share
>> or /maxima/share/contrib, 'load' will find it. You can always try
>> specifying the path with 'load("/path/to/file/simplify.lisp");'...
>>
>> If you look at the variable
>> file_search_lisp;
>> it will show you, in which folders maxima looks for lisp files, when
>> you type load(simplify); or load("simplify.lisp"); (play around a  
>> bit).
>>
>> Note that simplify is just a dumb function, which tries
>> transformations that are already in Maxima on expression and it's
>> subexpressions, returning the 'shortest' result... if you have a
>> specific problem, that none of existing maxima commands can't
>> simplify, 'simplify' probably won't be successful... it might also be
>> slow as it is written now.
>>
>> If you have some longer expressions that I could test simplify on,
>> please post them.
>>
>> Attached is the simplify.lisp file.
>>
>> Regards,
>> Ziga
>
>