Hello,
How can I substitute/replace something mathematically from an expression:
For example:
>>> exp(5*x).xreplace({exp(x): sin(x)})
>>> exp(5*x) # I would expect sin(x)**5 here
In better way to do the above thing?
Thanks,
Best,
--
Adrian
--
You received this message because you are sub
Try this,
>>> exp(5*x).xreplace({exp(5*x): sin(5*x)})
sin(5*x)
On 14 August 2015 at 00:24, Adrián Ashley wrote:
> Hello,
>
> How can I substitute/replace something mathematically from an expression:
>
> For example:
>
> >>> exp(5*x).xreplace({exp(x): sin(x)})
> >>> exp(5*x) # I would expect s
Hi Sartaj,
I think you didn't understood my point. I am looking for mathematical
substitution, not exact
substitution.
exp(5*x).xreplace({exp(5*x): sin(5*x)}) is just a mere example of usage of
xreplace. I am not
looking for exact replacement. the exponent can be anything
For example:
>>> sin
Correction previous example:
In [9]: sin(exp(a*x)).some_replace_func({exp(x): x})
Out[9]: sin(x**a)
On Friday, August 14, 2015 at 11:55:55 AM UTC+5:30, Adrián Ashley wrote:
>
> Hi Sartaj,
>
> I think you didn't understood my point. I am looking for mathematical
> substitution, not exact
> sub
Do you want something like replacing some function f1 (say `exponential
function` you mentioned `{exp(x): x}` ) with some other f2 (say linear
function, you mentioned `{exp(x): x}` ) in your expression ?
On Friday, August 14, 2015 at 12:03:08 PM UTC+5:30, Adrián Ashley wrote:
>
> Correction pre