Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
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?
Solved! Go to Solution.
Yes, the worksheet would help. Some definitions are obviously done but not visible in the snippet picture.
Remember: Some errors thrown are not what they seem to be.
From scratch, when I test around with Mathcad Prime 7 (attached), I realize a similar error like in the above picture (index) but caused by a missing definition of q when Jacob() gets called.
Remember:
Definition like F(x):= works, even if x is undefined
Call of a function like F(x)= fails if x is undefined
Please test if the above is the case in your example:
When Jacob function is getting called, and q is not defined, then Mathcad Prime cannot work and mus throw an error.
Test: put a definition of q right prior the call of Jacob() function. Like in this example (first call of Jacob() fails, second works):
Note: of course the values must differ in my example, missing your origin example.
Can you attach the worksheet? Always better to do so compared to just post a picture.
I guess it could be worth to look at the definitions of the functions x.t and y.t.
Do you get a result if you remove those functions in the definition of function C ?
Hi,
Yes, the worksheet would help. Some definitions are obviously done but not visible in the snippet picture.
Remember: Some errors thrown are not what they seem to be.
From scratch, when I test around with Mathcad Prime 7 (attached), I realize a similar error like in the above picture (index) but caused by a missing definition of q when Jacob() gets called.
Remember:
Definition like F(x):= works, even if x is undefined
Call of a function like F(x)= fails if x is undefined
Please test if the above is the case in your example:
When Jacob function is getting called, and q is not defined, then Mathcad Prime cannot work and mus throw an error.
Test: put a definition of q right prior the call of Jacob() function. Like in this example (first call of Jacob() fails, second works):
Note: of course the values must differ in my example, missing your origin example.