1
$\begingroup$
v = Subscript[v, 0]*Sin[(Pi*S)/Subscript[S, 0]];
a = dv/ds v;
a = D[v, s]

returns

$RecursionLimit::reclim: Recursion depth of 256 exceeded.

Reference in the link shown by error msg doesn't give me a relief. I'm assuming the root cause is that I'm not assigning concrete values to the variables. But here I want to operate differentiation w/o assigning values (is there explicit name in math for this kind of operation?). Don't even know if it's differentiation specific or general issue for an operation not assigning concrete values (and thus can't assign proper tags to this question either). I haven't been able to find the corresponding reference. Thanks.


Update) Code @acl gave works for me now. However, I'm just curious why my code returns the same error even after I corrected "S" to "s", and also removed 2nd line which I didn't really expect Mathematica to do anything for.

$\endgroup$
3
  • $\begingroup$ Regarding the update, is my explanation not sufficient? $\endgroup$
    – acl
    Feb 13, 2012 at 19:24
  • $\begingroup$ @acl yes, I guess in my particular situation the variable v might contain something and thus Mathematica tried to evaluate it. Thx $\endgroup$
    – IsaacS
    Feb 14, 2012 at 19:52
  • $\begingroup$ This occurs without anything being bound tov. It is just like k=k+1, which would work in C but in mathematica causes this. $\endgroup$
    – acl
    Feb 14, 2012 at 19:54

1 Answer 1

11
$\begingroup$

The error comes from the first line. I am not sure what the second does; finally, you differentiate with respect to s, but have a variable S, which is different.

Perhaps you wanted to do this:

v = v0*Sin[Pi*s/s0]
D[v, s]

which works.

To see the problem with recursion, run this:

ClearAll[v]
v = Subscript[v, 0]

enter image description here

What is happening is the same that happens if you evaluate k = k + 1.

$\endgroup$

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.