Re: [sympy] Simplify expressions involving complex numbers

2023-05-23 Thread Paul Royik
Thank you! On Tuesday, May 23, 2023 at 4:21:29 PM UTC+3 Oscar wrote: > On Tue, 23 May 2023 at 06:51, Paul Royik wrote: > > > > How do I simplify the following expressions: i**(-2*i), (-i)**(-2*i), > ((-sqrt(3) - i)/2)**(-2*i), ((sqrt(3) - i)/2)**(-2*i) ? > > > >

[sympy] Simplify expressions involving complex numbers

2023-05-22 Thread Paul Royik
How do I simplify the following expressions: i**(-2*i), (-i)**(-2*i), ((-sqrt(3) - i)/2)**(-2*i), ((sqrt(3) - i)/2)**(-2*i) ? Is there any built-in function? For example, i**(-2*i) should give e^pi and ((sqrt(3) - i)/2)**(-2*i) should give e^(-pi/3). Thank you. -- You received this message

[sympy] Re: Unexpanded coefficients of a polynomial

2023-05-22 Thread Paul Royik
Thanks to all! On Friday, April 28, 2023 at 9:31:21 AM UTC+3 emanuel.c...@gmail.com wrote: > BTW : > >>> x, y = symbols("x, y") >>> P = 360*x*y**71*(y**72 - 1)**4 + 360*x**4 > *(x**5 - 1)**7 >>> P.args (360*x**4*(x**5 - 1)**7, 360*x*y**71*(y**72 - 1 > )**4) >>> P.func.make_args(P)

[sympy] Unexpanded coefficients of a polynomial

2023-04-27 Thread Paul Royik
Hello. How can I get all unexpanded coeffs of a polynomial? For example, Poly(360*x*y**71*(y**72 - 1)**4 + 360*x**4*(x**5 - 1)**71, x).all_coeffs() should return [360*y**71*(y**72 - 1)**4, 360*x**4*(x**5 - 1)**71], but, instead, it returns expanded long expression. How to avoid this and

Re: [sympy] Order Add args when printing latex

2023-01-21 Thread Paul Royik
Thank you very much! On Saturday, January 21, 2023 at 5:28:51 PM UTC+2 Oscar wrote: > On Sat, 21 Jan 2023 at 15:24, Paul Royik wrote: > > > > Thank you very much for the response. > > Is there any other ways without evaluate=False? > > What about def _parse_order(cls

Re: [sympy] Order Add args when printing latex

2023-01-21 Thread Paul Royik
Thank you very much for the response. Is there any other ways without evaluate=False? What about def _parse_order(cls, order): function? Can I specify a custom order? On Saturday, January 21, 2023 at 4:36:58 PM UTC+2 Oscar wrote: > On Fri, 13 Jan 2023 at 11:10, Paul Royik wrote: > >

[sympy] Order Add args when printing latex

2023-01-13 Thread Paul Royik
Hello. Is it possible to render cos ^2 (x)- sin ^2 (x) as "cos ^2 (x)- sin ^2 (x)", not "- sin ^2 (x)+cos^2(x)"? I want terms with negative sign be last. I've discovered that there is def _print_Add(self, expr, order=None): How should order be specified? -- You received this message because

[sympy] Re: Step-by-step algorithms using SymPy

2022-02-21 Thread Paul Royik
Hello, I'm interesting in integration, limit, series algorithms. On Monday, February 21, 2022 at 5:06:59 AM UTC+2 syle...@gmail.com wrote: > Hello, I am verified sympy contributor and currently working as a math > engine developer for Mathpresso, inc. > I have 2 years of experience of working

[sympy] Step-by-step algorithms using SymPy

2022-02-18 Thread Paul Royik
I'm developing a step-by-step math solver for students, like Symbolab or MathWay. I use SymPy. And I need a person to help me write algorithms for certain problems: limits, equation solving, integration, series etc. I wonder whether here are people that could be hired for this job. This is a

[sympy] Boolean simplifier

2021-12-17 Thread Paul Royik
Is there a funciton that can simplify (to write as short as possible, the smallest number of operations) a boolean expression? ABC + A~B~C+~AB~C+~A~BC should be simplified to A xor B xor C. -- You received this message because you are subscribed to the Google Groups "sympy" group. To

[sympy] How to factor out a constant?

2021-12-14 Thread Paul Royik
In any expression, how to factor a constant (that doesn't depend on certain symbols)? For example (-2xy+2).factor_function(x,y) should give 2, (1-xy). as_coeff_mul doesn't work. -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from

Re: [sympy] Why Poly((x-6)**100*(2-x)**9000,x) is very slow?

2021-11-22 Thread Paul Royik
do want just a specific term, your best bet is > to use series(), as this works quite well on polynomials without > expanding them. > > Aaron Meurer > > On Mon, Nov 22, 2021 at 8:14 AM Paul Royik wrote: > > > > Thank you. Yes, in some cases I just need a degree or a leading

[sympy] Re: How to parse f(x) as a Function?

2021-11-22 Thread Paul Royik
], 'Symbol') result.append((OP, '*')) Is there any reason to substitute a Function with a Symbol? On Monday, November 22, 2021 at 9:00:13 AM UTC+2 Paul Royik wrote: > I want to parse something like `f(x) - 2 sin 3x`. > > If I use `parse_expr` without `implicit_multiplication_application`, then

