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$ Mar 10, 2020 at 19:28

Your Answer

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

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