MrMarc

3163 Reputation

18 Badges

17 years, 134 days

MaplePrimes Activity


These are replies submitted by MrMarc

acer you are the man!
I dont understand where you get everything from?!
This trick thing Optimization:-Convert:-AlgebraicForm:-LPToMatrix is not even in the help pages.

I am struggling on a daily basis (mostly with maple but there are other things to).
You seem to have found the magic-maple-knowledge-fountain. I bet a lot of hard work
is behind such a discovery.

You always have exellent answers, which I am very gratetful for.

acer you are the man!
I dont understand where you get everything from?!
This trick thing Optimization:-Convert:-AlgebraicForm:-LPToMatrix is not even in the help pages.

I am struggling on a daily basis (mostly with maple but there are other things to).
You seem to have found the magic-maple-knowledge-fountain. I bet a lot of hard work
is behind such a discovery.

You always have exellent answers, which I am very gratetful for.

So Pagan, could you please have a look at the two attached file.
The data is in the first file and the Maple caluclations in the second.

GARCH_Estimation_(Hu.xls

pagan.mw

I tried to do as you said but I still get an error message. How would you solve that?

So Pagan, could you please have a look at the two attached file.
The data is in the first file and the Maple caluclations in the second.

GARCH_Estimation_(Hu.xls

pagan.mw

I tried to do as you said but I still get an error message. How would you solve that?

ohhhh I forgot, Numerical formating by command.
I dont understand why you only can do it through the right click mouse meny.

@pagan If Maple automatically convert the problem into LP[matrix form] why cant
Maple show me the output of such matrix form conversion?

Then I could i) specify the LP in the usuall manner ii) have maple convert it
to matrix form iii) look at the output from such convertion  iiii) respecify the
problem as iii)

That would save a lot of headache. I know Maple has functions like
GenerateMatrix() but it is still difficult.

My main problem now is that Maple cant store dr and ur in floating point r-tables
hence I doubt that my problem can be solved even though if I specify it in the
usuall manner Maple manage to convert it to matrix form hence it should be
doable. I am confused.....

PS Speed is critical in this calculation, hence matrix form LP is important.

@pagan If Maple automatically convert the problem into LP[matrix form] why cant
Maple show me the output of such matrix form conversion?

Then I could i) specify the LP in the usuall manner ii) have maple convert it
to matrix form iii) look at the output from such convertion  iiii) respecify the
problem as iii)

That would save a lot of headache. I know Maple has functions like
GenerateMatrix() but it is still difficult.

My main problem now is that Maple cant store dr and ur in floating point r-tables
hence I doubt that my problem can be solved even though if I specify it in the
usuall manner Maple manage to convert it to matrix form hence it should be
doable. I am confused.....

PS Speed is critical in this calculation, hence matrix form LP is important.

I am grateful for your loyal support. I think that setting up a complex problem in
LP[Matrix Form] notation is extremly complicated. My brain really hurts. I just wish
that Maple did not separate between algebraic and matrix form ie if algebraic form
is entered then maple could convert it to matrix form and solve the problem
most efficiently. Now you have the option; Do you want to solve inefficiently
or efficiently? It does not really make any sense to give the user access to inefficiency.
Any how.......


This is as far as i got. I am having problems with the Aq,bq,Az,bz inequality constraints.
For Aq,bq I dont think I can reference z directly I have to do some transformation hummm
Also Aq.x>bq and Az.x>bz however by default Aq.x<bq and Az.x<bz, which is not what I
want. How can you get around that?

It would be nice to be able to show that both LP[algebraic form] and LP[matrix form]
produces the same results....



restart:
randomize():
with(Optimization):
with(Statistics):
with(LinearAlgebra):

N := 12:
W := Vector(N, symbol = w):
R := RandomMatrix(N, outputoptions = [datatype = float[8]]):
ER := Vector[column]([seq(ExpectedValue(Column(R, j)), j = 1 .. N)]):
S := Vector(N, fill = 1, datatype = float[8]):
z := Multiply(R, Matrix(W)):

con1 := Transpose(W).S = 1:
con2 := seq(w[i] >= 0, i = 1 .. N):
con3 := seq(w[i] <= 1, i = 1 .. N):
con4 := seq(z[i, 1] >= dr, i = 1 .. N):
con5 := expand(Transpose(W).ER) >= ur:

LPSolve(ur+dr, {con1, con2, con3, con4, con5}, maximize = true);

x := Vector(N+2, proc (i) options operator, arrow; `if`(i = 1, dr, `if`(i = 2, ur, w[i])) end proc):
c := Vector(N+2, proc (i) options operator, arrow; `if`(i = 1 or i = 2, 1.0, 0.) end proc):

Av := Matrix([[0, 0, seq(1, i = 1 .. N)]], datatype = float[8]):
bv := Vector([1], datatype = float[8]):