Re: [sympy] Why Poly((x-6)**100*(2-x)**9000,x) is very slow?

2021-11-22 Thread Paul Royik
Thank you. Yes, in some cases I just need a degree or a leading term. On Monday, November 22, 2021 at 3:34:17 PM UTC+2 Oscar wrote: > On Mon, 22 Nov 2021 at 09:18, Paul Royik wrote: > > > > `(x-2)**9000` takes much time, but `(x-6)**100*(2-x)**9000` takes > forever. >

[sympy] Why Poly((x-6)**100*(2-x)**9000,x) is very slow?

2021-11-22 Thread Paul Royik
`(x-2)**9000` takes much time, but `(x-6)**100*(2-x)**9000` takes forever. -- 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 sympy+unsubscr...@googlegroups.com. To view

[sympy] Re: Poly expands the expression

2021-11-21 Thread Paul Royik
Thanks to all! On Sunday, November 21, 2021 at 6:35:06 PM UTC+2 Paul Royik wrote: > Just to print it. > > On Sunday, November 21, 2021 at 12:25:16 PM UTC+2 smi...@gmail.com wrote: > >> Internally, Poly will expand it. It would be possible to make a printer >> th

[sympy] How to parse f(x) as a Function?

2021-11-21 Thread Paul Royik
I want to parse something like `f(x) - 2 sin 3x`. If I use `parse_expr` without `implicit_multiplication_application`, then `f(x)` is parsed correctly, but not `2 sin 3x`. If I include `implicit_multiplication_application`, then `f(x)` is parsed as `fx`. Is this a bug? -- You received this

[sympy] Re: Poly expands the expression

2021-11-21 Thread Paul Royik
Just to print it. On Sunday, November 21, 2021 at 12:25:16 PM UTC+2 smi...@gmail.com wrote: > Internally, Poly will expand it. It would be possible to make a printer > that prints the expression in factored form, however. But why do you want > to do that? What is the goal/problem? > > /c > >

[sympy] Poly expands the expression

2021-11-19 Thread Paul Royik
Poly((x-1)**2, x) returns Poly(x**2-2x+1, x). Is it possbile to retain the expression as it is, i.e. (x-1)**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

Re: [sympy] How to create a symbol with greek subscript

2021-09-28 Thread Paul Royik
ot; string, no need to escape > > BR Oscar > > > Den tis 28 sep. 2021 kl 16:15 skrev Paul Royik : > >> I'm trying to create a symbol, where both alpha and beta are in subscript. >> Symbol('x_{\alpha \beta}') doesn't work. >> >> -- >> You received this messag

[sympy] How to create a symbol with greek subscript

2021-09-28 Thread Paul Royik
I'm trying to create a symbol, where both alpha and beta are in subscript. Symbol('x_{\alpha \beta}') doesn't work. -- 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

Re: [sympy] Re: Difference between f.is_number and bool(f.free_symbols)

2021-09-13 Thread Paul Royik
Thanks to everybody! On Monday, September 13, 2021 at 3:56:47 PM UTC+3 Oscar wrote: > Think about things that are literally not numbers: > > In [9]: Interval(1, 2).is_number > Out[9]: False > > In [10]: ImmutableMatrix([[1, 2], [3, 4]]).is_number > Out[10]: False > > > On Mon, 13 Sept 2021 at

[sympy] Difference between f.is_number and bool(f.free_symbols)

2021-09-12 Thread Paul Royik
Are there any cases when f.is_number != (not bool(f.free_symbols))? If I have an arbitrary expression, what is the correct way to check whether it has variables? Thank you. -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this

[sympy] Extrema of a multivariable function

2021-08-23 Thread Paul Royik
Is there a package inside sympy for finding extrema of a multivariable function (numerically and exactly)? -- 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

[sympy] evalf and Integer

