0
$\begingroup$

I would like to solve an algebraic equation A=f(A) whose argument A is a large 3D matrix. Ideally, I would not like to flatten the system of equations, before feeding into FindRoot because f(A) involves convolutions, which are much faster done numerically on the matrices. Is this possible using FindRoot without rewriting a Newton-Raphson solver explicitly?

Specifically, I am trying to solve

FindRoot[
 SArr == CenterArray[-(g^2/\[Beta]) ListConvolve[DqArr, 1./(1./G0Arr - SArr), {{-1, 1, 1}, {1, 1, 1}}], 
   G0Arr // Dimensions], {SArr, \[CapitalSigma]Arr},]

where G0Arr and the initial guess \[CapitalSigma]Arr have the same shape, and DqArr has the same rank but different shape, and g and \[Beta] are constants.

A minimal working code which does flatten the matrix into a vector, before solving is provided below

DqArr = {{{-2.491326151081656`*^-7 + 
     2.6469779601696886`*^-23 I, -3.0327313821578153`*^-7 + 
     0.` I, -4.380101096930404`*^-7 + 0.` I, -5.17390868652759`*^-7 + 
     0.` I, -4.150829355570194`*^-7 + 
     0.` I, -2.4625350724215866`*^-7 + 
     0.` I}, {-3.0327313821578153`*^-7 + 
     0.` I, -4.352731622611051`*^-7 + 
     0.` I, -9.089697457992721`*^-7 + 
     0.` I, -1.3508907402301672`*^-6 - 
     2.117582368135751`*^-22 I, -8.849195203262221`*^-7 + 
     0.` I, -3.7262249246661584`*^-7 + 
     2.6469779601696886`*^-23 I}, {-4.380101096930404`*^-7 + 
     0.` I, -9.089697457992721`*^-7 + 
     0.` I, -4.997110322253366`*^-6 + 
     4.235164736271502`*^-22 I, -0.000018785591838935282` + 
     0.` I, -4.970934505176787`*^-6 + 
     0.` I, -8.344671150527775`*^-7 + 
     5.293955920339377`*^-23 I}, {-5.17390868652759`*^-7 + 
     0.` I, -1.3508907402301672`*^-6 - 
     2.117582368135751`*^-22 I, -0.000018785591838935282` + 
     0.` I, -0.0007163648550175445` + 
     1.0842021724855044`*^-19 I, -0.000018759070998794447` + 
     1.6940658945086007`*^-21 I, -1.2715603814390985`*^-6 - 
     2.117582368135751`*^-22 I}, {-4.150829355570194`*^-7 + 
     0.` I, -8.849195203262221`*^-7 + 
     0.` I, -4.970934505176787`*^-6 + 
     0.` I, -0.000018759070998794447` + 
     1.6940658945086007`*^-21 I, -4.947563340764621`*^-6 + 
     0.` I, -8.166816077611928`*^-7 + 
     0.` I}, {-2.4625350724215866`*^-7 + 
     0.` I, -3.7262249246661584`*^-7 + 
     2.6469779601696886`*^-23 I, -8.344671150527775`*^-7 + 
     5.293955920339377`*^-23 I, -1.2715603814390985`*^-6 - 
     2.117582368135751`*^-22 I, -8.166816077611928`*^-7 + 
     0.` I, -3.246109741045242`*^-7 + 
     0.` I}}, {{-4.114187361244241`*^-7 + 
     1.3234889800848443`*^-23 I, -5.008334956768068`*^-7 + 
     5.293955920339377`*^-23 I, -7.233639072284214`*^-7 + 
     0.` I, -8.54475445618924`*^-7 + 0.` I, -6.855023893929493`*^-7 + 
     5.293955920339377`*^-23 I, -4.06671893376573`*^-7 + 
     0.` I}, {-5.008334956768068`*^-7 + 
     5.293955920339377`*^-23 I, -7.188574850244807`*^-7 + 
     0.` I, -1.5014254765768087`*^-6 + 
     0.` I, -2.2317419737198356`*^-6 + 
     0.` I, -1.461709324326809`*^-6 + 
     0.` I, -6.153964679465149`*^-7 + 
     1.3234889800848443`*^-23 I}, {-7.233639072284214`*^-7 + 
     0.` I, -1.5014254765768087`*^-6 + 
     0.` I, -8.266379107086613`*^-6 + 
     2.117582368135751`*^-22 I, -0.0000312308794746585` - 
     1.6940658945086007`*^-21 I, -8.223152684650612`*^-6 + 
     0.` I, -1.3783912875033888`*^-6 + 
     2.6469779601696886`*^-23 I}, {-8.54475445618924`*^-7 + 
     0.` I, -2.2317419737198356`*^-6 + 
     0.` I, -0.0000312308794746585` - 
     1.6940658945086007`*^-21 I, -0.0017288580150061335` + 
     1.0842021724855044`*^-19 I, -0.00003118708322416664` + 
     0.` I, -2.1007346961889135`*^-6 - 
     5.293955920339377`*^-23 I}, {-6.855023893929493`*^-7 + 
     5.293955920339377`*^-23 I, -1.461709324326809`*^-6 + 
     0.` I, -8.223152684650612`*^-6 + 
     0.` I, -0.00003118708322416664` + 
     0.` I, -8.184557800848152`*^-6 + 
     0.` I, -1.3490205594209672`*^-6 - 
     2.6469779601696886`*^-23 I}, {-4.06671893376573`*^-7 + 
     0.` I, -6.153964679465149`*^-7 + 
     1.3234889800848443`*^-23 I, -1.3783912875033888`*^-6 + 
     2.6469779601696886`*^-23 I, -2.1007346961889135`*^-6 - 
     5.293955920339377`*^-23 I, -1.3490205594209672`*^-6 - 
     2.6469779601696886`*^-23 I, -5.361102946757346`*^-7 - 
     1.3234889800848443`*^-23 I}}, {{-6.851552031690302`*^-7 + 
     0.` I, -8.340842098179467`*^-7 + 
     0.` I, -1.2047567752765983`*^-6 + 
     0.` I, -1.423174148929808`*^-6 + 
     0.` I, -1.1417058900685305`*^-6 + 
     0.` I, -6.772752693123286`*^-7 + 
     0.` I}, {-8.340842098179467`*^-7 + 
     0.` I, -1.1972956943168267`*^-6 + 
     0.` I, -2.501533400728777`*^-6 + 
     0.` I, -3.7194828086745648`*^-6 + 
     0.` I, -2.4353938317779373`*^-6 + 
     0.` I, -1.0249990447602403`*^-6 + 
     0.` I}, {-1.2047567752765983`*^-6 + 
     0.` I, -2.501533400728777`*^-6 + 
     0.` I, -0.000013812701657056203` + 
     0.` I, -0.00005270272758014736` + 
     0.` I, -0.00001374071607723831` + 
     0.` I, -2.296638040860545`*^-6 + 
     0.` I}, {-1.423174148929808`*^-6 + 
     0.` I, -3.7194828086745648`*^-6 + 
     0.` I, -0.00005270272758014736` + 
     0.` I, -0.025491971372427612` + 0.` I, -0.0000526297928578936` + 
     0.` I, -3.5013076705732583`*^-6 + 
     0.` I}, {-1.1417058900685305`*^-6 + 
     0.` I, -2.4353938317779373`*^-6 + 
     0.` I, -0.00001374071607723831` + 
     0.` I, -0.0000526297928578936` + 
     0.` I, -0.000013676443366206937` + 
     0.` I, -2.247726677401557`*^-6 + 
     0.` I}, {-6.772752693123286`*^-7 + 
     0.` I, -1.0249990447602403`*^-6 + 
     0.` I, -2.296638040860545`*^-6 + 
     0.` I, -3.5013076705732583`*^-6 + 
     0.` I, -2.247726677401557`*^-6 + 
     0.` I, -8.929608774587834`*^-7 + 
     0.` I}}, {{-4.114187361244241`*^-7 - 
     1.3234889800848443`*^-23 I, -5.008334956768068`*^-7 - 
     5.293955920339377`*^-23 I, -7.233639072284214`*^-7 + 
     0.` I, -8.54475445618924`*^-7 + 0.` I, -6.855023893929493`*^-7 - 
     5.293955920339377`*^-23 I, -4.06671893376573`*^-7 + 
     0.` I}, {-5.008334956768068`*^-7 - 
     5.293955920339377`*^-23 I, -7.188574850244807`*^-7 + 
     0.` I, -1.5014254765768087`*^-6 + 
     0.` I, -2.2317419737198356`*^-6 + 
     0.` I, -1.461709324326809`*^-6 + 
     0.` I, -6.153964679465149`*^-7 - 
     1.3234889800848443`*^-23 I}, {-7.233639072284214`*^-7 + 
     0.` I, -1.5014254765768087`*^-6 + 
     0.` I, -8.266379107086613`*^-6 - 
     2.117582368135751`*^-22 I, -0.0000312308794746585` + 
     1.6940658945086007`*^-21 I, -8.223152684650612`*^-6 + 
     0.` I, -1.3783912875033888`*^-6 - 
     2.6469779601696886`*^-23 I}, {-8.54475445618924`*^-7 + 
     0.` I, -2.2317419737198356`*^-6 + 
     0.` I, -0.0000312308794746585` + 
     1.6940658945086007`*^-21 I, -0.0017288580150061335` - 
     1.0842021724855044`*^-19 I, -0.00003118708322416664` + 
     0.` I, -2.1007346961889135`*^-6 + 
     5.293955920339377`*^-23 I}, {-6.855023893929493`*^-7 - 
     5.293955920339377`*^-23 I, -1.461709324326809`*^-6 + 
     0.` I, -8.223152684650612`*^-6 + 
     0.` I, -0.00003118708322416664` + 
     0.` I, -8.184557800848152`*^-6 + 
     0.` I, -1.3490205594209672`*^-6 + 
     2.6469779601696886`*^-23 I}, {-4.06671893376573`*^-7 + 
     0.` I, -6.153964679465149`*^-7 - 
     1.3234889800848443`*^-23 I, -1.3783912875033888`*^-6 - 
     2.6469779601696886`*^-23 I, -2.1007346961889135`*^-6 + 
     5.293955920339377`*^-23 I, -1.3490205594209672`*^-6 + 
     2.6469779601696886`*^-23 I, -5.361102946757346`*^-7 + 
     1.3234889800848443`*^-23 I}}, {{-2.491326151081656`*^-7 - 
     2.6469779601696886`*^-23 I, -3.0327313821578153`*^-7 + 
     0.` I, -4.380101096930404`*^-7 + 0.` I, -5.17390868652759`*^-7 + 
     0.` I, -4.150829355570194`*^-7 + 
     0.` I, -2.4625350724215866`*^-7 + 
     0.` I}, {-3.0327313821578153`*^-7 + 
     0.` I, -4.352731622611051`*^-7 + 
     0.` I, -9.089697457992721`*^-7 + 
     0.` I, -1.3508907402301672`*^-6 + 
     2.117582368135751`*^-22 I, -8.849195203262221`*^-7 + 
     0.` I, -3.7262249246661584`*^-7 - 
     2.6469779601696886`*^-23 I}, {-4.380101096930404`*^-7 + 
     0.` I, -9.089697457992721`*^-7 + 
     0.` I, -4.997110322253366`*^-6 - 
     4.235164736271502`*^-22 I, -0.000018785591838935282` + 
     0.` I, -4.970934505176787`*^-6 + 
     0.` I, -8.344671150527775`*^-7 - 
     5.293955920339377`*^-23 I}, {-5.17390868652759`*^-7 + 
     0.` I, -1.3508907402301672`*^-6 + 
     2.117582368135751`*^-22 I, -0.000018785591838935282` + 
     0.` I, -0.0007163648550175445` - 
     1.0842021724855044`*^-19 I, -0.000018759070998794447` - 
     1.6940658945086007`*^-21 I, -1.2715603814390985`*^-6 + 
     2.117582368135751`*^-22 I}, {-4.150829355570194`*^-7 + 
     0.` I, -8.849195203262221`*^-7 + 
     0.` I, -4.970934505176787`*^-6 + 
     0.` I, -0.000018759070998794447` - 
     1.6940658945086007`*^-21 I, -4.947563340764621`*^-6 + 
     0.` I, -8.166816077611928`*^-7 + 
     0.` I}, {-2.4625350724215866`*^-7 + 
     0.` I, -3.7262249246661584`*^-7 - 
     2.6469779601696886`*^-23 I, -8.344671150527775`*^-7 - 
     5.293955920339377`*^-23 I, -1.2715603814390985`*^-6 + 
     2.117582368135751`*^-22 I, -8.166816077611928`*^-7 + 
     0.` I, -3.246109741045242`*^-7 + 0.` I}}};
G0Arr = {{{0.00026221806120695063` + 9.132096056088802`*^-6 I, 
    0.00038420480406961213` + 0.000019632560501338157` I, 
    0.0016590243195173551` + 
     0.00038474728620012356` I, -0.0031986954042854928` + 
     0.0017753902359875918` I, 
    0.0016590243195173551` + 0.00038474728620012356` I, 
    0.00038420480406961213` + 
     0.000019632560501338157` I}, {0.00038420480406961213` + 
     0.000019632560501338157` I, 
    0.0006154214640650449` + 0.00005058106279201534` I, 
    0.002561455035228608` + 
     0.0065343476170139` I, -0.0017814909478848769` + 
     0.00044757780189576285` I, 
    0.002561455035228608` + 0.0065343476170139` I, 
    0.0006154214640650449` + 
     0.00005058106279201534` I}, {0.0016590243195173551` + 
     0.00038474728620012356` I, 
    0.002561455035228608` + 
     0.0065343476170139` I, -0.001623300348016125` + 
     0.0003674684922360431` I, -0.0013717502339991136` + 
     0.00025847659591489983` I, -0.001623300348016125` + 
     0.0003674684922360431` I, 
    0.002561455035228608` + 
     0.0065343476170139` I}, {-0.0031986954042854928` + 
     0.0017753902359875918` I, -0.0017814909478848769` + 
     0.00044757780189576285` I, -0.0013717502339991136` + 
     0.00025847659591489983` I, -0.0016108898926981722` + 
     0.0003615740196760342` I, -0.0013717502339991136` + 
     0.00025847659591489983` I, -0.0017814909478848769` + 
     0.00044757780189576285` I}, {0.0016590243195173551` + 
     0.00038474728620012356` I, 
    0.002561455035228608` + 
     0.0065343476170139` I, -0.001623300348016125` + 
     0.0003674684922360431` I, -0.0013717502339991136` + 
     0.00025847659591489983` I, -0.001623300348016125` + 
     0.0003674684922360431` I, 
    0.002561455035228608` + 
     0.0065343476170139` I}, {0.00038420480406961213` + 
     0.000019632560501338157` I, 
    0.0006154214640650449` + 0.00005058106279201534` I, 
    0.002561455035228608` + 
     0.0065343476170139` I, -0.0017814909478848769` + 
     0.00044757780189576285` I, 
    0.002561455035228608` + 0.0065343476170139` I, 
    0.0006154214640650449` + 
     0.00005058106279201534` I}}, {{0.0002623737383444928` + 
     6.526798372448609`*^-6 I, 
    0.00038469551764633357` + 0.00001404116826826714` I, 
    0.001701560346692065` + 
     0.00028186563718451556` I, -0.0036157861645215892` + 
     0.0014334932215780709` I, 
    0.001701560346692065` + 0.00028186563718451556` I, 
    0.00038469551764633357` + 
     0.00001404116826826714` I}, {0.00038469551764633357` + 
     0.00001404116826826714` I, 
    0.0006174506610746909` + 0.0000362484579179957` I, 
    0.004451276746846666` + 
     0.008110956245960126` I, -0.0018348493676154623` + 
     0.0003292738942473982` I, 
    0.004451276746846666` + 0.008110956245960126` I, 
    0.0006174506610746909` + 
     0.0000362484579179957` I}, {0.001701560346692065` + 
     0.00028186563718451556` I, 
    0.004451276746846666` + 
     0.008110956245960126` I, -0.0016630055874367914` + 
     0.0002688975828702291` I, -0.0013951809613295997` + 
     0.00018777972040581582` I, -0.0016630055874367914` + 
     0.0002688975828702291` I, 
    0.004451276746846666` + 
     0.008110956245960126` I}, {-0.0036157861645215892` + 
     0.0014334932215780709` I, -0.0018348493676154623` + 
     0.0003292738942473982` I, -0.0013951809613295997` + 
     0.00018777972040581582` I, -0.001649644339494305` + 
     0.0002644804933021536` I, -0.0013951809613295997` + 
     0.00018777972040581582` I, -0.0018348493676154623` + 
     0.0003292738942473982` I}, {0.001701560346692065` + 
     0.00028186563718451556` I, 
    0.004451276746846666` + 
     0.008110956245960126` I, -0.0016630055874367914` + 
     0.0002688975828702291` I, -0.0013951809613295997` + 
     0.00018777972040581582` I, -0.0016630055874367914` + 
     0.0002688975828702291` I, 
    0.004451276746846666` + 
     0.008110956245960126` I}, {0.00038469551764633357` + 
     0.00001404116826826714` I, 
    0.0006174506610746909` + 0.0000362484579179957` I, 
    0.004451276746846666` + 
     0.008110956245960126` I, -0.0018348493676154623` + 
     0.0003292738942473982` I, 
    0.004451276746846666` + 0.008110956245960126` I, 
    0.0006174506610746909` + 
     0.0000362484579179957` I}}, {{0.0002624776258373963` + 
     3.91762960408111`*^-6 I, 
    0.0003850233570115873` + 8.431880531526617`*^-6 I, 
    0.0017311505362949018` + 
     0.00017206037385286485` I, -0.00396002889556209` + 
     0.0009419817966131259` I, 
    0.0017311505362949018` + 0.00017206037385286485` I, 
    0.0003850233570115873` + 
     8.431880531526617`*^-6 I}, {0.0003850233570115873` + 
     8.431880531526617`*^-6 I, 
    0.0006188109096422206` + 0.000021796988130181255` I, 
    0.008759967672717668` + 
     0.009577258645143374` I, -0.0018722335690258528` + 
     0.00020158961790362473` I, 
    0.008759967672717668` + 0.009577258645143374` I, 
    0.0006188109096422206` + 
     0.000021796988130181255` I}, {0.0017311505362949018` + 
     0.00017206037385286485` I, 
    0.008759967672717668` + 
     0.009577258645143374` I, -0.001690572716150771` + 
     0.00016401300890634993` I, -0.001411251254850802` + 
     0.00011396558872435845` I, -0.001690572716150771` + 
     0.00016401300890634993` I, 
    0.008759967672717668` + 
     0.009577258645143374` I}, {-0.00396002889556209` + 
     0.0009419817966131259` I, -0.0018722335690258528` + 
     0.00020158961790362473` I, -0.001411251254850802` + 
     0.00011396558872435845` I, -0.0016765334634102971` + 
     0.00016127490762387608` I, -0.001411251254850802` + 
     0.00011396558872435845` I, -0.0018722335690258528` + 
     0.00020158961790362473` I}, {0.0017311505362949018` + 
     0.00017206037385286485` I, 
    0.008759967672717668` + 
     0.009577258645143374` I, -0.001690572716150771` + 
     0.00016401300890634993` I, -0.001411251254850802` + 
     0.00011396558872435845` I, -0.001690572716150771` + 
     0.00016401300890634993` I, 
    0.008759967672717668` + 
     0.009577258645143374` I}, {0.0003850233570115873` + 
     8.431880531526617`*^-6 I, 
    0.0006188109096422206` + 0.000021796988130181255` I, 
    0.008759967672717668` + 
     0.009577258645143374` I, -0.0018722335690258528` + 
     0.00020158961790362473` I, 
    0.008759967672717668` + 0.009577258645143374` I, 
    0.0006188109096422206` + 
     0.000021796988130181255` I}}, {{0.00026252960044082814` + 
     1.3061351183150884`*^-6 I, 
    0.0003851874863232472` + 2.8118249692047636`*^-6 I, 
    0.0017463349469716697` + 
     0.00005785652134203585` I, -0.004157959188081112` + 
     0.00032968798709373705` I, 
    0.0017463349469716697` + 0.00005785652134203585` I, 
    0.0003851874863232472` + 
     2.8118249692047636`*^-6 I}, {0.0003851874863232472` + 
     2.8118249692047636`*^-6 I, 
    0.000619493283882884` + 7.273674690776079`*^-6 I, 
    0.016976145815864447` + 
     0.006186664355796737` I, -0.0018915028135199792` + 
     0.00006788813385777198` I, 
    0.016976145815864447` + 0.006186664355796737` I, 
    0.000619493283882884` + 
     7.273674690776079`*^-6 I}, {0.0017463349469716697` + 
     0.00005785652134203585` I, 
    0.016976145815864447` + 
     0.006186664355796737` I, -0.0017047018737215145` + 
     0.00005512792221757807` I, -0.001419426034192462` + 
     0.00003820858099774897` I, -0.0017047018737215145` + 
     0.00005512792221757807` I, 
    0.016976145815864447` + 
     0.006186664355796737` I}, {-0.004157959188081112` + 
     0.00032968798709373705` I, -0.0018915028135199792` + 
     0.00006788813385777198` I, -0.001419426034192462` + 
     0.00003820858099774897` I, -0.0016903094450067579` + 
     0.000054200031503241506` I, -0.001419426034192462` + 
     0.00003820858099774897` I, -0.0018915028135199792` + 
     0.00006788813385777198` I}, {0.0017463349469716697` + 
     0.00005785652134203585` I, 
    0.016976145815864447` + 
     0.006186664355796737` I, -0.0017047018737215145` + 
     0.00005512792221757807` I, -0.001419426034192462` + 
     0.00003820858099774897` I, -0.0017047018737215145` + 
     0.00005512792221757807` I, 
    0.016976145815864447` + 
     0.006186664355796737` I}, {0.0003851874863232472` + 
     2.8118249692047636`*^-6 I, 
    0.000619493283882884` + 7.273674690776079`*^-6 I, 
    0.016976145815864447` + 
     0.006186664355796737` I, -0.0018915028135199792` + 
     0.00006788813385777198` I, 
    0.016976145815864447` + 0.006186664355796737` I, 
    0.000619493283882884` + 
     7.273674690776079`*^-6 I}}, {{0.00026252960044082814` - 
     1.3061351183150884`*^-6 I, 
    0.0003851874863232472` - 2.8118249692047636`*^-6 I, 
    0.0017463349469716697` - 
     0.00005785652134203585` I, -0.004157959188081112` - 
     0.00032968798709373705` I, 
    0.0017463349469716697` - 0.00005785652134203585` I, 
    0.0003851874863232472` - 
     2.8118249692047636`*^-6 I}, {0.0003851874863232472` - 
     2.8118249692047636`*^-6 I, 
    0.000619493283882884` - 7.273674690776079`*^-6 I, 
    0.016976145815864447` - 
     0.006186664355796737` I, -0.0018915028135199792` - 
     0.00006788813385777198` I, 
    0.016976145815864447` - 0.006186664355796737` I, 
    0.000619493283882884` - 
     7.273674690776079`*^-6 I}, {0.0017463349469716697` - 
     0.00005785652134203585` I, 
    0.016976145815864447` - 
     0.006186664355796737` I, -0.0017047018737215145` - 
     0.00005512792221757807` I, -0.001419426034192462` - 
     0.00003820858099774897` I, -0.0017047018737215145` - 
     0.00005512792221757807` I, 
    0.016976145815864447` - 
     0.006186664355796737` I}, {-0.004157959188081112` - 
     0.00032968798709373705` I, -0.0018915028135199792` - 
     0.00006788813385777198` I, -0.001419426034192462` - 
     0.00003820858099774897` I, -0.0016903094450067579` - 
     0.000054200031503241506` I, -0.001419426034192462` - 
     0.00003820858099774897` I, -0.0018915028135199792` - 
     0.00006788813385777198` I}, {0.0017463349469716697` - 
     0.00005785652134203585` I, 
    0.016976145815864447` - 
     0.006186664355796737` I, -0.0017047018737215145` - 
     0.00005512792221757807` I, -0.001419426034192462` - 
     0.00003820858099774897` I, -0.0017047018737215145` - 
     0.00005512792221757807` I, 
    0.016976145815864447` - 
     0.006186664355796737` I}, {0.0003851874863232472` - 
     2.8118249692047636`*^-6 I, 
    0.000619493283882884` - 7.273674690776079`*^-6 I, 
    0.016976145815864447` - 
     0.006186664355796737` I, -0.0018915028135199792` - 
     0.00006788813385777198` I, 
    0.016976145815864447` - 0.006186664355796737` I, 
    0.000619493283882884` - 
     7.273674690776079`*^-6 I}}, {{0.0002624776258373963` - 
     3.91762960408111`*^-6 I, 
    0.0003850233570115873` - 8.431880531526617`*^-6 I, 
    0.0017311505362949018` - 
     0.00017206037385286485` I, -0.00396002889556209` - 
     0.0009419817966131259` I, 
    0.0017311505362949018` - 0.00017206037385286485` I, 
    0.0003850233570115873` - 
     8.431880531526617`*^-6 I}, {0.0003850233570115873` - 
     8.431880531526617`*^-6 I, 
    0.0006188109096422206` - 0.000021796988130181255` I, 
    0.008759967672717668` - 
     0.009577258645143374` I, -0.0018722335690258528` - 
     0.00020158961790362473` I, 
    0.008759967672717668` - 0.009577258645143374` I, 
    0.0006188109096422206` - 
     0.000021796988130181255` I}, {0.0017311505362949018` - 
     0.00017206037385286485` I, 
    0.008759967672717668` - 
     0.009577258645143374` I, -0.001690572716150771` - 
     0.00016401300890634993` I, -0.001411251254850802` - 
     0.00011396558872435845` I, -0.001690572716150771` - 
     0.00016401300890634993` I, 
    0.008759967672717668` - 
     0.009577258645143374` I}, {-0.00396002889556209` - 
     0.0009419817966131259` I, -0.0018722335690258528` - 
     0.00020158961790362473` I, -0.001411251254850802` - 
     0.00011396558872435845` I, -0.0016765334634102971` - 
     0.00016127490762387608` I, -0.001411251254850802` - 
     0.00011396558872435845` I, -0.0018722335690258528` - 
     0.00020158961790362473` I}, {0.0017311505362949018` - 
     0.00017206037385286485` I, 
    0.008759967672717668` - 
     0.009577258645143374` I, -0.001690572716150771` - 
     0.00016401300890634993` I, -0.001411251254850802` - 
     0.00011396558872435845` I, -0.001690572716150771` - 
     0.00016401300890634993` I, 
    0.008759967672717668` - 
     0.009577258645143374` I}, {0.0003850233570115873` - 
     8.431880531526617`*^-6 I, 
    0.0006188109096422206` - 0.000021796988130181255` I, 
    0.008759967672717668` - 
     0.009577258645143374` I, -0.0018722335690258528` - 
     0.00020158961790362473` I, 
    0.008759967672717668` - 0.009577258645143374` I, 
    0.0006188109096422206` - 
     0.000021796988130181255` I}}, {{0.0002623737383444928` - 
     6.526798372448609`*^-6 I, 
    0.00038469551764633357` - 0.00001404116826826714` I, 
    0.001701560346692065` - 
     0.00028186563718451556` I, -0.0036157861645215892` - 
     0.0014334932215780709` I, 
    0.001701560346692065` - 0.00028186563718451556` I, 
    0.00038469551764633357` - 
     0.00001404116826826714` I}, {0.00038469551764633357` - 
     0.00001404116826826714` I, 
    0.0006174506610746909` - 0.0000362484579179957` I, 
    0.004451276746846666` - 
     0.008110956245960126` I, -0.0018348493676154623` - 
     0.0003292738942473982` I, 
    0.004451276746846666` - 0.008110956245960126` I, 
    0.0006174506610746909` - 
     0.0000362484579179957` I}, {0.001701560346692065` - 
     0.00028186563718451556` I, 
    0.004451276746846666` - 
     0.008110956245960126` I, -0.0016630055874367914` - 
     0.0002688975828702291` I, -0.0013951809613295997` - 
     0.00018777972040581582` I, -0.0016630055874367914` - 
     0.0002688975828702291` I, 
    0.004451276746846666` - 
     0.008110956245960126` I}, {-0.0036157861645215892` - 
     0.0014334932215780709` I, -0.0018348493676154623` - 
     0.0003292738942473982` I, -0.0013951809613295997` - 
     0.00018777972040581582` I, -0.001649644339494305` - 
     0.0002644804933021536` I, -0.0013951809613295997` - 
     0.00018777972040581582` I, -0.0018348493676154623` - 
     0.0003292738942473982` I}, {0.001701560346692065` - 
     0.00028186563718451556` I, 
    0.004451276746846666` - 
     0.008110956245960126` I, -0.0016630055874367914` - 
     0.0002688975828702291` I, -0.0013951809613295997` - 
     0.00018777972040581582` I, -0.0016630055874367914` - 
     0.0002688975828702291` I, 
    0.004451276746846666` - 
     0.008110956245960126` I}, {0.00038469551764633357` - 
     0.00001404116826826714` I, 
    0.0006174506610746909` - 0.0000362484579179957` I, 
    0.004451276746846666` - 
     0.008110956245960126` I, -0.0018348493676154623` - 
     0.0003292738942473982` I, 
    0.004451276746846666` - 0.008110956245960126` I, 
    0.0006174506610746909` - 
     0.0000362484579179957` I}}, {{0.00026221806120695063` - 
     9.132096056088802`*^-6 I, 
    0.00038420480406961213` - 0.000019632560501338157` I, 
    0.0016590243195173551` - 
     0.00038474728620012356` I, -0.0031986954042854928` - 
     0.0017753902359875918` I, 
    0.0016590243195173551` - 0.00038474728620012356` I, 
    0.00038420480406961213` - 
     0.000019632560501338157` I}, {0.00038420480406961213` - 
     0.000019632560501338157` I, 
    0.0006154214640650449` - 0.00005058106279201534` I, 
    0.002561455035228608` - 
     0.0065343476170139` I, -0.0017814909478848769` - 
     0.00044757780189576285` I, 
    0.002561455035228608` - 0.0065343476170139` I, 
    0.0006154214640650449` - 
     0.00005058106279201534` I}, {0.0016590243195173551` - 
     0.00038474728620012356` I, 
    0.002561455035228608` - 
     0.0065343476170139` I, -0.001623300348016125` - 
     0.0003674684922360431` I, -0.0013717502339991136` - 
     0.00025847659591489983` I, -0.001623300348016125` - 
     0.0003674684922360431` I, 
    0.002561455035228608` - 
     0.0065343476170139` I}, {-0.0031986954042854928` - 
     0.0017753902359875918` I, -0.0017814909478848769` - 
     0.00044757780189576285` I, -0.0013717502339991136` - 
     0.00025847659591489983` I, -0.0016108898926981722` - 
     0.0003615740196760342` I, -0.0013717502339991136` - 
     0.00025847659591489983` I, -0.0017814909478848769` - 
     0.00044757780189576285` I}, {0.0016590243195173551` - 
     0.00038474728620012356` I, 
    0.002561455035228608` - 
     0.0065343476170139` I, -0.001623300348016125` - 
     0.0003674684922360431` I, -0.0013717502339991136` - 
     0.00025847659591489983` I, -0.001623300348016125` - 
     0.0003674684922360431` I, 
    0.002561455035228608` - 
     0.0065343476170139` I}, {0.00038420480406961213` - 
     0.000019632560501338157` I, 
    0.0006154214640650449` - 0.00005058106279201534` I, 
    0.002561455035228608` - 
     0.0065343476170139` I, -0.0017814909478848769` - 
     0.00044757780189576285` I, 
    0.002561455035228608` - 0.0065343476170139` I, 
    0.0006154214640650449` - 0.00005058106279201534` I}}};

g = 1.5*1590/10; \[Beta] = 1./(8.617333262145 10^-2 70); niw=4; nk=6;

(* A good starting guess for FindRoot may be the initial step of an iterative solution*)
\[CapitalSigma]Arr = -(g^2/\[Beta]) ListConvolve[DqArr, 
    G0Arr, {{-1, 1, 1}, {1, 1, 
      1}}];(*Keeps track of the fact that mesh on indices 2,3 is periodic but \
mesh on 1 is not, so the range is diff from the domain*)
\[CapitalSigma]Arr = 
  CenterArray[\[CapitalSigma]Arr, G0Arr // Dimensions, 
   0. + 0. I];(*Pad with zeros on the tails of the first index to get same \
shape as G0Arr*)

SArr = Table[Subscript[S, n, kx, 
   ky], {n, -niw, niw - 1}, {kx, 0, 2 - 2/nk, 2/nk}, {ky, 0, 2 - 2/nk,
     2/nk}];
eqArr = (Flatten[(SArr + 
       CenterArray[
        g^2/\[Beta] ListConvolve[DqArr, 1./(
          1./G0Arr - SArr), {{-1, 1, 1}, {1, 1, 1}}], 
        G0Arr // Dimensions])] == 
    ConstantArray[0. + 0. I, 2 niw*nk^2]) // Thread;

FindRoot[eqArr, {Flatten[SArr], Flatten[\[CapitalSigma]Arr]} // 
  Transpose]
$\endgroup$
2
  • $\begingroup$ Works for me in 14.0 on Windows 10, resulting in {Subscript[S, -4, 0, 0] -> 0. + 0. I, Subscript[S, -4, 0, 1/3] -> 0. + 0. I,...,Subscript[S, -2, 0, 0] -> -17.7417 + 1.81377 I, Subscript[S, -2, 0, 1/3] -> -14.9386 + 1.45045 I, Subscript[S, -2, 0, 2/3] -> -18.9266 + 2.79704 I,...,Subscript[S, 3, 5/3, 4/3] -> 0. + 0. I, Subscript[S, 3, 5/3, 5/3] -> 0. + 0. I} with Timing in 1.84375s. $\endgroup$
    – user64494
    Commented Apr 2 at 14:22
  • $\begingroup$ @user64494 Thanks for confirming that the minimal working code does work on your system. The reason it takes 1.84s to solve this is because it has to solve 288 equations in 288 variables numerically, rather than 1 tensor equation in 1 tensor variable. The goal is to make it work without unpacking the tensor into a vector, so that optimized algorithms for tensor convolutions can speed up the solution drastically. $\endgroup$
    – Tamaghna
    Commented Apr 2 at 21:21

1 Answer 1

-1
$\begingroup$

The FindRoot function is used to numerically find a root of a system of equations. However, your usage of FindRoot seems to have some issues regarding the syntax and the way you're defining your equation.

Assuming you want to find the values of SArr and ΣArr that satisfy the equation you provided, you can define your equation first and then use FindRoot to find its roots.

Here's how you can do it:

eqn[SArr_?MatrixQ, ΣArr_?MatrixQ] := 
 SArr == CenterArray[-(g^2/β) ListConvolve[DqArr, 1./(1./G0Arr - SArr), {{-1, 1, 1}, {1, 1, 1}}], 
   Dimensions[G0Arr]]

initialGuess = {SArr0, ΣArr0}; (* Provide initial guess for SArr and ΣArr *)

solution = FindRoot[eqn[SArr, ΣArr], initialGuess]

Here's what each part of the code does:

  1. eqn[SArr, ΣArr] defines your equation. This function takes matrices SArr and ΣArr as inputs and returns the equation you provided.

  2. initialGuess provides an initial guess for the values of SArr and ΣArr. This should be a list of initial guesses for each variable.

  3. FindRoot[eqn[SArr, ΣArr], initialGuess] uses FindRoot to find the roots of the equation defined by eqn. It starts the search from the initial guess provided by initialGuess.

Replace SArr0 and ΣArr0 with your initial guesses for SArr and ΣArr, respectively.

Ensure that DqArr and G0Arr are properly defined before running this code. Also, make sure that the dimensions of DqArr and G0Arr match the expected dimensions in the convolution operation.

$\endgroup$
1
  • $\begingroup$ thanks for taking the time to engage with the problem. If I try your code with the sample arrays provided in the minimal working code, Mathematica throws the error "Value [CapitalSigma]Arr0 in search specification {SArr0,\ [CapitalSigma]Arr0} is not a number or array of numbers". Could you please try what you're suggesting at your end? The call to FindRoot you propose is strange because there is no way for Mathematica to know which variable to solve for. In any case, SArr was intended as the tensor to solve for, and ΣArr, the initial guess. $\endgroup$
    – Tamaghna
    Commented Apr 2 at 21:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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