(R) Error in solve() 'a' must be a numeric matrix
<p>Here's the problem: I want to calculate the inverse of a 3x3 matrix. I tried to use solve(J), but it gives an error message:</p>

<p>Error in solve.default(J) : 'a' must be a numeric matrix.</p>

<p>Here's the matrix J and the code:</p>

<pre><code>T1&lt;-20
T2&lt;-50
T3&lt;-50
T4&lt;-50
T5&lt;-350

        df1dx1&lt;- Deriv(-(14.6+0.0635*(T2+T1))*T2-(14.6+0.0635*(T2+T1))*T1+(14.6+0.0635*(T3+T2))*T3-(14.6+0.0635*(T3+T2))*T2, "T2")
        df1dx2&lt;- Deriv(-(14.6+0.0635*(T2+T1))*T2-(14.6+0.0635*(T2+T1))*T1+(14.6+0.0635*(T3+T2))*T3-(14.6+0.0635*(T3+T2))*T2, "T3")
        df1dx3&lt;- Deriv(-(14.6+0.0635*(T2+T1))*T2-(14.6+0.0635*(T2+T1))*T1+(14.6+0.0635*(T3+T2))*T3-(14.6+0.0635*(T3+T2))*T2, "T4")
        df2dx1&lt;- Deriv(-(14.6+0.0635*(T3+T2))*T3-(14.6+0.0635*(T3+T2))*T2+(14.6+0.0635*(T4+T3))*T4-(14.6+0.0635*(T4+T3))*T3,"T2")
        df2dx2&lt;- Deriv(-(14.6+0.0635*(T3+T2))*T3-(14.6+0.0635*(T3+T2))*T2+(14.6+0.0635*(T4+T3))*T4-(14.6+0.0635*(T4+T3))*T3,"T3")
        df2dx3&lt;- Deriv(-(14.6+0.0635*(T3+T2))*T3-(14.6+0.0635*(T3+T2))*T2+(14.6+0.0635*(T4+T3))*T4-(14.6+0.0635*(T4+T3))*T3,"T4")
        df3dx1&lt;- Deriv(-(14.6+0.0635*(T4+T3))*T4-(14.6+0.0635*(T4+T3))*T3+(14.6+0.0635*(T5+T3))*T5-(14.6+0.0635*(T5+T4))*T4,"T2")
        df3dx2&lt;- Deriv(-(14.6+0.0635*(T4+T3))*T4-(14.6+0.0635*(T4+T3))*T3+(14.6+0.0635*(T5+T3))*T5-(14.6+0.0635*(T5+T4))*T4,"T3")
        df3dx3&lt;- Deriv(-(14.6+0.0635*(T4+T3))*T4-(14.6+0.0635*(T4+T3))*T3+(14.6+0.0635*(T5+T3))*T5-(14.6+0.0635*(T5+T4))*T4,"T4")

    J&lt;-matrix(c(df1dx1,df1dx2,df1dx3,df2dx1,df2dx2,df2dx3,df3dx1,df3dx2,df3dx3),nrow=3,ncol=3,byrow=TRUE)

invJ&lt;- solve(J)  ##this gives the problem
</code></pre>

<p>What's the problem??? Thank you very much, guys.
Obs: I can't substitute T2,T3 and T4 by 50 because I need to recalculte this multiple times changing the T2, T3 and T4 values.</p>