2021-08-01 Thread Paul Royik
For a given number, I want to approximate it to 5 decimal points. If a number of digits in the integer part is greater than 7, then round to 7 significant figures. What I noticed is that evalf doesn't approximate to decimal points, it evaluates to significant figures. What should I apply to

[sympy] Parse logic input

2021-06-18 Thread Paul Royik
I want to parse logic implication `p->q`. What should I add to global_dict, so that parse_expr parsed it? I know, that SymPy doesn't have and Implication class. I will create it by myself, but `global_dict = {'->': Implication}` doesn't work. -- You received this message because you are

Re: [sympy] What is_number means?

2021-06-06 Thread Paul Royik
t; > On Sat, Jun 5, 2021 at 11:11 PM Paul Royik wrote: > > > > Why S.Infinity.is_number (as well as S.ComplexInfinity.is_number) is > True and S.NaN.is_number is True, while sin(S.Infinity) (i.e. AccumBounds) > is False? > > > > I just can't understand what is

[sympy] What is_number means?

2021-06-05 Thread Paul Royik
Why S.Infinity.is_number (as well as S.ComplexInfinity.is_number) is True and S.NaN.is_number is True, while sin(S.Infinity) (i.e. AccumBounds) is False? I just can't understand what is_number means in SymPy. -- You received this message because you are subscribed to the Google Groups

[sympy] Re: What is the difference between is_symbol and is_Symbol?

2021-05-11 Thread Paul Royik
Thank you! On Tuesday, May 11, 2021 at 3:12:18 PM UTC+3 jks...@gmail.com wrote: > >>> from sympy import Indexed, IndexedBase, Idx, symbols > >>> i, j = symbols('i j', cls=Idx) > >>> Aij = Indexed('A', i, j) > >>> Aij.is_symbol > True > >>> Aij.is_Symbol > False > > Aij is not a Symbol but it can

[sympy] Re: What is the difference between is_symbol and is_Symbol?

2021-05-11 Thread Paul Royik
Got it! On Tuesday, May 11, 2021 at 3:12:18 PM UTC+3 jks...@gmail.com wrote: > >>> from sympy import Indexed, IndexedBase, Idx, symbols > >>> i, j = symbols('i j', cls=Idx) > >>> Aij = Indexed('A', i, j) > >>> Aij.is_symbol > True > >>> Aij.is_Symbol > False > > Aij is not a Symbol but it can be

[sympy] What is the difference between is_symbol and is_Symbol?

2021-05-11 Thread Paul Royik
What are the cases when one is True, while another is False? -- 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 sympy+unsubscr...@googlegroups.com. To view this

Re: [sympy] Get number of digits after the dot in Float

2021-05-11 Thread Paul Royik
;>> str(float). Some split() and strip() operations should get you want >>> you want, or just use a regex. >>> >>> Aaron Meurer >>> >>> On Thu, Apr 15, 2021 at 11:56 PM Paul Royik wrote: >>> > >>> > One digit. Ignore scienti

Re: [sympy] Get number of digits after the dot in Float

2021-04-16 Thread Paul Royik
just use a regex. > > Aaron Meurer > > On Thu, Apr 15, 2021 at 11:56 PM Paul Royik wrote: > > > > One digit. Ignore scientific notation. > > > > On Friday, April 16, 2021 at 1:23:53 AM UTC+3 asme...@gmail.com wrote: > >> > >> How would you coun

Re: [sympy] Get number of digits after the dot in Float

2021-04-15 Thread Paul Royik
One digit. Ignore scientific notation. On Friday, April 16, 2021 at 1:23:53 AM UTC+3 asme...@gmail.com wrote: > How would you count small numbers like 1.1e-30. Is that 1 digit or 31 > digits after the decimal? > > Aaron Meurer > > On Thu, Apr 15, 2021 at 2:31 PM

[sympy] Get number of digits after the dot in Float

2021-04-15 Thread Paul Royik
Rational(1,2).evalf(), how do I get 1 here (since 0.5 has 1 digit after the dot)? -- 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 sympy+unsubscr...@googlegroups.com.

[sympy] Is it possible to create a function that returns function?

2021-04-10 Thread Paul Royik
F = Function('F') x, y = symbols('x y') How to write F(x)(y)? -- 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 sympy+unsubscr...@googlegroups.com. To view this

Re: [sympy] Re: Ordered terms of a new Expression

2021-03-28 Thread Paul Royik
r=order) > > Aaron Meurer > > On Thu, Mar 25, 2021 at 9:43 AM Paul Royik wrote: > > > > Also, what is the best way to set a color? Setting color in args is not > a very good idea, as color is a string. > > > > On Thursday, March 25, 2021 at 4:06:42 PM U

