MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

FullSimplify successive transforms revisited

  • To: mathgroup at smc.vnet.net
  • Subject: [mg117650] FullSimplify successive transforms revisited
  • From: Arturas Acus <Arturas.Acus at tfai.vu.lt>
  • Date: Tue, 29 Mar 2011 06:53:40 -0500 (EST)

---------- Forwarded message ----------
Date: Fri, 25 Mar 2011 08:58:17 +0200
From: vu25990 at voruta.vu.lt
To: mathgroup at smc.vnet.net
Subject: [mg117650] FullSimplify successive transforms revisited

Dear Group

Inspired by M. Trott "Guide for symbolic" p999 I thought the transformations of 
FullSimplify can be extracted by trivial modification of the clever original 
code, which is (adopted to the specific needs)

CSC := (count1 = 0; count2 = 0; count3 = 0;
  lf = (10000 Count[#, _BesselI | _Hypergeometric0F1Regularized | \
_Hypergeometric0F1, {0, Infinity}] + LeafCount[#]) &[
    all\[Psi]MathematicaSimplified];
  Assuming[a > 0 && \[Kappa]2 > 0 && k1 > 0 && n > 0,
   FullSimplify[all\[Psi]MathematicaSimplified,
    ComplexityFunction -> ((count1++;
          Which[# === lf, count2++, # < lf, lf = #; count2++;
           count3++]; #) &[(10000 Count[#, _BesselI | \
_Hypergeometric0F1Regularized | _Hypergeometric0F1, {0, Infinity}] +
          LeafCount[#])] &)]])


{count1,count2,count3}


The modification is trivial:

CSC5 := (count1 = 0; count2 = 0; count3 = 0;
  lf = (10000 Count[#, _BesselI | _Hypergeometric0F1Regularized | \
_Hypergeometric0F1, {0, Infinity}] + LeafCount[#]) &[
    all\[Psi]MathematicaSimplified[[1]]];
  Print[lf];
  FullSimplify[all\[Psi]MathematicaSimplified[[1]],
   Assumptions -> a > 0 && \[Kappa]2 > 0 && k1 > 0 && n > 0,
   ComplexityFunction -> ((count1++;
         Which[#[[1]] === lf, count2++, #[[1]] < lf, lf = #[[1]];
          count2++; count3++; Print[#[[2]]]; Print[#[[1]]]]; #[[
          1]]) &[{(10000 Count[#, _BesselI | \
_Hypergeometric0F1Regularized | _Hypergeometric0F1, {0, Infinity}] +
          LeafCount[#]), #}] &)])


Unfortunatelly inspecting the Print output one easily see, that the
code do not do what is expected. The problem is that ComplexityFunction
do not calculate complexity of overal expression. Thus top level information 
about transformed expression is not available for user at each step.

I think Michael code here do not count simplification rules properly also.


Thus I make conclusion that the task is one of rare occasions which
impossible or at least very hard to realize in recent Mathematica versions.

So, my wish for developers. Please include Monitor->
option for FullSimplify (a number of other commands has this option), which 
would
allow user to get sequence of successful intermediate expressions.

This information could help user to implement his own simplification rules for
some specific kind of expressions.


Sincerely, Arturas Acus




------------------the original message follows---------
Dear Group,

How to extract successful transformations of FullSimplify?


In particulary I am interesting what rules were used to transform BesselI[ ] 
functions into BesselJ/BesselK in the example below. Of course, learning the 
general method to detect sequence of these transforms would be of great value.


all\[Psi]MathematicaSimplified={(2 k1 Sqrt[2/\[Pi]] \[Kappa]2 BesselJ[n,k1 
\[Rho]] BesselK[n,a \[Kappa]2] Sin[n \[Pi]])/(\[Sqrt](2 a k1^2 \[Pi] \[Kappa]2 
BesselI[n,a \[Kappa]2] (n (BesselI[1-n,a \[Kappa]2]+BesselI[-1+n,a \[Kappa]2]) 
BesselJ[n,a k1]^2+a \[Kappa]2 BesselI[-n,a \[Kappa]2] BesselJ[-1+n,a k1] 
BesselJ[1+n,a k1])+\[Pi] BesselI[n,a \[Kappa]2]^2 (2 a k1 n \[Kappa]2^2 
BesselJ[-1+n,a k1] BesselJ[n,a k1]-4 n^2 (k1^2+\[Kappa]2^2) BesselJ[n,a 
k1]^2+a^2 k1^2 \[Kappa]2^2 BesselJ[1+n,a k1]^2)+a k1^2 \[Kappa]2 (a \[Pi] 
\[Kappa]2 ((BesselI[1-n,a \[Kappa]2]^2-2 BesselI[1-n,a \[Kappa]2] 
BesselI[-1+n,a \[Kappa]2]+BesselI[1+n,a \[Kappa]2]^2) BesselJ[n,a 
k1]^2-BesselI[-n,a \[Kappa]2]^2 BesselJ[-1+n,a k1] BesselJ[1+n,a k1])+4 n 
BesselI[-n,a \[Kappa]2] BesselJ[n,a k1]^2 BesselK[-1+n,a \[Kappa]2] Sin[n 
\[Pi]]))),(2 k1 Sqrt[2/\[Pi]] \[Kappa]2 BesselJ[n,a k1] BesselK[n,\[Kappa]2 
\[Rho]] Sin[n \[Pi]])/(\[Sqrt](2 a k1^2 \[Pi] \[Kappa]2 BesselI[n,a \[Kappa]2] 
(n (BesselI[1-n,a \[Kappa]2]+BesselI[-1+n,a \[Kappa]2]) BesselJ[n,a k1]^2+a 
\[Kappa]2 BesselI[-n,a \[Kappa]2] BesselJ[-1+n,a k1] BesselJ[1+n,a k1])+\[Pi] 
BesselI[n,a \[Kappa]2]^2 (2 a k1 n \[Kappa]2^2 BesselJ[-1+n,a k1] BesselJ[n,a 
k1]-4 n^2 (k1^2+\[Kappa]2^2) BesselJ[n,a k1]^2+a^2 k1^2 \[Kappa]2^2 
BesselJ[1+n,a k1]^2)+a k1^2 \[Kappa]2 (a \[Pi] \[Kappa]2 ((BesselI[1-n,a 
\[Kappa]2]^2-2 BesselI[1-n,a \[Kappa]2] BesselI[-1+n,a \[Kappa]2]+BesselI[1+n,a 
\[Kappa]2]^2) BesselJ[n,a k1]^2-BesselI[-n,a \[Kappa]2]^2 BesselJ[-1+n,a k1] 
BesselJ[1+n,a k1])+4 n BesselI[-n,a \[Kappa]2] BesselJ[n,a k1]^2 BesselK[-1+n,a 
\[Kappa]2] Sin[n \[Pi]])))}



all\[Psi]MathematicaSimplifiedNoHyper=Assuming[a>0&&\[Kappa]2>0&&k1>0&&n>0,FullSimplify[all\[Psi]MathematicaSimplified,ComplexityFunction->(10000*Count[#,_BesselI|_Hypergeometric0F1Regularized|_Hypergeometric0F1,{0,Infinity}]+LeafCount[#]&)]]


  • Prev by Date: Re: Writing images from manipulate
  • Next by Date: Re: "set" data structure in Mathematica? (speeding up graph traversal function)
  • Previous by thread: Re: Off Topic: E-Mail Security in this Group
  • Next by thread: no need to compile a tuned libgmp under Linux