<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=text/html;charset=iso-8859-1 http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19258"></HEAD>
<BODY style="PADDING-LEFT: 10px; PADDING-RIGHT: 10px; PADDING-TOP: 15px" 
id=MailContainerBody leftMargin=0 topMargin=0 CanvasTabStop="true" 
name="Compose message area">
<DIV><FONT size=2 face=Arial>Hi,</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>One can do symbolic calculations with Scilab using 
expression handlers of character strings.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>To do it easier one could use classes (symbolic 
class etc.).</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 
face=Arial>**********************************************************************************************************************************************************************</FONT></DIV>
<DIV><FONT size=2 face=Arial>Here is one idea about how to generate Integral 
Tables having differentiation of expressions available: (compare Issue 3311 
SymPy development)</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><PRE>To create an Integral <-> Integrand Table for all achievable Integral expressions one needs to create </PRE><PRE>all expression-trees including all functions and functionlike expression quantities (==fnq), like:

</PRE><PRE>Constants,Variables, +,-,*,/,^,f1(arg1),f2(arg1,arg2),...,fn(arg1,...,argn),
Diff1(f,x),Diff2(f,x,y),...,Diffn(f,x0,x1,...,xn),
Integrate1(f,x1,x1a,x1b),Integrate2(f,x,y,xa,xb,ya,yb),...,
Integraten(f,x0,x1,...,xn,x1a,x1b,x2a,x2b,...,xna,xnb),

</PRE><PRE>where every argument is also an expressiontree.

Every fnq can be numbered, so every expression is equivalent to a numbertree.

Now: To construct all expressions up to N fnq:s in it one can start from simplest (one fnq, no arguments), list all fnq:s like that and then proceed to two, three etc. up to N fnqs.</PRE><PRE>The result will always become a number tree.


I think Scilab should include a procedure call that would return all these fnq-expressions (as number trees or as expressions) in a Table:


Allcombinations_fnq(N)

Then differentiating this Table (at easies using number trees) of all expressions would give an Integral Table as such.</PRE><PRE>Then all linear combinations would also be Integral Tables. 

Applying all available transformation rules would then give alternative versions of same integrals.

</PRE><PRE>To solve an integral it is then enough to create the number tree of an Integrand and use the Integral Table, which is fast.
</PRE>
<DIV id=hc1 class="cursor_off vt issuecomment" cursorIndex="1"><SPAN 
class=author>Comment <A 
href="http://code.google.com/p/sympy/issues/detail?id=3311#c1" name=c1><FONT 
color=#0000cc>1</FONT></A> by project member <A style="WHITE-SPACE: nowrap" 
href="http://code.google.com/u/asmeurer@gmail.com/"><FONT 
color=#0000cc>asmeurer@gmail.com</FONT></A></SPAN>, <SPAN class=date 
title="Wed Jun 27 10:29:51 2012">Jun 27, 2012</SPAN> <PRE>Do you know of any other computer algebra systems that do something like this so we can see how they have it implemented?
</PRE></DIV>
<DIV id=hc2 class="cursor_off vt issuecomment" cursorIndex="2"><FONT size=2 
face=Arial></FONT> </DIV>
<DIV class="cursor_off vt issuecomment" cursorIndex="2"><SPAN 
class=author>Comment <A 
href="http://code.google.com/p/sympy/issues/detail?id=3311#c2" name=c2><FONT 
color=#0000cc>2</FONT></A> by <A style="WHITE-SPACE: nowrap" 
href="http://code.google.com/u/107630612048340541426/"><FONT 
color=#0000cc>jari-pek...@kolumbus.fi</FONT></A></SPAN>, <SPAN class=date 
title="Wed Jul  4 12:04:16 2012">Today (13 hours ago)</SPAN> <PRE>Matlab with Symbolic Math Toolbox can use and execute text M-files, that can also be variables and created runtime by Matlab code.

To create an expression tree including a subset of all functionlike expression items (==fnq) one needs following variables:

isfnqincluded = [0,0,0,1,0,1,1,1,1,0,0]; % where 0 is not included and 1 is included

Then isfnqincluded(nfnq) tells if fnq number nfnq is included in the expression item handling or not. Items can be like:

Itemname     Itemnumber   Item value        Itemtype          arguments   arg.types     

Constant         1    (value of the constant)   (Const types)           0       []
Variable          2       "variable name"          (Variable types)        1       [(argtype)]
fn1                 3       "function name"          (fn1 type)                 n       [t1,t2,t3,...,tn]
...
sin                10       "sin"                         (sin types)                1   [(int,rat,real or complex)]
atan2            11       "atan2"                     (atan2 types)             2   [2x(int,rat,real or complex)]
...
Diff               50       "differentiation"           (Diff types)                4       [ta,tb,expr,diffvar]
Integrate       51       "integration"               (Integrate types)        4       [ta,tb,expr,intgvar]
...

etc. for all fnq:s

Allexpressionscanners scan through all combinations of expression items to create on valid expression at a time. Easiest way is probably from bottom to top.
First looping (Loop 1....Loop P+1) gives every expression item an unique number (loop counter value common to all following loops is Ifnq):

Loop 1:

Pick 0 argument expression items:

Ifnq=1
Itemnumbers:  1, type 1st
Ifnq+=1   % This is C, replace same for MATLAB Ifnq=Ifnq+1
Itemnumbers:  1, type 2nd
Ifnq+=1
Itemnumbers:  1, type 3rd
Ifnq+=1
Itemnumbers:  1, type 4th
Ifnq+=1
Itemnumbers:  1, type 5th
Ifnq+=1

...(rest with 0 arguments)