Re: [sympy] fuzzy_and weird code

2021-03-25 Thread Paul Royik
Thank you. Didn't notice that! On Thursday, March 25, 2021 at 9:58:17 PM UTC+2 Oscar wrote: > On Thu, 25 Mar 2021 at 19:51, Paul Royik wrote: > > > > This is a code for fuzzy_and: > > rv = True > > for ai in args: > > ai = fuzzy_bool(ai) > > if

[sympy] fuzzy_and weird code

2021-03-25 Thread Paul Royik
This is a code for fuzzy_and: rv = True for ai in args: ai = fuzzy_bool(ai) if ai is False: return False if rv: # this will stop updating if a None is ever trapped rv = ai return rv Is there any reason why None is not immediately returned? -- You received this

Re: [sympy] Re: Print floats without an exponent

2021-03-25 Thread Paul Royik
What should I set if I want to show numbers n, such that abs(n)<10**-11 with exponent? I can't set negative infinity here. On Wednesday, March 24, 2021 at 9:04:51 PM UTC+2 Paul Royik wrote: > Thank you. > > On Wednesday, March 24, 2021 at 8:59:22 PM UTC+2 asme...@gmail.com wrote:

[sympy] Re: Ordered terms of a new Expression

2021-03-25 Thread Paul Royik
Also, what is the best way to set a color? Setting color in args is not a very good idea, as color is a string. On Thursday, March 25, 2021 at 4:06:42 PM UTC+2 Paul Royik wrote: > I want to create a class that makes expression colored. > class Colored(Expr): > pass > > How do

[sympy] Ordered terms of a new Expression

2021-03-25 Thread Paul Royik
I want to create a class that makes expression colored. class Colored(Expr): pass How do I make Colored behave exactly as its arg, when I sort args? (x+Colored(2)).as_ordered_terms() should give the same as (x+2).as_ordered_terms() (x*Colored(y)).as_ordered_factors() should give the same as

Re: [sympy] Precedence of negation

2021-03-25 Thread Paul Royik
; On Thu, Mar 25, 2021 at 1:18 AM Paul Royik wrote: > > > > from sympy.printing.precedence, PRECEDENCE > > precedence(-x) == PRECEDENCE['Add'] > > It gives True. > > > > On Wednesday, March 24, 2021 at 10:36:52 PM UTC+2 asme...@gmail.com > wrote: > &g

Re: [sympy] Precedence of negation

2021-03-25 Thread Paul Royik
ut this is only because it converts them both to that canonical form. > > Aaron Meurer > > On Wed, Mar 24, 2021 at 2:13 PM Paul Royik wrote: > > > > Is there any reason why precedence of -x equals precedence of Add? > > -x is (-1)*x > > > > -- > &g

[sympy] Precedence of negation

2021-03-24 Thread Paul Royik
Is there any reason why precedence of -x equals precedence of Add? -x is (-1)*x -- 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 sympy+unsubscr...@googlegroups.com. To

Re: [sympy] Re: Print floats without an exponent

2021-03-24 Thread Paul Royik
Thank you. On Wednesday, March 24, 2021 at 8:59:22 PM UTC+2 asme...@gmail.com wrote: > You can use the min and max flags to the printer function (like sstr() > or pprint() or latex()). They set the minimum and maximum values to > print as fixed point. You can use min=-float('inf'),

[sympy] Print floats without an exponent

2021-03-24 Thread Paul Royik
How can I print Float(0.5) as it is without exponent? -- 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 sympy+unsubscr...@googlegroups.com. To view this discussion

[sympy] What is the difference between as_numer_denom and fraction?

2021-03-19 Thread Paul Royik
And why one needs both these methods? -- 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 sympy+unsubscr...@googlegroups.com. To view this discussion on the web visit

Re: [sympy] is_zero or ==0

2021-03-19 Thread Paul Royik
Great! Thank you. But expr.is_zero always implies, that simplified expr equals 0. Correct? On Friday, March 19, 2021 at 3:51:31 PM UTC+2 Oscar wrote: > On Fri, 19 Mar 2021 at 13:19, Paul Royik wrote: > > > > Is there a difference between checking b.is_zero or

[sympy] is_zero or ==0

2021-03-19 Thread Paul Royik
Is there a difference between checking b.is_zero or b == 0? -- 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 sympy+unsubscr...@googlegroups.com. To view this discussion

[sympy] Is piece of code in StrPrinter ever reachable?

