minimize_powell() stop at user requested maxiter or maxfev
minimize_powell() stop at user requested maxiter or maxfev

If the user sets maxiter, then don't stop when the default maxfev is
reached, and vice versa. Only use the defaults if neither maxiter or
maxfev has been set, or if the other has been set to np.inf.

Fixes #5966

matthewalbani/scipy,pyramania/scipy,matthewalbani/scipy,nmayorov/scipy,nonhermitian/scipy,mikebenfield/scipy,andyfaff/scipy,josephcslater/scipy,rgommers/scipy,argriffing/scipy,anntzer/scipy,argriffing/scipy,gfyoung/scipy,scipy/scipy,gdooper/scipy,anielsen001/scipy,sriki18/scipy,nmayorov/scipy,aeklant/scipy,behzadnouri/scipy,Eric89GXL/scipy,nmayorov/scipy,josephcslater/scipy,gdooper/scipy,vigna/scipy,pyramania/scipy,jor-/scipy,mdhaber/scipy,scipy/scipy,matthew-brett/scipy,perimosocordiae/scipy,kleskjr/scipy,zerothi/scipy,lhilt/scipy,dominicelse/scipy,grlee77/scipy,perimosocordiae/scipy,behzadnouri/scipy,zerothi/scipy,dominicelse/scipy,Stefan-Endres/scipy,endolith/scipy,tylerjereddy/scipy,maniteja123/scipy,perimosocordiae/scipy,befelix/scipy,andyfaff/scipy,maniteja123/scipy,person142/scipy,endolith/scipy,anielsen001/scipy,sriki18/scipy,ilayn/scipy,mdhaber/scipy,matthewalbani/scipy,andyfaff/scipy,aarchiba/scipy,rgommers/scipy,argriffing/scipy,aeklant/scipy,jor-/scipy,gertingold/scipy,arokem/scipy,jamestwebber/scipy,Stefan-Endres/scipy,zerothi/scipy,pizzathief/scipy,pizzathief/scipy,behzadnouri/scipy,lhilt/scipy,apbard/scipy,surhudm/scipy,arokem/scipy,tylerjereddy/scipy,gfyoung/scipy,befelix/scipy,anielsen001/scipy,sriki18/scipy,jakevdp/scipy,apbard/scipy,pyramania/scipy,lhilt/scipy,rgommers/scipy,person142/scipy,arokem/scipy,anntzer/scipy,argriffing/scipy,pschella/scipy,nonhermitian/scipy,Eric89GXL/scipy,pbrod/scipy,gertingold/scipy,pyramania/scipy,matthewalbani/scipy,pschella/scipy,mdhaber/scipy,dominicelse/scipy,jor-/scipy,kleskjr/scipy,scipy/scipy,kalvdans/scipy,arokem/scipy,jamestwebber/scipy,pyramania/scipy,bkendzior/scipy,tylerjereddy/scipy,behzadnouri/scipy,gdooper/scipy,matthew-brett/scipy,kalvdans/scipy,maniteja123/scipy,woodscn/scipy,endolith/scipy,scipy/scipy,behzadnouri/scipy,Newman101/scipy,e-q/scipy,pschella/scipy,ilayn/scipy,pbrod/scipy,bkendzior/scipy,tylerjereddy/scipy,pschella/scipy,matthew-brett/scipy,kalvdans/scipy,WarrenWeckesser/scipy,pschella/scipy,tylerjereddy/scipy,jamestwebber/scipy,bkendzior/scipy,vigna/scipy,apbard/scipy,haudren/scipy,gertingold/scipy,jakevdp/scipy,anntzer/scipy,kleskjr/scipy,anntzer/scipy,surhudm/scipy,behzadnouri/scipy,Eric89GXL/scipy,vigna/scipy,befelix/scipy,pbrod/scipy,anielsen001/scipy,haudren/scipy,josephcslater/scipy,haudren/scipy,apbard/scipy,e-q/scipy,grlee77/scipy,jjhelmus/scipy,jakevdp/scipy,person142/scipy,aarchiba/scipy,surhudm/scipy,befelix/scipy,bkendzior/scipy,mikebenfield/scipy,WarrenWeckesser/scipy,Stefan-Endres/scipy,gertingold/scipy,pbrod/scipy,matthew-brett/scipy,bkendzior/scipy,mikebenfield/scipy,sriki18/scipy,anntzer/scipy,mikebenfield/scipy,matthewalbani/scipy,Newman101/scipy,josephcslater/scipy,aeklant/scipy,woodscn/scipy,kalvdans/scipy,jamestwebber/scipy,jor-/scipy,scipy/scipy,WarrenWeckesser/scipy,Stefan-Endres/scipy,aeklant/scipy,perimosocordiae/scipy,aarchiba/scipy,e-q/scipy,mdhaber/scipy,endolith/scipy,aeklant/scipy,kleskjr/scipy,woodscn/scipy,kleskjr/scipy,jamestwebber/scipy,Eric89GXL/scipy,mdhaber/scipy,gfyoung/scipy,arokem/scipy,anntzer/scipy,andyfaff/scipy,sriki18/scipy,jjhelmus/scipy,dominicelse/scipy,josephcslater/scipy,lhilt/scipy,befelix/scipy,maniteja123/scipy,person142/scipy,nonhermitian/scipy,jjhelmus/scipy,ilayn/scipy,kalvdans/scipy,woodscn/scipy,anielsen001/scipy,andyfaff/scipy,pizzathief/scipy,argriffing/scipy,endolith/scipy,mikebenfield/scipy,pizzathief/scipy,Newman101/scipy,Newman101/scipy,rgommers/scipy,pbrod/scipy,haudren/scipy,perimosocordiae/scipy,ilayn/scipy,Stefan-Endres/scipy,rgommers/scipy,lhilt/scipy,argriffing/scipy,maniteja123/scipy,endolith/scipy,woodscn/scipy,WarrenWeckesser/scipy,dominicelse/scipy,aarchiba/scipy,gertingold/scipy,person142/scipy,WarrenWeckesser/scipy,nonhermitian/scipy,ilayn/scipy,nonhermitian/scipy,sriki18/scipy,surhudm/scipy,aarchiba/scipy,anielsen001/scipy,pbrod/scipy,vigna/scipy,grlee77/scipy,maniteja123/scipy,surhudm/scipy,ilayn/scipy,zerothi/scipy,zerothi/scipy,gfyoung/scipy,grlee77/scipy,Newman101/scipy,scipy/scipy,e-q/scipy,jakevdp/scipy,Newman101/scipy,WarrenWeckesser/scipy,gdooper/scipy,mdhaber/scipy,Stefan-Endres/scipy,perimosocordiae/scipy,kleskjr/scipy,e-q/scipy,gfyoung/scipy,jakevdp/scipy,vigna/scipy,surhudm/scipy,Eric89GXL/scipy,zerothi/scipy,gdooper/scipy,woodscn/scipy,andyfaff/scipy,apbard/scipy,nmayorov/scipy,jjhelmus/scipy,jjhelmus/scipy,pizzathief/scipy,jor-/scipy,nmayorov/scipy,haudren/scipy,grlee77/scipy,Eric89GXL/scipy,haudren/scipy,matthew-brett/scipy