Indexing issues
I've written a function C with 2 inputs: a scalar and a vector; and 1 output: a vector. When I evaluate the function for a certain input there is no problem. However, when I try to compute the Jacobian of the function I get the following error: "The array index is invalid. The index must be an integer, not less than ORIGIN, and not greater than the last element."

Strangely, when I get rid of the two bottom entries of the output vector of the function C, I get no such error, it produces the Jacobian matrix one would expect it to. This leads me to believe that the issue is in q_3. (I have made sure that 3 is no subscript but an index)
Can anyone tell me what the issue here is?