2021-02-13 Thread Paul Royik
In StrPrinter there is def emptyPrinter(self, expr): if isinstance(expr, str): return expr elif isinstance(expr, Basic): return repr(expr) else: return str(expr) Is `return repr(expr)` reachable if `StrPrinter` defines `_print_Basic` that prints all `Basic` objects? -- You received this

[sympy] Does Sympy use more CPU or RAM?

2020-11-08 Thread Paul Royik
I just want to understand what is the best configuration to use? With more CPUs or memory? Thank you. -- 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

Re: [sympy] Is it safe to use sympy in multi-threaded environment?

2020-08-13 Thread Paul Royik
SymPy can have issues with things like > pickle sometimes. > > Aaron Meurer > > On Wed, Aug 12, 2020 at 4:39 AM Paul Royik > wrote: > > > > Can SymPy run inside a Celery task? > > > > On Saturday, August 8, 2020 at 11:51:13 PM UTC+3, Aaron Meurer wr

Re: [sympy] Is it safe to use sympy in multi-threaded environment?

2020-08-13 Thread Paul Royik
ings like > pickle sometimes. > > Aaron Meurer > > On Wed, Aug 12, 2020 at 4:39 AM Paul Royik > wrote: > > > > Can SymPy run inside a Celery task? > > > > On Saturday, August 8, 2020 at 11:51:13 PM UTC+3, Aaron Meurer wrote: > >> > >> I

Re: [sympy] Is it safe to use sympy in multi-threaded environment?

2020-08-13 Thread Paul Royik
gt; On Wed, Aug 12, 2020 at 4:39 AM Paul Royik > wrote: > > > > Can SymPy run inside a Celery task? > > > > On Saturday, August 8, 2020 at 11:51:13 PM UTC+3, Aaron Meurer wrote: > >> > >> I wouldn't recommend using threads with SymPy. Even if it

Re: [sympy] Is it safe to use sympy in multi-threaded environment?

2020-08-12 Thread Paul Royik
t from truly working concurrently. > Instead, use different processes. > > Aaron Meurer > > On Sat, Aug 8, 2020 at 2:32 PM Paul Royik > wrote: > > > > If sympy is run in multi-threaded environment, like apache, is it safe? > Does cache require special handlin

Re: [sympy] Is it safe to use sympy in multi-threaded environment?

2020-08-12 Thread Paul Royik
Can sympy run in side celery task? On Sunday, August 9, 2020 at 10:14:30 PM UTC+3, Paul Royik wrote: > > Thank you. > > On Saturday, August 8, 2020 at 11:51:13 PM UTC+3, Aaron Meurer wrote: >> >> I wouldn't recommend using threads with SymPy. Even if it works (which >

Re: [sympy] How to make nsimplify give approximate fraction

2020-08-10 Thread Paul Royik
> 4.257142857142857 > >>> Rational(str((Integer(149)/35).evalf(16))) > 4257142857142857/1000 > > Aaron Meurer > > On Mon, Aug 10, 2020 at 1:56 PM Paul Royik > wrote: > > > > nsimplify((Integer(149)/25).evalf()) outputs 149.25, as expected &g

[sympy] How to make nsimplify give approximate fraction

2020-08-10 Thread Paul Royik
nsimplify((Integer(149)/25).evalf()) outputs 149.25, as expected nsimplify((Integer(149)/35).evalf()) outputs 149/35, which is not expected as it is repeating decimal. How to make it perform approximation to given precision: 4257142857142857/10**15 ? -- You received this message because you

[sympy] What is the difference between _coeff_isneg(expr) and expr.could_extract_minus_sign()

2020-08-10 Thread Paul Royik
Seems like they do the same thing or no? In printing _coeff_isneg is used, in other packages could_extract_minus_sign. -- 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

Re: [sympy] Is it safe to use sympy in multi-threaded environment?

2020-08-09 Thread Paul Royik
concurrently. > Instead, use different processes. > > Aaron Meurer > > On Sat, Aug 8, 2020 at 2:32 PM Paul Royik > wrote: > > > > If sympy is run in multi-threaded environment, like apache, is it safe? > Does cache require special handling? > > > &g

Re: [sympy] Is it safe to use sympy in multi-threaded environment?

2020-08-08 Thread Paul Royik
h user so that it isn't really > running SymPy in a multi-threaded environment. > > On Sat, 8 Aug 2020 at 16:09, Paul Royik > > wrote: > > > > If a couple of users use sympy at the same time (like live.sympy.org), > is it considered safe? > > What about cache

[sympy] Is it safe to use sympy in multi-threaded environment?

2020-08-08 Thread Paul Royik
If a couple of users use sympy at the same time (like live.sympy.org), is it considered safe? What about cache? -- 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

