Re: [sympy] Conditional substitution

2022-01-06 Thread David Bailey
On 06/01/2022 22:19, Oscar Benjamin wrote: On Thu, 6 Jan 2022 at 21:23, David Bailey wrote: On 06/01/2022 16:41, Oscar Benjamin wrote: You can use replace to make arbitrary conditions on substitution. There are different syntaxes so here's how you do it using wild pattern-matching: In [15]:

Re: [sympy] Conditional substitution

2022-01-06 Thread Oscar Benjamin
On Thu, 6 Jan 2022 at 21:23, David Bailey wrote: > > On 06/01/2022 16:41, Oscar Benjamin wrote: > > You can use replace to make arbitrary conditions on substitution. > > There are different syntaxes so here's how you do it using wild > > pattern-matching: > > > > In [15]: expr = (a*x**14 + b*x +

Re: [sympy] How to get started with contributions?

2022-01-06 Thread Jason Moore
David, Here is our introductory information: https://github.com/sympy/sympy/wiki/introduction-to-contributing Jason moorepants.info +01 530-601-9791 On Thu, Jan 6, 2022 at 8:48 PM David Dai wrote: > Hi everyone, > My name is Jingze Dai and I am a CS student from McMaster University, >

Re: [sympy] Conditional substitution

2022-01-06 Thread David Bailey
On 06/01/2022 16:41, Oscar Benjamin wrote: You can use replace to make arbitrary conditions on substitution. There are different syntaxes so here's how you do it using wild pattern-matching: In [15]: expr = (a*x**14 + b*x + c) In [16]: expr Out[16]: 14 a⋅x + b⋅x + c In [17]: w =

[sympy] How to get started with contributions?

2022-01-06 Thread David Dai
Hi everyone, My name is Jingze Dai and I am a CS student from McMaster University, Canada. I want to be a developer in the sympy group. But I do not know after learning, where should I get started? Can anyone give me some suggestions? Thank you so much Sincerely David -- You received this

Re: [sympy] Conditional substitution

2022-01-06 Thread Oscar Benjamin
On Thu, 6 Jan 2022 at 14:41, David Bailey wrote: > > Dear group, > > A substitution like this is easy to make with SymPy: > > (a*x**2+b*x+c).subs(x,y) > > However, how can I make a conditional substitution, such as: > > a) One that would replace even powers of x only. > > b) One which would

[sympy] Conditional substitution

2022-01-06 Thread David Bailey
Dear group, A substitution like this is easy to make with SymPy: (a*x**2+b*x+c).subs(x,y) However, how can I make a conditional substitution, such as: a) One that would replace even powers of x only. b) One which would replace even powers of x by y**(n/2) resulting in a*y**7+b*x+c? I.e. one