Re: [sympy] solve(...) and roots(...)

2014-06-27 Thread Camille Chambon
Hello Chris, Thanks a lot for your answer! It's very interesting. By now I just need the bisection method: nsolve(eq,c2,(1,1000),solver='bisect'). But I will keep in mind the continuation method for the future. Cheers, Camille Le jeudi 26 juin 2014 18:36:58 UTC+2, Chris Smith a écrit : > > Above

[sympy] Re: Getting `nan` or `oo` after subs when not simplified

2014-06-27 Thread Chris Smith
Try only signsimp before substitution. Can you post code to generate one of these expressions? -- 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...@google

Re: [sympy] BooleanTrue is not True

2014-06-27 Thread Chris Smith
# Yes: if greeting: # No:if greeting == True: # Worse: if greeting is True: ok. but in the case of differentiating between None or False you have to use the literal. ...is_foo cane use is True but for bool it's bad... On Thursday, June 26, 2014 10:47:01 AM UTC-5, Aaro

[sympy] Re: SymPy equivalent of itertools.permutations

2014-06-27 Thread Chris Smith
>>> from sympy.utilities.iterables import permutations >>> for i in permutations(range(3)): ... print i ... (0, 1, 2) (0, 2, 1) (1, 0, 2) (1, 2, 0) (2, 0, 1) (2, 1, 0) ;-) but if you help(permutations) you will see that we have just imported permutations from itertools. Also note that we

Re: [sympy] Re: Finding domains of numbers

2014-06-27 Thread Aaron Meurer
If you create a constant Poly, it picks the domain. You should look at the source to see how it picks that. Aaron Meurer On Sat, Jun 21, 2014 at 10:48 AM, Christophe Bal wrote: > Hello. > > I do not know if it is the case but I think that sympy should have a domain > method for expressions. This

Re: [sympy] BooleanTrue is not True

2014-06-27 Thread Aaron Meurer
I think I'm losing track of your question here. is_foo can't use BooleanTrue because it isn't symbolic. It will never return an arbitrary boolean expression. Also, it uses three-valued logic, whereas BooleanTrue is explicitly two-valued. Aaron Meurer On Fri, Jun 27, 2014 at 7:36 AM, Chris Smith

[sympy] Re: Removing the UniversalSet

2014-06-27 Thread Harsh Gupta
MatLab also have something similar to our UniversalSet http://www.mathworks.in/help/symbolic/mupad_ref/universe.html. On Saturday, 10 May 2014 23:33:12 UTC+5:30, Harsh Gupta wrote: > > This comes from the discussions on this PR > https://github.com/sympy/sympy/pull/7462#issuecomment-42111992 > >

Re: [sympy] Re: Finding domains of numbers

2014-06-27 Thread Chris Smith
But you can't create a constant Poly without giving the domain. Try something like the following (and, again, trace the code to see if there is a more direct way of learning the domain): >>> Poly(1.2+var('x')) Poly(1.0*x + 1.2, x, domain='RR') >>> Poly(1+var('x')) Poly(x + 1, x, domain='ZZ') >>>

Re: [sympy] BooleanTrue is not True

2014-06-27 Thread Chris Smith
It's just that you have to explicitly use False or None to test an is_foo result sometimes. And I'm so conditioned to use "is False" that when it comes to testing the result of a relationship I do the same...but shouldn't because (3>0) is True is False (because it's true, not True)and I note

Re: [sympy] BooleanTrue is not True

2014-06-27 Thread Aaron Meurer
For is_foo, you can use "is False", but for an inequality, it returns a sympified boolean, because that is an example of a case where the expression might not be true or false, but a symbolic expression (like x > y). So a symbolic boolean makes sense in that case. Aaron Meurer On Fri, Jun 27, 201

Re: [sympy] Re: Finding domains of numbers

2014-06-27 Thread Aaron Meurer
You can't create it without giving a variable, but you can easily do Poly(1, x).get_domain(). There's probably a more direct way, though. Aaron Meurer On Fri, Jun 27, 2014 at 2:15 PM, Chris Smith wrote: > But you can't create a constant Poly without giving the domain. Try > something like the f

[sympy] using nsolve is not anti-SymPy

2014-06-27 Thread Chris Smith
There have been several questions about solving equations where it seems that we haven't featured nsolve enough: nsolve is a great way to get a numerical solution to an equation. You can use sympy to do the derivations of some equation that you want to solve and then use nsolve to process it fo

[sympy] Re: using nsolve is not anti-SymPy

2014-06-27 Thread Chris Smith
original question at http://stackoverflow.com/questions/24393022/distance-from-point-to-complicated-curve -- 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+unsubsc

Re: [sympy] Re: using nsolve is not anti-SymPy

2014-06-27 Thread Aaron Meurer
I agree. We usually try to point people to numeric libraries for numeric solutions, because they do it better. But there are advantages to using SymPy, like being able to represent and manipulate the equation symbolically. I think we should integrate with other numeric solvers better (e.g., through

[sympy] Re: Getting `nan` or `oo` after subs when not simplified

2014-06-27 Thread James Crist
signsimp didn't seem to help. I'll try to get a gist of the expression up tomorrow, it's so huge I haven't succesfully ran simplify on it. However, I had the same thing happen with a readable expression. The issue was something like: >>> expr = sin(a)/tan(a) >>> expr.subs(a, 0) nan >>> expr = e

[sympy] Re: Getting `nan` or `oo` after subs when not simplified

2014-06-27 Thread Chris Smith
Ahh...trisgsimp is like simplify in that it tries several things that are known to generally work. If you know that it's trig-related because of these sorts of ratios, you might just try rewriting >>> cancel((sin(x)/tan(x)).rewrite(exp)).subs(x,0) 1 >>> w=Wild('w'); (sin(x)/tan(x)).replace(tan(w