Re: how to remove $RecursionLimit::reclim: and $IterationLimit::itlim:
- To: mathgroup at smc.vnet.net
- Subject: [mg115398] Re: how to remove $RecursionLimit::reclim: and $IterationLimit::itlim:
- From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
- Date: Mon, 10 Jan 2011 02:36:47 -0500 (EST)
- References: <igbne1$hdh$1@smc.vnet.net>
As far as I can see your definition of conj doesn't include a stop condition so you always get infinite recursions Cheers -- Sjoerd On Jan 9, 8:17 am, tarun dutta <tarundut... at gmail.com> wrote: > Do[Print[n = 5; > q = 1; > Print["P= ", p, " Q=", q]; > d[n + 1] = 0; g[n + 1] = 0; > d[i_] = re[i] + I*im[i]; > g[i_] = ree[i] + I*imm[i]; > conj[a_] := ComplexExpand[Conjugate[a]] > f1 = Together[ > Sum[6*p*Sqrt[i + 1]*d[i]* > conj[d[i + 1]]*(Sum[ > Sqrt[i]*g[i]*conj[g[i - 1]], {i, 0, n}]) + > 6*p*Sqrt[i]*d[i]* > conj[d[i - 1]]*(Sum[ > Sqrt[i + 1]*g[i]*conj[g[i + 1]], {i, 0, n}]) + (-q= *i + > i (i - 1))* d[i]*conj[d[i]], {i, 0, n}]]; > f2 = Together[ > Sum[6*p*Sqrt[i + 1]*g[i]* > conj[g[i + 1]]*(Sum[ > Sqrt[i]*d[i]*conj[d[i - 1]], {i, 0, n}]), {i, 0, n}] + > Sum[6*p*Sqrt[i]*g[i]* > conj[g[i - 1]]*(Sum[ > Sqrt[i + 1]*d[i]*conj[d[i + 1]], {i, 0, n}]) + (-q*i = + > i (i - 1)) g[i]*conj[g[i]], {i, 0, n}]]; > f = Plus[f1, f2]; > c = Expand@ > ComplexExpand[ > Sum[d[i]*conj[d[i]] + g[i]*conj[g[i]], {i, 0, n}]] == 1; > v = Join[Array[re, n + 1, 0], Array[im, n + 1, 0], > Array[ree, n + 1, 0], Array[imm, n + 1, 0]]; > Timing[NMinimize[{f, c}, v, > Method -> {"RandomSearch", Method -> "InteriorPoint"}]]], {p, 0, > 2/10, 1/1000}] > (*table=Table[Block[{p=pi,q=qi},min=First[NMinimize[{f,c},v,Metho= d->{\ > "RandomSearch",Method->"InteriorPoint"}]]; > Print[p,Tab,q,Tab,min];{p,q,min}],{pi,0,2},{qi,0,2}];*) > > P= 0 Q=1 > > $RecursionLimit::reclim: Recursion depth of 256 exceeded. >> > > $RecursionLimit::reclim: Recursion depth of 256 exceeded. >> > > $RecursionLimit::reclim: Recursion depth of 256 exceeded. >> > > General::stop: Further output of $RecursionLimit::reclim will be > suppressed during this calculation. >> > > $IterationLimit::itlim: Iteration limit of 4096 exceeded. >> > > $IterationLimit::itlim: Iteration limit of 4096 exceeded. >> > > $IterationLimit::itlim: Iteration limit of 4096 exceeded. >> > > General::stop: Further output of $IterationLimit::itlim will be > suppressed during this calculation. >> > > my problem is that how will I remove this kind of error? > give some valuable insight > regards, > tarun