Thank you. I didn't know `epath()`. Indeed, the following command performs 
the desired modification:
`epath("/[2]/[1]", EXPR, lambda expr: MODIFIED_SUB_EXPRESSION)`
Best regards,
Olivier

Le vendredi 11 mars 2022 à 23:07:27 UTC+1, [email protected] a écrit :

> This is what `epath` is made for, I believe. I have not spent enough time 
> with it to provide much help, however -- only a pointer.
>
> /c
>
> On Friday, March 11, 2022 at 11:32:41 AM UTC-6 [email protected] wrote:
>
>>
>> Hello,
>> I would like to modify a part of an expression so as to obtain:
>> `EXPR.args[2].args[1] = MODIFIED_SUB_EXPRESSION`
>>
>> How can I do this? The elements returned by "args" are immutable tuples, 
>> I cannot edit them in place and I don't know how to create a modified copy.
>>
>> Thank you for your help,
>> Olivier
>>
>>
>>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/8f56567a-3981-4e23-8293-516aefde3bb9n%40googlegroups.com.

Reply via email to