Thank you very much for your reply, i learned a lot
My initial intention when asking the prior question was to define a function where some evaluations would return itself, while other evaluations would not. Such as
```
def f(x):
if x%2==0:
return hold(f(x))
else:
return x^2+1
```
In fact, I am trying to define the total differential in the
following way, this is my final intention.
```
def Dt(expression1):
if len(expression1.args()) == 1 \
and expression1.args()[0]==expression1:
# if the expression has only one variable
# and that variable is the entire expression
print("a")
with hold:
held = Dt(SR(expression1))
return held
else:
return sum(map(lambda
arg:diff(expression1,arg)*Dt(arg),expression1.args()))
```
--
You received this message because you are subscribed to the Google Groups "sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/4695021e-be4f-4eb8-a929-1097e7271dban%40googlegroups.com.
Whoops, I have sent an old version of the function by mistake.
I meant to send
```
def Dt(expression1):
if len(expression1.args()) == 1 \
and expression1.args()[0]==expression1:
# if the expression has only one variable
# and that variable is the entire expression
return hold( Dt(expression1) )
else:
return sum(map(lambda
arg:diff(expression1,arg)*Dt(arg),expression1.args()))
```
Apologies.
```
def Dt(expression1):
if len(expression1.args()) == 1 \
and expression1.args()[0]==expression1:
# if the expression has only one variable
# and that variable is the entire expression
return Dt_symbolic(expression1)
else:
return sum(map(lambda
arg:diff(expression1,arg)*Dt(arg),expression1.args()))
```