Re: Lists of equations. Again
- To: mathgroup at smc.vnet.net
- Subject: [mg56287] Re: Lists of equations. Again
- From: dh <dh at metrohm.ch>
- Date: Thu, 21 Apr 2005 05:36:05 -0400 (EDT)
- References: <d45arr$ijq$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi Maxim, the problem is that your expression has syntax errors. 1) It look like FindRoot does not like tensor equations. You must expand the equations like e.g.: eq=MapThread[Equal,{Array[a, {2, 2}],IdentityMatrix[2]},2]; 2) The second argument to FindRoot must contain a list of variables and start values. Sequence[..] is not a list. E.g. wrap your expression in a list: var={Sequence @@ (Flatten[#, 1] &)@Array[{a[##], 0} &, {2, 2}]} This then finally works: FindRoot[eq,var] Sincerely, Daniel Maxim wrote: > In version 5.0 FindRoot[{{x, y} == {1, 1}}, {x, 2}, {y, 2}] failed: it > complained about the non-numerical jacobian and just returned the starting > point. This now works in version 5.1; however, there is still exactly the > same problem with higher-dimensional lists: > > FindRoot[Array[a, {2, 2}] == IdentityMatrix[2], > Evaluate[Sequence@@ (Flatten[#, 1]&)@ Array[{a[##], 0}&, {2, 2}]]] > > This generates Thread::tdlen and FindRoot::njnum messages, indicating that > there is again something wrong with the processing of lists. Strangely, > > FindRoot[Array[a, {2, 2}] - IdentityMatrix[2], > Evaluate[Sequence@@ (Flatten[#, 1]&)@ Array[{a[##], 0}&, {2, 2}]]] > > works without a problem (another possible way to resolve this issue is to > specify Jacobian -> IdentityMatrix[4]). > > If the specified form of the jacobian doesn't have the correct structure, > this often results in the kernel crash: > > FindRoot[x == {1, 2}, {x, {0, 0}}, Jacobian -> {{{1}, {1}}}] > (*crashes the kernel*) > > This may happen even if the structure is correct: > > FindMinimum[x^2, {x, 1}, > Method -> {Newton, Hessian -> {{2}}}] > (*crashes the kernel*) > > Here the hessian is specified correctly, but unless the gradient is also > given explicitly as Gradient -> {2x}, all the other settings (Automatic, > Symbolic, FiniteDifference) lead to the kernel crash. > > Maxim Rytin > m.r at inbox.ru >