LeeHoYeung

Mr. Ho Yeung Lee

535 Reputation

10 Badges

12 years, 240 days

Social Networks and Content at Maplesoft.com

Seldom to ask question after retired math hobby Welcome August, February, July, May born girl And waited for her email to mavio@protonmail.com

MaplePrimes Activity


These are questions asked by LeeHoYeung

want to export to excel to file from matrix

Error, (in FindLambda) invalid input: `convert/Array` expects its 1st argument, A, to be of type {Array, Matrix, Vector, array, list, listlist}, but received csvfile
csvfile = Matrix(30,7);

print(close3(t+i), rhs(Sol5[1][1]), ratioA, oddsratio, oddsratioSimUp, oddsratioSimDown,1);
csvfile[i+1,1] := close3(t+i);
csvfile[i+1,2] := rhs(Sol5[1][1]);
csvfile[i+1,3] := ratioA;
csvfile[i+1,4] := oddsratio;
csvfile[i+1,5] := oddsratioSimUp;
csvfile[i+1,6] := oddsratioSimDown;
csvfile[i+1,7] := 1;

29.95, 0.03355620525, 0.7651906074, 0.6000000000, 0.5294117647,

0.5714285714, 0
-8
29.95, 0.03361194645, 1.750709592 10 , 0.4444444444,

0.5000000000, 0.6000000000, 0
5
29.6, 0.03432592221, 1.013882143 10 , 0.6000000000, 0.4444444444,

0.6923076923, 1
29.55, 0.03447081290, -0.000009845029875, 0.7142857143,

0.6000000000, 0.5000000000, 0
29.8, 0.03403562903, 30660.46200, 0.5294117647, 0.4117647059,

0.7142857143, 0
30.4, 0.03327345914, -0.5761838946, 0.6000000000, 0.5714285714,

0.5294117647, 0
30.3, 0.03376575281, 6.256895964, 0.5000000000, 0.6000000000,

0.5000000000, 0
30.95, 0.03231017771, 0.5328449644, 0.6000000000, 0.6000000000,

0.5000000000, 0
31.1, 0.03104289658, -26.93771895, 0.5000000000, 0.5000000000,

0.6000000000, 0
29.2, 0.03366016138, -0.08555779615, 0.4444444444, 0.5000000000,

0.6000000000, 0
28.95, 0.03415453360, 0.4007940838, 0.6000000000, 0.4444444444,

0.6923076923, 0
28.3, 0.03605364033, 0.00001875789432, 0.3750000000,

0.6000000000, 0.5000000000, 0
28.75, 0.03523629490, 0.9740829247, 0.4117647059, 0.7333333333,

0.3750000000, 1
5
29.2, 0.03415861325, -6.244828641 10 , 0.6000000000,

0.7142857143, 0.4117647059, 1
28.8, 0.03514419367, -0.1430744128, 0.06666666667, 0.6000000000,

0.5000000000, 0
29.4, 0.03352191217, 0.1495513336, 0.5000000000, 1.000000000,

0.06666666667, 0
28.95, 0.03433350933, 2.034565984, 0.5000000000, 0.5000000000,

0.6000000000, 0
28.85, 0.03394117064, 16.52857996, 0.7142857143, 0.5000000000,

0.6000000000, 0
28.5, 0.03419513697, -67.32086106, 0.6000000000, 0.7142857143,

0.4117647059, 0
-8
27.05, 0.03748108008, -3.316856585 10 , 0.6000000000,

0.6000000000, 0.5000000000, 0
27.7, 0.03561234996, 0.9992012832, 0.5000000000, 0.5000000000,

0.6000000000, 1
7
27.25, 0.03636057571, -1.891574002 10 , 0.5000000000,

0.5000000000, 0.6000000000, 1
27.0, 0.03696844993, 1.002386970, 0.03225806452, 0.5000000000,

0.6000000000, 0
-8
26.85, 0.03745201461, -5.221638895 10 , 1.000000000,

0.03225806452, 0, 0
26.85, 0.03734798123, 1.050118943, 0.5000000000, 0.06666666667,

1.000000000, 1

in maple 12 or 15

assume 

result := Vector(10);

for i from 1 to 10 do

        result[i] := i;

