0
$\begingroup$

I have the following code

ExD = Sum[D[y[n, t], t], {n, 0, 1}];
ExS = Sum[y[n, t], {n, 0, 1}];
σ[0] = 1;
σ'[0] = 1;
y[0, t_] = σ[0] + t σ'[0]
ExD
ExS

Note that when executed, ExD is still general for D[y[0,t],t], while ExS prints y[0,t] as it was defined. I cannot seem to figure out why the first derivative with respect to the second variable of y[0,t] does not evaluate even though y[0,t] is clearly defined and prints properly. Do I need to use Evaluate[] here?

$\endgroup$

1 Answer 1

1
$\begingroup$

I just realized if I use := here instead of = for ExD it will evaluate the derivative every time D[y[0,t],t] is called. This solves my problem.

$\endgroup$
1
  • $\begingroup$ Maybe you want ExD = Sum[Evaluate@D[y[n, t], t], {n, 0, 1}]? $\endgroup$ Commented Mar 10, 2020 at 19:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.