Yep:
(sinh(x)).replace(sinh, lambda arg: exp(arg)/2)exp(x)/2
On Thursday, October 31, 2013 6:14:59 PM UTC+4, Aaron Meurer wrote:
Use replace to replace functions.
Aaron Meurer
On Oct 31, 2013, at 6:48 AM, Boris Kheyfets kheyf...@gmail.comjavascript:
wrote:
I have a large
I have a large argument, so I'd rather neglect exp(-x) in the definition of
sinh. How do I substitute sinh by 1/2*exp ?
I tried .subs({sinh: 0.5*exp}) and .subs({2 * sinh: exp}) but it doesn't
work: TypeError: unsupported operand type(s) for *: 'int' and
'FunctionClass'.
--
You received this
Oh, I solved it:
class Sinh(Function):
@classmethod
def eval(cls, arg):
return exp(arg)/S(2)
--
You received this message because you are subscribed to the Google Groups
sympy group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
Yep, it definetly should be [z, log(z)]. And even [z, log(z), q] in my case.
It's close, but not quite what I wanted.
I think I'll just substitute a number into D. Then sympy handles it
smoothly.
--
You received this message because you are subscribed to the Google Groups
sympy group.
To
should be to use powdenest, but it seems that
powdenest(force=True) is not working for me. So this is a bug. I
opened https://code.google.com/p/sympy/issues/detail?id=4022 for it.
Aaron Meurer
On Tue, Sep 10, 2013 at 4:59 AM, Boris Kheyfets kheyfbo...@gmail.com
wrote:
Ho do I cancel expression
Hello SymPy users,
Is there a way to make SymPy cancel common expression? For example:
from sympy import *var(a b)b = 1/(sqrt(a) - 1)**(S(8)/3)b.diff(a) / (2 *
sqrt(2) * b**(S(3)/4)) # gives: -sqrt(2)/(3*sqrt(a)*(sqrt(a) -
1)**(11/3)*((sqrt(a) - 1)**(-8/3))**(3/4))
I want SymPy to cancel
Hello SymPy users,
Suppose I have a = b**2, and I want to pprint:
2
a = b
How can I do it? The closest I can get is:
#!/usr/bin/python
from sympy import *
var(a b)
a = b**2
pprint({a: a)
But it
- prints : instead of = and also
- prints ugly {} around equality (or
Why this
d2bdy2 = b_i.diff(y_i, 2)exec(pprint({{'{0}': {0}}}).format(d2bdy2))
is not equivalent to
def assign_and_pprint(Name, Expr):
exec({Name} = {Expr}.format(Name=Name, Expr=Expr))
exec(pprint({{'{Name}': {Name}}}).format(Name=Name))
assign_and_pprint(d2bdy2, b_i.diff(y_i, 2))
because the string form of the expression contains division of
numeric literals, which exec evaluates to floats. If you want to avoid
this, you should use sympify(), or use the srepr() form of the
expression instead of the str() form.
Aaron Meurer
On Wed, Sep 11, 2013 at 7:51 AM, Boris Kheyfets
Cool thanks.
On Wed, Sep 11, 2013 at 9:30 PM, Aaron Meurer asmeu...@gmail.com wrote:
Use Eq(), like Eq(a, b**2).
Aaron Meurer
On Wed, Sep 11, 2013 at 7:24 AM, Boris Kheyfets kheyfbo...@gmail.com
wrote:
Hello SymPy users,
Suppose I have a = b**2, and I want to pprint:
2
Ho do I cancel expression in a denominator:
2/3
-8⋅2
─
7/4
3 ___ 22/3 ⎛ 1 ⎞
3⋅╲╱ ν ⋅(yᵢ - 1)⋅⎜───⎟
⎜8/3⎟
⎝(yᵢ
Thanks -- expand() did what I wanted.
On Thursday, September 5, 2013 9:02:26 PM UTC+4, Boris Kheyfets wrote:
Hello SymPy users,
How do I force division? I have a fraction, which I get as a result of
series of subs. Now I get some z**(3/2) stuck in denominator. Here's a
object:
-P**2*R
Hello SymPy users,
How do I force division? I have a fraction, which I get as a result of
series of subs. Now I get some z**(3/2) stuck in denominator. Here's a
object:
-P**2*R**2*(2*q**2*z**(11/2) - 8*q**2*z**(7/2)*log(z) + 4*q**2*z**(7/2) -
8*q**2*z**(3/2)*log(z)**2 -
Images were working when I posted. Any way the latex code shown instead of
images is correct. Here I attach a MathML html file with the original post
anyway.
On Wednesday, August 14, 2013 4:40:29 PM UTC+4, Boris Kheyfets wrote:
Hello SymPy users and devs,
I have a large expressions
Oh, no problem:
Gamma_R**2*R**4*R_1**2 + 4*Gamma_R**2*R**2*R_1**4*log(R)**3 -
12*Gamma_R**2*R**2*R_1**4*log(R)**2*log(R_1) -
8*Gamma_R**2*R**2*R_1**4*log(R)**2 +
12*Gamma_R**2*R**2*R_1**4*log(R)*log(R_1)**2 +
16*Gamma_R**2*R**2*R_1**4*log(R)*log(R_1) + 2*Gamma_R**2*R**2*R_1**4*log(R) -
disabling
combining of exponents. You can get what you want using subs(log(R) -
log(R_1), log(R/R_1)), though, since all the logs are of that form.
More generally you could use replace with a wild symbol.
Aaron Meurer
On Thu, Aug 15, 2013 at 11:09 AM, Boris Kheyfets kheyfbo...@gmail.com
wrote
Hello SymPy users and devs,
I have a large expressions with
- [image: $\log^2(\frac{R}{R_1})$] split into [image: $\log^2(R) - 2
\log(R) \log(R_1) + \log^2 (R_1)$], and
- [image: $\log^3(\frac{R}{R_1})$] split into [image: $\left [ \log(R) -
\log(R_1)\right ]^3 = \ldots$]
I
17 matches
Mail list logo