# problem constraints (linear inequality constraints)
Aq := Matrix([[0, 0, seq(z[i, 1], i = 1 .. N)]]):
bq := Vector([dr]):
Az := Matrix([[0, 0, seq(z[i, 1], i = 1 .. N)]]):
bz := Vector([ur]):

bl := Vector(N+2, proc (i) options operator, arrow; `if`(i = 1, -20, `if`(i = 2, -20, 0.)) end proc):
bu := Vector(N+2, proc (i) options operator, arrow; `if`(i = 1, 20, `if`(i = 2, 20, 1.0)) end proc):

LPSolve(c, [Av, bv, Aq, bq, Az, bz], [bl, bu], maximize = true);

I am grateful for your loyal support. I think that setting up a complex problem in
LP[Matrix Form] notation is extremly complicated. My brain really hurts. I just wish
that Maple did not separate between algebraic and matrix form ie if algebraic form
is entered then maple could convert it to matrix form and solve the problem
most efficiently. Now you have the option; Do you want to solve inefficiently
or efficiently? It does not really make any sense to give the user access to inefficiency.
Any how.......


This is as far as i got. I am having problems with the Aq,bq,Az,bz inequality constraints.
For Aq,bq I dont think I can reference z directly I have to do some transformation hummm
Also Aq.x>bq and Az.x>bz however by default Aq.x<bq and Az.x<bz, which is not what I
want. How can you get around that?

It would be nice to be able to show that both LP[algebraic form] and LP[matrix form]
produces the same results....



restart:
randomize():
with(Optimization):
with(Statistics):
with(LinearAlgebra):

N := 12:
W := Vector(N, symbol = w):
R := RandomMatrix(N, outputoptions = [datatype = float[8]]):
ER := Vector[column]([seq(ExpectedValue(Column(R, j)), j = 1 .. N)]):
S := Vector(N, fill = 1, datatype = float[8]):
z := Multiply(R, Matrix(W)):

con1 := Transpose(W).S = 1:
con2 := seq(w[i] >= 0, i = 1 .. N):
con3 := seq(w[i] <= 1, i = 1 .. N):
con4 := seq(z[i, 1] >= dr, i = 1 .. N):
con5 := expand(Transpose(W).ER) >= ur:

LPSolve(ur+dr, {con1, con2, con3, con4, con5}, maximize = true);

x := Vector(N+2, proc (i) options operator, arrow; `if`(i = 1, dr, `if`(i = 2, ur, w[i])) end proc):
c := Vector(N+2, proc (i) options operator, arrow; `if`(i = 1 or i = 2, 1.0, 0.) end proc):

Av := Matrix([[0, 0, seq(1, i = 1 .. N)]], datatype = float[8]):
bv := Vector([1], datatype = float[8]):

# problem constraints (linear inequality constraints)
Aq := Matrix([[0, 0, seq(z[i, 1], i = 1 .. N)]]):
bq := Vector([dr]):
Az := Matrix([[0, 0, seq(z[i, 1], i = 1 .. N)]]):
bz := Vector([ur]):

bl := Vector(N+2, proc (i) options operator, arrow; `if`(i = 1, -20, `if`(i = 2, -20, 0.)) end proc):
bu := Vector(N+2, proc (i) options operator, arrow; `if`(i = 1, 20, `if`(i = 2, 20, 1.0)) end proc):

LPSolve(c, [Av, bv, Aq, bq, Az, bz], [bl, bu], maximize = true);

@Pseudomodo You are absolutly correct! That is really really scarry !!

Imagining writing a journal publication, getting it published and then discover
that simple results like the regression output is wrong. You would look like
a complete idiot.

@pagan You are correct. I did some investigation on my own and found that u2 was the cause of the problem.
From there it was straightforward to figure out that all names such as Nobs, Ny, Nx was causing probelms.

As you said they have to appear like 'Nobs', 'Ny', 'Nx'   etc

All this lotto stuff was interesting however what I found the most interesting was
what you did with the buttons ie embedded components.

It was cool to select 6 buttons and then each selected button turned into an X
and you could make no more selections. 

You must have spend alot of time creating these applications. All I can say is well done!

Thank you for your valuable comments :-)

I meny called Maplet after "Help" where I can place shortcuts to my
created maplets. I dont understand why this has not be thought of before.
User customization is key

@Axel Vogt I thought you would never ask (not marriage) !

" Edited: I do not understand why the point ~ (1,1) is 'optimal' for you and
what is the meaning of the falling line"

We are interested in finding the minimum value of the portfolio y[1]+y[2]
on the 0.05 probability multivariate Quantile ie what is the maxium portfolio
loss on the 5% level. That point seams to be approx [-1,-1]. Note that:

i) I have not yet confirmed if y[1]+y[2] is constant on the 0.05 prob Quantile.
ii) if the optimal point indeed is y[1]=y[2]

Any suggestions on how we can find such point or any otherway of solving
the problem most appreciated

First 9 10 11 12 13 14 15 Last Page 11 of 33