0
|
5536 Views
|
4 Replies
|
0 Total Likes
View groups...
Share
GROUPS:

# Minimize is not doing its job....

Posted 11 years ago
 I'm trying to find the approximate solution of a system by using polynomials as an ansatz.Minimize does not seem to be doing its job.I'm trying to solve a nonlinear system by using its taylor expansion instead.Trying to find a minimum of an integral over time of RHS*RHS.  (* :: Package :: *)    gs=1;  rs=10.000000000000000;  vte=0.025864186384551461;  csat=1.0000000000000000*10^-014;  cktCKTgmin=9.9999999999999998*10^-013;  hereDIOtBrkdwnV=-0.65509939013317497;  hereDIOtDepCap=0.50000000000000000; modelDIOjunctionPot=1.0000000000000000; modelDIOgradingCoeff=0.50000000000000000; modelDIOtransitTime=9.9999999999999998*10^-013; modelDIOf2=0.35355339059327379; hereDIOtF1=0.58578643762690485; czero=2.0000000000000000*10^-012; modelDIOf3=0.25000000000000000; omega=2*Pi*10^6; (* t0=0; h=10^-8; *) smoothMax[tx_, tm_, ts_]:=tm + Log[1 + Exp[(tx - tm)*ts]]/ts  smoothMin[tx_, tm_, ts_]:=tm - Log[1 + Exp[(tm - tx)*ts]]/ts  glue[tx_, ts_]:=((Exp[tx*ts] - Exp[-tx*ts])/(Exp[tx*ts] + Exp[-tx*ts] + 1)+1)/2  current[VD_]:=(csat*(Exp[VD/vte] - (1)) + cktCKTgmin*VD)  charge1[VD1_]:=(czero*hereDIOtF1 + czero/modelDIOf2*(modelDIOf3*(VD1 - hereDIOtDepCap)+ (modelDIOgradingCoeff/(    modelDIOjunctionPot+ modelDIOjunctionPot))*(VD1*VD1 - hereDIOtDepCap*hereDIOtDepCap)))  charge0[VD0_]:=(modelDIOjunctionPot*czero*(1- Exp[(1 - modelDIOgradingCoeff)*Log[1 - VD0/modelDIOjunctionPot]]) /(1 - modelDIOgradingCoeff))  charge2[x_]:=glue[-(x - hereDIOtDepCap), gs]*charge0[smoothMin[x, hereDIOtDepCap, gs]]+ glue[x - hereDIOtDepCap, gs]*charge1[smoothMax[x, hereDIOtDepCap, gs]]  charge3[current_]:=(modelDIOtransitTime*current)  charge[VD_]:=charge3[current[VD]] + charge2[VD]  chargecurrent[v2_, v2t_]:=(D[charge[v22], v22]/.v22->v2)*v2t  v[t_, omega_]:=Sin[omega*t]/2  rest11[t_, i1_, v1_, v2_, v2t_, omega_, current1_, chargecurrent1_, v_]:=(i1 - (v1 - v2)/rs)^2+ (v - v1)^2+ ((v1 - v2)/rs - current1 - chargecurrent1)^2  i1[t_, t0_, a1_, b1_, c1_, d1_]:=a1+b1*(t-t0) + c1*(t - t0)^2 + d1*(t - t0)^3  v1[t_, t0_, a2_, b2_, c2_, d2_]:=a2+b2*(t-t0) + c2*(t - t0)^2 + d2*(t - t0)^3  v2[t_, t0_, a3_, b3_, c3_, d3_]:=a3+b3*(t-t0) + c3*(t - t0)^2 + d3*(t - t0)^3  v2t[t_, t0_, a3_, b3_, c3_, d3_]:=D[v2[tt, t0, a3, b3, c3, d3], tt]/.tt->t rest22[t_, t0_, a1_, b1_, c1_, d1_, a2_, b2_, c2_, d2_, a3_, b3_, c3_, d3_, omega_]:=rest11[     t,      i1[t, t0, a1, b1, c1, d1],     v1[t, t0, a2, b2, c2, d2],     v2[t, t0, a3, b3, c3, d3],     v2t[t, t0, a3, b3, c3, d3],      omega,     current[         v2[t, t0, a3, b3, c3, d3]     ],     chargecurrent[v2[t, t0, a3, b3, c3, d3], v2t[t, t0, a3, b3, c3, d3]],      v[t, omega] ] SERIES1[a1_, b1_, c1_, d1_, a2_, b2_, c2_, d2_, a3_, b3_, c3_, d3_, t1_, h_]:=Integrate[     Series[         rest22[t, t1, a1, b1, c1, d1, a2, b2, c2, d2, a3, b3, c3, d3, omega],         {t, t1, 8}],     {t, t1, t1 + h}]; Print["start"]; h=10^-8; a1=0; b1=0; c1=0; d1=0; a2=0; b2=0; c2=0; d2=0; a3=0; b3=0; c3=0; d3=0; For[t1=0.0, t1 < 10^-5, t1 = t1 + h, (*     result=FindMinimum[         SERIES1[a1, b11, c11, d11, a2, b21, c21, d21, a3, b31, c31, d31, t1, h]/h,         {{b11, b1}, {c11, c1}, {d11, d1}, {b21, b2}, {c21, c2}, {d21, d2}, {b31, b3}, {c31, c3}, {d31, d3}}     ]; *)     result=Minimize[         SERIES1[a1, b11, c11, d11, a2, b21, c21, d21, a3, b31, c31, d31, t1, h]/h,         {b11, c11, d11, b21, c21, d21, b31, c31, d31}     ];     Print[result];     b1=Last[result[[2]][[1]]];     c1=Last[result[[2]][[2]]];     d1=Last[result[[2]][[3]]];    b2=Last[result[[2]][[4]]];    c2=Last[result[[2]][[5]]];    d2=Last[result[[2]][[6]]];    b3=Last[result[[2]][[7]]];    c3=Last[result[[2]][[8]]];    d3=Last[result[[2]][[9]]];(*    Print["t1=", t1];    Print[",a1=", a1, ",b1=", b1, ",c1=", c1, ",d1=", d1];    Print[",a2=", a2, ",b2=", b2, ",c2=", c2, ",d2=", d2];    Print[",a3=", a3, ",b3=", b3, ",c3=", c3, ",d3=", d3];    Plot[i1[t, t1, a1, b1, c1, d1], {t, t1, t1+h}];*)    a1=a1 + b1*h + c1*h^2 + d1*h^3;    a2=a2 + b2*h + c2*h^2 + d2*h^3;    a3=a3 + b3*h + c3*h^2 + d3*h^3;];
4 Replies
Sort By:
Posted 11 years ago
 For me NMinimize converged nicely to ~0.0045 after only five iterations, as long as t1 remains fixed at 10^-7 rather than growing larger each step, as in what is happening here in t1 = t1 + h.
Posted 11 years ago
 For future reference, you might want to put your Mathematica code in an MCode box (see the right most red symbol on the second line of the message entry box).  Also, clarify what you mean by "not doing its job" perhaps giving us the output you are getting when you run your code and what you expected to get.
Posted 11 years ago
 It seems that your website here has problems with IE10 -- the MCode box is not working. Minimize does not change any of the parameters after the first execution of the loop body. The result of the function is getting bigger and bigger.
Posted 11 years ago
 Thanks for the feedback. We're currently battling some issues with Internet Explorer compatibility, so we recommend using Firefox or Chrome in the interim. We hope to have full IE10 support soon. We also would recommend boiling down your code to a smaller size with an essential issue. You will have more chance of users helping you then. Not many people can invest time going through a lengthy code.