% Above loop results as an input of fnq:s with 0 arguments, certain types.
% At any expression later on these can be replaced to an argument place
% needed to be of that certain type.

Loop 2

Pick 1 argument expression items:

Ifnq+=1
Itemnumbers:  2, type 1st
Ifnq+=1
Itemnumbers:  2, type 2nd
Ifnq+=1
Itemnumbers:  2, type 3rd
Ifnq+=1
Itemnumbers:  2, type 4th
Ifnq+=1
Itemnumbers:  2, type 5th
Ifnq+=1
...
Ifnq+=1
Itemnumbers:  10, type 1st
Ifnq+=1
Itemnumbers:  10, type 2nd
Ifnq+=1
Itemnumbers:  10, type 3rd
Ifnq+=1
Itemnumbers:  10, type 4th
Ifnq+=1
Itemnumbers:  10, type 5th
Ifnq+=1
...(rest with 1 arguments)

% Above loop results as an input of fnq:s with 1 arguments, certain types.
% At any expression later on these can be replaced to an argument place
% needed to be of that certain type.

Loop 3

Pick 2 argument expression items:

Ifnq+=1
Itemnumbers:  11, type 1st
Ifnq+=1
Itemnumbers:  11, type 2nd
Ifnq+=1
Itemnumbers:  11, type 3rd
Ifnq+=1
Itemnumbers:  11, type 4th
Ifnq+=1
Itemnumbers:  11, type 5th
Ifnq+=1
...(rest with 2 arguments)

% Above loop results as an input of fnq:s with 2 arguments, certain types.
% At any expression later on these can be replaced to an argument place
% needed to be of that certain type.

Loop 4

Pick 3 argument expression items:

Ifnq+=1
Itemnumbers:...(rest with 3 arguments, certain types)

% Above loop results as an input of fnq:s with 3 arguments, certain types.
% At any expression later on these can be replaced to an argument place
% needed to be of that certain type.
...

Loop K

Pick K-1 argument expression items:

Ifnq+=1
Itemnumbers:...(rest with K-1 arguments, certain types)

% Above loop results as an input of fnq:s with K-1 arguments, certain types.
% At any expression later on these can be replaced to an argument place
% needed to be of that certain type.

If there are no expression items having more than P items, then P+1:th Loop is the last in this list.</PRE><PRE>The idea is to have a counter that gives every loop result an unique number to identify it later on.


Next looping level starts to create "all expressions" list.
This may be easier from Top to bottom:

Starting at Expression outermost fnq, say start level is Ilevel=Ifnqtop.

% Ilevel handling is this:

Pick each Ifnq-list item having level Ilevel
   For each of these items replace all arguments by Ilevel-1 loop handling results. 
   When Ilevel reaches 0 replace rest argument places with 0 argument expression Items

% This way all Ifnq:s will be used and all arguments will have all Ifnq:s down to
% Ilevel 0 where rest of the argument places are replaced by constants.
% This algorithm also includes all types of arguments in all argument places.
% Final scan could drop away all those alternatives that are not valid, or previous
% algorithm could simply include type checking and drop away alternatives that are
% not valid.


% In MATLAB it is then easy to replace Ifnq:s numbers with actual expression,
% differentiate this (using Symbolic Math Toolbox) and again replace the
% expression items
% (function names etc) with Ifnq values with all types or certain types.

% Linear combinations and transformation rules can also be applied using the
% Symbolic Math Toolbox which gives alternate forms to same differentiations.
% Reading differentiation results other way round will give an Integral Table
% of all available expressions. Of course one then needs an
% Expression to Ifnq-expression converter which is just a replace loop.

% If one handles MATLAB/Programming Language code also as fnq:s one can
% this way create
% "all available algorithms"-trees, which may be of more use in quantum computers.
% Also some codetree optimization issues as well as
% "finding all algorithms suitable to a task" up to a certain complexity
% can be handled.

% One could also utilise this to handle "Mathematics world to Digital World 
% relations" possibilities.

</PRE></DIV>
<DIV id=hc4 class="cursor_off vt issuecomment" cursorIndex="4"><SPAN 
class=author>Comment <A 
href="http://code.google.com/p/sympy/issues/detail?id=3311#c4" name=c4><FONT 
color=#0000cc>4</FONT></A> by <A style="WHITE-SPACE: nowrap" 
href="http://code.google.com/u/107630612048340541426/"><FONT 
title="http://code.google.com/u/107630612048340541426/ Avaa linkki painamalla Ctrl-näppäintä ja napsauttamalla linkkiä" 
color=#0000cc>jari-pek...@kolumbus.fi</FONT></A></SPAN>, <SPAN class=date 
title="Thu Jul  5 01:34:49 2012">Today (moments ago)</SPAN> <PRE>To prove an Integral solution stepwise from this table one needs following:

Inversed(transformation rules) & Inversed(linear combination) & Inversed(differentiation including inversed chain rules)
</PRE></DIV><BR></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>This should be relatively easy to implement using 
Scilab data types. Of course to include all expression items there needs to 
be</FONT></DIV>
<DIV><FONT size=2 face=Arial>  a Table of Expression Items (fnq:s) 
available</FONT></DIV>
<DIV><FONT size=2 face=Arial>and to differentiate them there needs to 
be</FONT></DIV>
<DIV><FONT size=2 face=Arial>  a Differentiation Table 
available</FONT></DIV>
<DIV><FONT size=2 face=Arial>and to transform expressions there needs to 
be</FONT></DIV>
<DIV><FONT size=2 face=Arial>  an Expression Transformation Table 
available.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Sometimes in the Future Symbolic calculation will 
most probably be included in the Scilab Software.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV></BODY></HTML>