Re: [sympy] Is using evaluate contextmanager safe?

2020-08-02 Thread Paul Royik
Got it. Thanks. On Sunday, August 2, 2020 at 12:00:47 PM UTC+3, Oscar wrote: > > On Sun, 2 Aug 2020 at 06:32, Paul Royik > > wrote: > > > > Do you mean that now it is not safe to use evaluate=True in one thread > and evaluate=False in another? > > It is alway

Re: [sympy] Is using evaluate contextmanager safe?

2020-08-01 Thread Paul Royik
Do you mean that now it is not safe to use evaluate=True in one thread and evaluate=False in another? On Saturday, August 1, 2020 at 10:40:19 PM UTC+3, Oscar wrote: > > On Sat, 1 Aug 2020 at 18:40, Paul Royik > > wrote: > > > > In sympy.core.parameters it is written

[sympy] Is using evaluate contextmanager safe?

2020-08-01 Thread Paul Royik
In sympy.core.parameters it is written that "WARNING! Although the global parameters are thread-local, SymPy's cache is not by now. This may lead to undesired result in multi-threading operations." But in code I see def __setattr__(self, name, value): if getattr(self, name) != value:

[sympy] deep=True option in factor

2020-07-28 Thread Paul Royik
What does this flag control? factor(2**(x**2 + 2*x + 1)) is not factored factor(sqrt(x**2 + 2*x + 1)) is factored -- 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

Re: [sympy] Assumptions system

2020-01-18 Thread Paul Royik
and powsimp() with the > force=True flag. > > Aaron Meurer > > On Fri, Jan 17, 2020 at 12:26 PM Paul Royik > wrote: > > > > I know that variables can be made positive or negative. > > > > But how do I make assumption that x>2? > > > > If I ha

[sympy] Assumptions system

2020-01-17 Thread Paul Royik
I know that variables can be made positive or negative. But how do I make assumption that x>2? If I have and expression like (x-2)^(1/3)+(x-5)^(1/3) (actually arbitrary expressions), how to make assumptions that all expressions under roots are positive, i.e. x-2>0, x-5>0? -- You received

[sympy] Simplifying trigonometric expression

2016-02-18 Thread Paul Royik
I'm trying to simplify a*cos(b)**2+a*sin(b)**2 to a So, I write a = sympy.Wild('a') b = sympy.Wild('b') expr = 49*cos(x)**2+49*sin(x)**2 + 5 expr.replace(a*sympy.sin(b)**2+a*sympy.cos(b)**2, a, exact=True) But this doesn't work. expr is unchanged. -- You received this message because you are

Re: [sympy] Is it possible that code works on local machine but hangs on remote?

2015-11-23 Thread Paul Royik
nd(f.get((k,), K.zero)) 949 950 return dup_strip(h) On Monday, November 23, 2015 at 9:03:10 PM UTC+2, Aaron Meurer wrote: > > What are the different results that you get? And how is b defined (are > there any assumptions on it)? > > Aaron Meurer > > On Mon, No

Re: [sympy] Is it possible that code works on local machine but hangs on remote?

2015-11-23 Thread Paul Royik
Nov 23, 2015 at 12:56 PM, Paul Royik <distan...@gmail.com > > wrote: > > minimal script is simplify(3*b**(1/Integer(3))-3, fu=True) > > > > On Monday, November 23, 2015 at 8:53:45 PM UTC+2, Ondřej Čertík wrote: > >> > >> Is it running the

Re: [sympy] Is it possible that code works on local machine but hangs on remote?

2015-11-23 Thread Paul Royik
m/sympy/sympy/wiki/Faq#how-do-i-clear-the-cache > > Send a minimal script that hangs, and we can try it on different > computers and see if we can reproduce the issue. Then we'll go from > there. > > Ondrej > > On Mon, Nov 23, 2015 at 10:55 AM, Paul Royik <distan..

[sympy] Is it possible that code works on local machine but hangs on remote?

2015-11-23 Thread Paul Royik
I noticed this issue with simplify function. Is this possible? -- 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 sympy+unsubscr...@googlegroups.com. To post to this

Re: [sympy] Is it possible that code works on local machine but hangs on remote?

2015-11-23 Thread Paul Royik
Python 2.7, last version of sympy. Code is absolutely the same. How to detect hardware difference? How to clear cache? What info should I post? On Monday, November 23, 2015 at 7:42:58 PM UTC+2, Ondřej Čertík wrote: > > On Mon, Nov 23, 2015 at 10:31 AM, Paul Royik <distan...@gmail.com

