kvams

100 Reputation

3 Badges

17 years, 215 days

MaplePrimes Activity


These are answers submitted by kvams

Alright, here it is. I am interested in those E1 and E2 that maximize EH2 given that both x1star and x2star are positive. What I've done is to remove the 'max' expressions in EH2 and used 'optimization:-maximize', then compared back to EH2 to make sure that the positivity constraints enforced by 'max' are a problem. I've defined the result from the optimization as 'undefined' if the test is negative.

 

As I said, any help is appreciated.

 

Download 6874_mapleprimes-opt-prob.mws
View file details

Ok, I figured that I did not need to construct unique names to each pointplot with a complicated use of strings and stuff. I just simply let plottest:=pointplot(...), and keep a list of the plots; plotlist:=[op(plotlist),plottest]. Then I can just display the plotlist in the end. Thanks anyway.

S.

Hi again.

Since it gets tedious to copy and paste and edit a lot of values for each new configuration to get different plots, I would like to construct a procedure that plots the parametric plot above together with markers at given values of the parameter. That is, I want to generalize the first suggestion above to an arbitrary number of pointplots. I have an idea of how to do it. However, is there a way to automatically assign different names to the different pointplots in 'ends' above? (Defining it as above did not work for me, I had to split it up into different plot structures, e.g. ends1 and ends2). My only idea is to predefine a list of symbols (e.g. the alphabet), and letting the procedure give each new necessary pointplot (one for each parameter given) a unique name a la StringTools[Join]("plot",symbollist(i)). This is maybe not eniterly clear. In pseudo-pseudo-code, this would look something like

plotproc := proc(parameters,range,points)

local test,i,j,string,strings,stringlist

stringlist:=["a","b"...]

j=1

test:=OPT(parameters)

plot0:=plot([test[1]test[2],t=range)

for i in points do string:=StringTools[Join]("plot",stringlist(j))

strings:=[op(strings),string]

string:=plots[pointplot](eval(OPT(parameters),t=i), color=f(i), symbolsize=20)

j=j+1

end do

plots[display](plot0,op(strings))

end proc

 

Is this even possible? Another thing, I want the points singled out by the pointplots to have different colors; do I have to predefine a list of colors as well (in the same fashion as the symbol list), or is there a way to just run through the available colors predefined by Maple?

This became kinda long, I'm sorry. Any help is appreciated!

S.

I am grateful, Mr. Israel, for your quick reply.

S.

I really appreciate your willingness to help! Download 6874_tedprimes.mws
View file details I want to know when EH2(...) is bigger than EH0(...). The parameters should be positive, and typically in the range 0..2. E1 and E2 are choice parameters, should also be positive. Further, I am only interested in the cases where the constraints implied by the max-functions are non-binding. Also, the E1 and E2's that maximize EH2(...) would be of interest. The code is a mess, I'm sorry. But you asked for it. Btw. the plot above is generated from plotting EH2 and EH0 with all parameters set to .5 apart from r=1, and E1 and E2 equal to .5 +/- delta*alpha, respectively, where delta and alpha are allowed to vary. Sturla
Thanks for taking the time, guys. Right now, I'm pursuing a different approach, as I'm interested in an analytical solution, or at least to give some characterization of the blue area in general terms. The plot has been generated by assigning values to most parameters, yes. I hoped that I at least could determine or characterize the blue area in terms of some of the key variables. A follow-up: I thought heavyside and max was implicitly equivalent to piecewise? Thanks again, Sturla
Another version of the above problem produces a strange phenomenom. With the objective Vq := (E,a) -> evalf(Int(1/2*q*E*(1-q*E)*(q/2)^(-1+a)*(1-q/2)^(-1+a)/Beta(a,a),q = 0 .. 1/E,digits=10)); and the optimization procedure OptEq:=proc(a) global Vq; local result; result := Optimization[Maximize]('Vq'(E,a),E=0..2); if type(result,list) and type(rhs(op(op(2,result))),numeric) then result := rhs(op(op(2,result))); else result := undefined; end if; end proc: it returns the (probably) correct solution whenever 'a' in 'OptEq(a)' is even(!). If 'a' is odd, the procedure returns very small solutions, and if 'a' is not an integer, the procedure fails to produce anything. I think I've modified the procedure correctly. I've tried to exclude very small solutions by letting it search in, e.g., the region E=0.05..2 instead, but then it returns solutions typically epsilon above .05. I presumed the problems was so similar in nature that this should work. Was I wrong? Any help is appreciated! Sturla
No, that was not what I meant. I mean a situation where the two (or several) functions to be plotted takes values on different scales, e.g. p1:=plot(100*x,x=0..1): p2:=plot(x^2,x=0..1): plots[display](p1,p2); Note that both functions have the same 'preimage' (0..1). This is not necessary, but in most cases, they do at least overlap. The 'image' is, however, that of interest, here on the two different scales 0..100 and 0..1. In the example, it is hard to figure out what's going on in 'p2', where the values taken are very small compared to those in 'p1'. I'm hoping to display functions on two different (and independent) scales in the same diagram, preferably with a 'value axis' on both sides of the diagram. This technique/trick should be well-known to most of those reading applied research papers of some technical level. I'm sorry for the confusion. Sturla
Thanks acer, it worked out great! Sturla
Something went wrong with my post. Here it is: How do I plot the solutionpoint from an optimization as a function of a parameter in an effective way? The problem I'm struggeling with is the following. I'm interested in the optimal E of V := (E,a) -> int(-1/2*E*(-r+E)/r*((1/2*r)^(-1+a)*(1-1/2*r)^(-1+a)/Beta(a,a)),r = E .. 2); for any given a, where E=0..2. I can usually solve this by defining OptE:=a->Optimization[Maximize](V(E,a)); (NOTE: I had to remove the boundaries on E in the expression above such that ut would display correctly on the web-page, I'm sorry, I don't understand what went wrong. However, I'm not able to plot the optimal E's as a function of a. (Is it possible to solve this analytically?) I've tried to do the following, without sucess. Estar:=a->Optimization[Maximize](V(E,a),output=solutionmodule); Estarsol:=a->rhs(Estar(a):-Results(solutionpoint)[1]); Thanks, Sturla
Page 1 of 1