Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.
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.

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

1 Answer 1

up vote 11 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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