Re: [sympy] Is it possible that code works on local machine but hangs on remote?

2015-11-23 Thread Paul Royik
> create a list with 333 elements. This is going to fail no > matter what machine you run it on. This is really an issue with SymPy > (it should be using a sparse representation). > > Aaron Meurer > > On Mon, Nov 23, 2015 at 1:57 PM, Paul Royik <distan...@gmail

Re: [sympy] don't understand piece of code

2015-11-09 Thread Paul Royik
OK. Thanks. On Monday, November 9, 2015 at 12:42:51 PM UTC+2, Mateusz Paprocki wrote: > > Hi, > > On 9 November 2015 at 09:49, Paul Royik <distan...@gmail.com > > wrote: > > In Mul class I see this piece of code: > > > > def _eval_is_real(self): &g

[sympy] don't understand piece of code

2015-11-09 Thread Paul Royik
In Mul class I see this piece of code: def _eval_is_real(self): real = True zero = one_neither = False for t in self.args: if not t.is_complex: return t.is_complex Don't understand last two lines. How is it possible that if t is not

Re: [sympy] Powers and complex numbers

2015-11-06 Thread Paul Royik
(replace -1 with whatever value you want to replace). A "cleaner" > solution would be to create a custom Pow subclass that evaluates like > you want, and replace instances of Pow with your class before doing a > substitution. > > Aaron Meurer > > On Wed, Nov

Re: [sympy] Powers and complex numbers

2015-11-06 Thread Paul Royik
> > Aaron Meurer > > On Fri, Nov 6, 2015 at 1:42 PM, Paul Royik <distan...@gmail.com > > wrote: > > I decided to use "cleaner" solution: create a custom Pow subclass that > > evaluates. What method should I override? > > > > On Wed

Re: [sympy] Powers and complex numbers

2015-11-04 Thread Paul Royik
tom Pow subclass that evaluates like > you want, and replace instances of Pow with your class before doing a > substitution. > > Aaron Meurer > > On Wed, Nov 4, 2015 at 1:19 PM, Paul Royik <distan...@gmail.com > > wrote: > > So, there is no way to do it us

Re: [sympy] Powers and complex numbers

2015-11-04 Thread Paul Royik
> Out[3]: -1 > > In [4]: real_root(-1, 3)**2 > Out[4]: 1 > > SymPy, like most math libraries, uses complex roots (i.e., principal > roots) because they have nicer mathematical properties. > > Aaron Meurer > > On Wed, Nov 4, 2015 at 3:30 AM, Paul Royik <distan...

[sympy] Powers and complex numbers

2015-11-04 Thread Paul Royik
I have the following expresssion: f=x**(Rational(2,3)) How can I get 1, when substituting (-1) instead of complex number? For now, I got complex number when run f.subs(x,-1).evalf() -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from

[sympy] Re: Logcombine

2015-10-19 Thread Paul Royik
simplify(2log(5)) returns log(25) How to revert this? On Monday, October 19, 2015 at 10:35:45 AM UTC+3, Francesco Bonazzi wrote: > > > > On Monday, 19 October 2015 07:12:46 UTC+2, Paul Royik wrote: >> >> Hello. >> I noticed that simplify moves coefficient of logarith

[sympy] Re: Logcombine

2015-10-19 Thread Paul Royik
s: > > In [6]: l = log(25) > > In [7]: l.replace(lambda expr: isinstance(expr, log), lambda expr: factor( > expr)) > Out[7]: 2*log(5) > > > > On Monday, 19 October 2015 11:32:34 UTC+2, Paul Royik wrote: >> >> simplify(2log(5)) returns log(25) >> How to re

[sympy] Result depends on the sign of I

2015-09-07 Thread Paul Royik
I see this error when try to calculate limit of (-1)^x /sqrt(x) as x approaches infinity. Can somebody explain me what is the problem here? -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from

[sympy] Re: Result depends on the sign of I

2015-09-07 Thread Paul Royik
Thank you. On Monday, September 7, 2015 at 10:52:12 AM UTC+3, Kalevi Suominen wrote: > > > > On Monday, September 7, 2015 at 9:37:58 AM UTC+3, Paul Royik wrote: >> >> I see this error when try to calculate limit of (-1)^x /sqrt(x) as x >> approaches infinity. &

Re: [sympy] mod_wsgi with sympy

2015-08-03 Thread Paul Royik
Cache is cleared every request. On Saturday, August 1, 2015 at 2:11:12 PM UTC+3, Denis Akhiyarov wrote: Have you checked caching in sympy? I have to force clean the sympy cache for long-term simulations. -- You received this message because you are subscribed to the Google Groups sympy