od;

how to plot it against i?

after tried plot(result(x), x=1..10);

How to identify whether biased game is changed based on the latest toss from a sequence

can HMM identify this?

for example

if

fair fair fair biased biased fair fair biased

http://www.math.uni-frankfurt.de/~numerik/maplestoch/

read "D:/diffalg03/stochastic9";
Sigma := `<,>`(`<|>`(1.0, .5), `<|>`(.5, 1.0));
V := WienerProcess(Sigma);
Z := t -> exp(a*t+b*V(t)[1]+c*V(t)[2]);
drift1 := simplify(Drift(Z(t))/Z(t));
diffusion1 := simplify(Diffusion(Z(t))/Z(t));
with(stochastic);
linearsde(drift1, diffusion1[1][1]);
Euler(x[1],drift1,diffusion1[1][1]);

1.what are a, b, and c?

2. how to convert SDE for monte carlo for this ito formula?

3. how to convert to euler scheme with this ito formula

 

very slow cause my computer have sound and overheat, still can not 

calculated result

%c := Old_Asso_eigenvector1, a := Old_Asso_eigenvector3,

%b := Old_Asso_eigenvector2

% b <= c, a <= c,

% a ^ c = a, a V c = c

% b ^ c = b, b V c = c

restart;
with(ExcelTools):
with(ListTools):
with(DynamicSystems):
filename := "1207.HK";
open3 := Import(cat(cat("C://Temp//HK//Coal//",filename),".xls"), filename, "B2:B100");
high3 := Import(cat(cat("C://Temp//HK//Coal//",filename),".xls"), filename, "C2:C100");
low3 := Import(cat(cat("C://Temp//HK//Coal//",filename),".xls"), filename, "D2:D100");
close3 := Import(cat(cat("C://Temp//HK//Coal//",filename),".xls"), filename, "E2:E100");
with(CurveFitting):
n := 31;
f := Vector(n);
f2 := Vector(n);
open2 := Vector(n);high2 := Vector(n);gain2 := Vector(n);algebra2 := Vector(n);creative2 := Vector(n);creative3 := Vector(n);
upper2 := Vector(n);lower2 := Vector(n);upperloweratio := Vector(n);
deltaopen2 := Vector(n); deltahigh2 := Vector(n); deltalow2 := Vector(n); deltaclose2 := Vector(n);
logn := Vector(n);
for i from 0 to n-4 do
open2[i+1] := PolynomialInterpolation([[0,open3[n-i][1]],[1,open3[n-(i+1)][1]],[2,open3[n-(i+2)][1]],[4,open3[n-(i+3)][1]]],t):
high2[i+1] := PolynomialInterpolation([[0,high3[n-i][1]],[1,high3[n-(i+1)][1]],[2,high3[n-(i+2)][1]],[4,high3[n-(i+3)][1]]],t):
low2[i+1] := PolynomialInterpolation([[0,low3[n-i][1]],[1,low3[n-(i+1)][1]],[2,low3[n-(i+2)][1]],[4,low3[n-(i+3)][1]]],t):
if (close3[i+1][1]/close3[i+2][1]-1) < 0 then
gain2[i+1] := -1*round(100*abs(close3[i+1][1]/close3[i+2][1]-1)):
else
gain2[i+1] := round(abs(100*(close3[i+1][1]/close3[i+2][1]-1))):
end if;
deltaclose2[i+1] := close3[i+1][1] - close3[i+2][1];
deltahigh2[i+1] := high3[i+1][1] - high3[i+2][1];
deltaopen2[i+1] := open3[i+1][1] - open3[i+2][1];
logn[i+1] := ln(close3[i+1][1]/close3[i+2][1]);
f[i+1] := (high2[i+1] - open2[i+1])/4*1.8:
f2[i+1] := (open2[i+1] - low2[i+1])/4*1.8:
creative2[i+1] := simplify(((((close3[i+1][1]-close3[i+2][1]) + x)^2 -(close3[i+1][1]-close3[i+2][1])^2))/x)-x;
creative3[i+1] := simplify(((((close3[i+1][1]-close3[i+2][1]) + x)^3 -(close3[i+1][1]-close3[i+2][1])^3))/x);
upper2[i+1] := high3[i+1]-close3[i+1];
lower2[i+1] := close3[i+1]-low3[i+1];
upperloweratio[i+1] := round((lower2[i+1]/upper2[i+1])[1]);
od;
with(LinearAlgebra):
HilbertConj := proc(Px,Py)
return MatrixMatrixMultiply(Px,Py);
end proc:
HilbertDisj := proc(Px,Py)
return Px+Py- MatrixMatrixMultiply(Px,Py);
end proc:

t:=1;
i := 0;
InputMatrix3 := Matrix([[xxx, close3(t+1+i) , close3(t+2+i)],
[close3(t+1+i) , close3(t+2+i),0],
[close3(t+2+i),0 , 0]]):
InputMatrix3b := Matrix([[close3(t+1+i), close3(t+2+i) , close3(t+3+i)],
[close3(t+2+i) , close3(t+3+i),0],
[close3(t+3+i),0 , 0]]):
InputMatrix3c := Matrix([[close3(t+2+i), close3(t+3+i) , close3(t+4+i)],
[close3(t+3+i) , close3(t+4+i),0],
[close3(t+4+i),0 , 0]]):
m := MatrixMatrixMultiply(Transpose(InputMatrix3), InputMatrix3);
eigenvalues1 := Eigenvalues(m);
sys1 := MatrixMatrixMultiply(m-Matrix([[eigenvalues1[1],0,0],[0,eigenvalues1[1],0],[0,0,eigenvalues1[1]]]), Matrix([[x],[y],[z]]));
%solve([sys1[1][1],sys1[2][1],sys1[3][1]], [x,y,z]);
sol1 := solve([sys1[1][1],sys1[2][1]], [x,y,z]);

sys2 := MatrixMatrixMultiply(m-Matrix([[eigenvalues1[2],0,0],[0,eigenvalues1[2],0],[0,0,eigenvalues1[2]]]), Matrix([[x],[y],[z]]));
%solve([sys2[1][1],sys2[2][1],sys2[3][1]], [x,y,z]);
sol2 := solve([sys2[1][1],sys2[2][1]], [x,y,z]);

sys3 := MatrixMatrixMultiply(m-Matrix([[eigenvalues1[3],0,0],[0,eigenvalues1[3],0],[0,0,eigenvalues1[3]]]), Matrix([[x],[y],[z]]));
%solve([sys3[1][1],sys3[2][1],sys3[3][1]], [x,y,z]);
sol3 := solve([sys3[1][1],sys3[2][1]], [x,y,z]);

Old_Asso_eigenvector1 := Matrix([[rhs(sol1[1][1]),rhs(sol2[1][1]),rhs(sol3[1][1])],[rhs(sol1[1][2]),rhs(sol2[1][2]),rhs(sol3[1][2])],[rhs(sol1[1][3]),rhs(sol2[1][3]),rhs(sol3[1][3])]]);
Old_Asso_eigenvector2 := Eigenvectors(MatrixMatrixMultiply(Transpose(InputMatrix3b), InputMatrix3b)):
Old_Asso_eigenvector3 := Eigenvectors(MatrixMatrixMultiply(Transpose(InputMatrix3c), InputMatrix3c)):

% b <= c, a <= c, c := Old_Asso_eigenvector1, a := Old_Asso_eigenvector3, b := Old_Asso_eigenvector2
testa := HilbertConj(Old_Asso_eigenvector3[2], Old_Asso_eigenvector1);
testb := HilbertDisj(Old_Asso_eigenvector3[2], Old_Asso_eigenvector1);
testc := HilbertConj(Old_Asso_eigenvector2[2], Old_Asso_eigenvector1);
testd := HilbertDisj(Old_Asso_eigenvector2[2], Old_Asso_eigenvector1);

sysa := testa[1][1] = Old_Asso_eigenvector3[2][1][1];
sysb := testb[1][1] = Old_Asso_eigenvector1[2][1][1];
sysc := testc[1][1] = Old_Asso_eigenvector2[2][1][1];
sysd := testd[1][1] = Old_Asso_eigenvector1[2][1][1];

solve(sysa, xxx);

First 92 93 94 95 96 97 98 Last Page 94 of 141