acer

32303 Reputation

29 Badges

19 years, 306 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@Andiguys I realized (from work on another another of your recent Questions) that the piecewise objective presents some issues for some of ther Optimization nonlinear solvers (including the default method=sqp, which seems to need good behavior of the derivatives, which the piecewise objective might muddy...).

And (my earlier idea of) interpolating from your original mere four (4) Cv values turns out to be a bad idea, and altogether misses the piecewise effects.

I don't have time to analyze the objective symbolically (generically), but I've checked the following with a faster Optimization method as well as with a forced DirectSearch global optimizer at all points. The plots agree  (and you can experiment with the attachment).

Question_plot_cv_ac2CC.mw

I've used a dual-axis 2D plot, to present better the two curves on their different scales.

 


ps. I've also re-done the contour plots (3D and 2D).

This sounds like something for which you might wish to contact to Maplesoft Tech Support.

I have deleted another Question, which duplicated very closely one problematic part of this Question's attachment.

Duplicate Question threads get tagged as such, and may be flagged and deleted.

Please don't post such close followup queries (or repeats, or even additional followup details) in wholly separate new Question threads. Instead, you could put the repeat/followup in a Reply/Comment here.

My Answer below does show (in more than one way) some approaches for getting around the "no improved point could be found" error message for your kind of piecewise objective. I suggest that you study it, then get back to us (here) if you are unable to resolve it.

@Andiguys 

1) A very simple change to the evalf[2] calls in the textplot parts of the ContoursWithLabels procedure allows for your choice of decimal places. You could change it to evalf[4], say. I think you could have figured that out. Or it could be made into a new option to the proc, as I've done in the attachment below.
2) You can simply call plot3d on it. I think you could have figured that out (especially since I did that in an earlier Reply above).

Question_plot_cv_ac2B.mw

@vv For L=9 the following takes about 7sec for me,

[seq](radnormal(expand(p(radnormal(expand(evstheory[i]))))), i = 1 .. L^2)

@C_R The use of multiple cores is not the cause of this problem, and setting it to 1 is not a fix for it (except in the chance circumstance that it might tweak memory addresses enough to alter a memory-address session-dependent intermediate result, which would be no kind of reliable fix even if you got lucky on different runs).

One could as easily bump memory-addresses by doing some wild intermediate symbolic computation, and change on which runs the problem did or did not occur.

It seems that someone has removed the worksheet from this Question.

This makes it more difficult for others to use the example to investigate the problematic example, submit it as a bug report, and so on.

If someone did this deliberately, then please don't do that kind of thing in future. Doing so would be needlessly inconsiderate,

Please just add followup point-release notices as Replies to your original Post on this topic, or Branch from the original, rather than submit a wholly separate new Post on it.

A newe Reply/Comment bumps the original to the top of the active feeds, indicating some change to be read.

@salim-barzani 

restart

sol3 := (2*(2*k[2]^2*p[2]^2/p[1]^2+2*k[2]^2))/((-x*k[2]*p[2]/p[1]+y*p[1])^2+(x*k[2]+y*p[2])^2+a[0])-2*(-(2*(-x*k[2]*p[2]/p[1]+y*p[1]))*k[2]*p[2]/p[1]+(2*(x*k[2]+y*p[2]))*k[2])^2/((-x*k[2]*p[2]/p[1]+y*p[1])^2+(x*k[2]+y*p[2])^2+a[0])^2

P :=   [  a[0]=1.2, k[2]=0.8, p[1]=-0.8, p[2]=0.4]:

solnum :=subs(P, sol3);

3.200000000/((.4000000000*x-.8*y)^2+(.8*x+.4*y)^2+1.2)-5.120000000*x^2/((.4000000000*x-.8*y)^2+(.8*x+.4*y)^2+1.2)^2

plots:-contourplot(solnum, x = -5 .. 9, y = -10 .. 10,
                   grid = [151, 151], view=[-5 .. 9, -10 .. 10],
                   contourlabels=false, colorbar = false,
                   labels=[x,y],
                   coloring=["Red","Green"],
                   contours = [-0.25, -0.15, 0.006, 0.035, -0.03, 0.2,
                               0.4, 0.6, 1, 1.25, 1.5, 1.75, 2, 2.25, 2.3, 2.4, 2.5])

plots:-contourplot(solnum, x = -5 .. 9, y = -10 .. 10,
                   grid = [151, 151], view=[-5 .. 9, -10 .. 10],
                   contourlabels=false, colorbar = false,
                   labels=[x,y], filled,
                   filled,
                   contours = [-0.25, -0.15, 0.006, 0.035, -0.03, 0.2,
                               0.4, 0.6, 1, 1.25, 1.5, 1.75, 2, 2.25, 2.3, 2.4, 2.5])

 

 

 

Download graph-density-countour_ac2.mw

You should explain clearly what you are trying to obtain.

Your attempted syntax of,
   map(contour,solnum)
and
  map(density,solnum)
do not make sense.

Are you trying to get 3D or 2D plots?

If 3D, then what exactly do you mean by "density"?

@Andiguys Is it reasonable that delta might be always equal to 1, at the optima?

If the difference in scale between your plots is much greater than the variation within them then they may appear like boring straight lines when plotted together. Would you be ok with a dualaxis plot, in such a case?

What happens if you use Grid:-Map?

@segfault Great, if you have it working.

If the value of Var2 is "b", which is a string, then are you sure you wouldn't rather use %s insted of %a. (see notes above)

Here's a shorter example. The abs(1,k) subterm comes from the earlier diff call, regardless of assumptions. This kind of term forms (only) part of your expression.

temp := BesselK(0, k)*abs(1, k);

BesselK(0, k)*abs(1, k)

T1 := Im(temp);

Im(BesselK(0, k))

T2 := Im(temp) assuming k::real;

signum(k)*Im(BesselK(0, k))

eval([T1,T2], k=-1.0);

[-3.977463261, 3.977463261]


Download question_reim_short.mw

@dharr "Learn from this." should get more votes that I can give.

First 15 16 17 18 19 20 21 Last Page 17 of 591