[sympy] mod_wsgi with sympy

2015-07-24 Thread Paul Royik
Again I'm asking about mod_wsgi. I'm running some sort of webservice that uses sympy. Site is running under apache mod_wsgi. Users access it an everything is fine. But sometimes when I access the page, it loads too long (even simple example). It looks like memory used and another query just

Re: [sympy] mod_wsgi with sympy

2015-07-24 Thread Paul Royik
It never happens on the development server. On Saturday, July 25, 2015 at 6:36:42 AM UTC+3, Sudhanshu Mishra wrote: Hi, Does it happen on development server too? On Jul 25, 2015 1:39 AM, Paul Royik distan...@gmail.com javascript: wrote: Again I'm asking about mod_wsgi. I'm running some

Re: [sympy] Re: Float precision

2015-07-15 Thread Paul Royik
Thank you. On Tuesday, July 14, 2015 at 11:10:38 PM UTC+3, Aaron Meurer wrote: The printer has an option to do this. Use sstr() and set the full_prec flag. Aaron Meurer On Tue, Jul 14, 2015 at 2:53 PM, Paul Royik distan...@gmail.com javascript: wrote: str(a).rstrip('0') trick won't

[sympy] Re: Float precision

2015-07-14 Thread Paul Royik
str(a).rstrip('0') trick won't won't work with complex numbers, like 0.3+0.500i On Monday, July 13, 2015 at 7:08:27 PM UTC+3, Vinzent Steinberg wrote: On Sunday, July 12, 2015 at 6:18:26 PM UTC+2, Paul Royik wrote: Is it possible to set for float precision of 50

[sympy] Float precision

2015-07-12 Thread Paul Royik
Is it possible to set for float precision of 50, but to cut trailing zeros for finite decimals? a=Float('0.5',prec=50) print a/7 Output: 0.071428571428571428571428571428571428571428571428571 a=Float('0.5',prec=50) print a Output: 0.50 (but I want

Re: [sympy] TypeError: cannot determine truth value of

2015-07-11 Thread Paul Royik
But this can't be reproduced. It is a bug from time to time. How can this be possible? On Friday, July 10, 2015 at 1:49:56 AM UTC+3, Aaron Meurer wrote: This looks like a bug. Numerical values should be evaluated in inequalities. Aaron Meurer On Thu, Jul 9, 2015 at 5:23 PM, Paul Royik

Re: [sympy] TypeError: cannot determine truth value of

2015-07-09 Thread Paul Royik
: Is there a traceback with the error? Is it coming from SymPy code or your own code? Aaron Meurer On Thu, Jul 9, 2015 at 12:40 AM, Paul Royik distan...@gmail.com javascript: wrote: I'm using sympy on my site together with django and mod_wsgi. From time to time (i.e. this error

Re: [sympy] TypeError: cannot determine truth value of

2015-07-09 Thread Paul Royik
And another one: File /home/mysite/lib/python2.7/sympy/core/relational.py, line 103, in __nonzero__ raise TypeError(cannot determine truth value of\n%s % self) TypeError: cannot determine truth value of 3*pi/8 = 7*pi/8 On Friday, July 10, 2015 at 1:12:06 AM UTC+3, Paul Royik wrote

[sympy] TypeError: cannot determine truth value of

2015-07-08 Thread Paul Royik
I'm using sympy on my site together with django and mod_wsgi. From time to time (i.e. this error is not reproducible) I've got the following error: TypeError: cannot determine truth value of 3*pi/8 = 7*pi/8 In other words, error is raised when I try to compare numerical values. Can someone

[sympy] Re: Is it possible to calculate inverse Laplace Transform of exponent?

2015-07-03 Thread Paul Royik
OK. Thanks. On Friday, July 3, 2015 at 2:47:19 PM UTC+3, Kalevi Suominen wrote: On Friday, July 3, 2015 at 1:58:06 PM UTC+3, Paul Royik wrote: I want to calculate inverse laplace of e^(-2s) which is dirac(t-2), but sympy gives unevaluated. It is currently not possible to compute

[sympy] Is it possible to calculate inverse Laplace Transform of exponent?

2015-07-03 Thread Paul Royik
I want to calculate inverse laplace of e^(-2s) which is dirac(t-2), but sympy gives unevaluated. -- 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

[sympy] Bug with limit

2015-06-22 Thread Paul Royik
limit(sin(x)**15,x,0,'+') works limit(sin(x)**15,x,0,'-') hangs -- 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 sympy+unsubscr...@googlegroups.com. To post to this

  1   2   >