Message Boards Message Boards

4 Replies
0 Total Likes
View groups...
Share this post:

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 :: *)
 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]]
 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[
     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],
         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[
         rest22[t, t1, a1, b1, c1, d1, a2, b2, c2, d2, a3, b3, c3, d3, omega],
         {t, t1, 8}],
     {t, t1, t1 + h}];
 For[t1=0.0, t1 < 10^-5, t1 = t1 + h,
         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}}
         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["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;
POSTED BY: Peter Foelsche
4 Replies
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.
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 BY: Peter Foelsche
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.
POSTED BY: Moderation Team
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract