eqs_opt = eqs_new
if opt_all:
return eqs_opt
else:
return [ Eq( eq[0], eq[1] ) for eq in sub_opt ] + eqs_opt
On Apr 18, 6:42 pm, Chris Smith wrote:
> On Wed, Apr 18, 2012 at 2:28 PM, vweber wrote:
> > Dear All
>
> > When calling recursively cse, is it poss
What about ordering the levels to speedup the search? (we need to
catch the rabbit)
Do you have a reference of the algorithm you are using for cse?
V
On Apr 18, 2:46 pm, Chris Smith wrote:
> On Wed, Apr 18, 2012 at 6:17 PM, vweber wrote:
> > Dear Chris,
>
> > I wouldnt make t
e to add more checks like starting from
x**2 and checks the pair x**2 with x**4?
V
On Apr 18, 1:58 pm, Chris Smith wrote:
> On Wed, Apr 18, 2012 at 3:08 PM, vweber wrote:
> > here are some simpler cases that dont fly:
>
> >>>> cse(x**2+x**4+1)
> > ? ? 4
inted as x**2 and 1/x**2, but internally, they are represented as
> x**2 and x**-2. It probably wouldn't be hard to make it recognize one
> as the reciprocal of the other.
>
> Aaron Meurer
>
> On Wed, Apr 18, 2012 at 1:58 AM, vweber wrote:
> > Dear Sympy
>
> >
Dear All
When calling recursively cse, is it possible to tell cse what was the
previous last symbols+1, eg
first pass:
(x0,...) (x1,...)
second pass:
(x2,...) + the others
third pass:
(x3,...) (x4,...) (x5,...) + the others
...
Thanks
V
--
You received this message because you are subscr
Dear Sympy
cse seems not to be able to substitue eg x**2 and 1/x**2, see the
following example:
from sympy import *
dhdx,dfdx,g,dfdx,x,f,y,z,h,dfdy,dgdy,dgdz,dhdy,dhdz=symbols('dhdx,dfdx,g,dfdx,x,f,y,z,h,dfdy,dgdy,dgdz,dhdy,dhdz')
eqs=[Eq(f, x + cos(y)), Eq(g, y + exp(z)), Eq(h, f*g + cos(exp((f
to keep a concistant order, or to return a list of
indices that the eqs can be reordered in a simple way.
V
On Apr 12, 5:18 pm, Chris Smith wrote:
> On Thu, Apr 12, 2012 at 6:32 PM,vweber wrote:
> > Chris, now I dont get for what cse is useful for (if any ordering is
> >
Dear All
How is it possible to differentiate between defined(internal) and
undefined functions?
For example:
x = symbols('x')
f = Function('f')(x)
eq=cos(x)+f
s=eq.atoms(Function)
>>> s
set(f(x), cos(x))
so I would like
for i in s:
IS_INTERNAL(i) or IS_DEFINED(i) or whatever
and get somethin
12, 8:44 am, Chris Smith wrote:
> On Thu, Apr 12, 2012 at 12:20 AM, vweber wrote:
> > Hi Chris
>
> > With the set of eqs I get from cse I call fcode(). So ordering is
> > important, I would expect to get
>
> > s = grho/rho
> > x0 = 2*s
> > ...
>
&g
expect such a call to cse
to produce top to bottom and right to left dependencies (like any
programming languages I play with).
V
On Apr 11, 4:04 pm, Chris Smith wrote:
> On Tue, Apr 10, 2012 at 3:13 PM, vweber wrote:
> > Dear All
>
> > I get a wrong ordering while calling cs
Dear All
I get a wrong ordering while calling cse:
>
cat my.py
from sympy import *
rho,grho = symbols('rho,grho')
dsdr,dzetadr,dsdn,dzetadn=symbols('dsdr,dzetadr,dsdn,dzetadn')
s=symbols('s')
eqs_all=[]
eqs_all.append(Eq(s, grho/rho))
eqs_all.append(Eq(dzetadr, 2*dsdr*s))
eqs
'Float'
On Apr 7, 9:55 am, Chris Smith wrote:
> On Sat, Apr 7, 2012 at 1:04 AM, vweber wrote:
> > Dear All
>
> > I get a mixed behavior for the nfloat procedure with exponents, in the
> > equation one exponent is evaluated and the other not.
>
> Can you ta
---+
Is that a bug?
V
On Apr 5, 2:16 pm, Chris Smith wrote:
> On Thu, Apr 5, 2012 at 5:53 PM, vweber wrote:
> > Dear All
>
> > I would like to evaluate a function with a requested precision with
> > N(..., n=XX), eg
>
> > >>> from sym
ivative(F1(x), x) + F1(x))*F1(x)*sin(x*F1(x)) +
cos(x*F1(x))*Derivative(F1(x), x)]
so I get all the ingredients I need in a compact way, but I would need
to finally convert the
Functions and their derivatives to symbols, eg
Derivative(F3(x), x) --> dF3dx
F1(x) -->> F1
what would be th
Would it be possible to define a tree of equations as:
root: f(x)=f1(x)*f3(x)
leaf 1: f1(x)=...
leaf 0: f3(x)=...+f2(x)
leaf 00: f2(x)=...
or equivalently
leaf 1
/
root
\
leaf 0
\
leaf 00
and then recurse the tree by applying the diff operato
Dear All
I would like to evaluate a function with a requested precision with
N(..., n=XX), eg
>>> from sympy import *
>>> x=symbols('x')
>>> N(Rational(2,3)*exp(Rational(2,3)*x),n=20)
0.6667*exp(2*x/3)
but I would like the fraction in the exp() to be evaluated as well, so
getting
Dear All
I would need to take the derivative of very long functions (and at the
end call fcode()), so
eg:
f1(x)=...
f2(x)=...
f3(x)=...+f2(x)
f(x)=f1(x)*f3(x)
and I target df/dx. The sympy code would look like
x = symbols('x')
f1=...
f2=...
f3=...+f2
f=f1*f3
fcode(diff(f,x))
and this will prod
ehavior of your example is correct for
> master branch?
>
> You can retrieve latest SymPy version with the help of this instructions:
>
> [1]https://github.com/sympy/sympy/wiki/Getting-the-bleeding-edge
>
> --
> Alexey Gudchenko
>
> On 04.04.2012 12:03, vweber wrote
Dear All
Trying to cse a long expression (that I would like to input to fcode()
at the end), it fails at a substitution.
Here is my script (sorry for the length...) and the output:
>
from sympy import *
class Ei(Function):
nargs = 1
RHO,GRHO = symbols('RHO,GRHO')
R0 = symbols('R0')
s0 =
Hi Chris
That looks excellent! I will give it a try.
I noticed that there might also be a problem with the number of
continuation lines (for f95 standard it should be 40 lines (20 for
fixed form),
it was extended to 256 for the f2003 std).
BTW do you know if there is a way to optimize an equation
Dear Chris
Please have a look to the standard
http://www.j3-fortran.org/doc/standing/links/007.pdf
page 138, middle of the note 7.9.
I copied it here that you dont miss it
"... These formation rules do not permit expressions containing
two consecutive numeric operators, such as A ** -B or A + -
Dear all
Few questions:
1) exectuting that
> x = symbols('x')
> z=1.0*x**(-1.0)
> print fcode(simplify(z))
gives
> 1.0d0*x**-1.0d0
which is not fortran standard.. I would expect 1.0d0/x or x**(-1) or
in the worst case x**(-1.0d0). How can I get a better output?
2) executing that
> x = sy
22 matches
Mail list logo