Re: Determining the root of the characteristic equation for time
- To: mathgroup at smc.vnet.net
- Subject: [mg113472] Re: Determining the root of the characteristic equation for time
- From: "Nasser M. Abbasi" <nma at 12000.org>
- Date: Sat, 30 Oct 2010 04:37:14 -0400 (EDT)
- References: <iae7h3$7g9$1@smc.vnet.net> <4CCAA5F6.1000808@12000.org> <AANLkTimFd7SjjZos6btMCK3Zwfy-UfVwkS0YeneQDsZ6@mail.gmail.com>
- Reply-to: nma at 12000.org
On 10/29/2010 8:06 AM, Christofer Bogaso wrote: > Dear Nasser, > > Thank you so much for your help. Here I was trying with my own example: > > Alpha1 = {{0.07}, {0.17}}; > Beta1 = {{1, -4}}; > Gamma11 = {{0.24, -0.08}, {0, -0.31}}; > Gamma12 = {{0, -0.13}, {0, -0.37}}; > Gamma13 = {{0.20, -0.06}, {0, -0.34}}; > PI1 = Alpha1.Beta1; > A1 = IdentityMatrix[2] + PI1 + Gamma11; > A2 = Gamma12 - Gamma11; > A3 = Gamma13 - Gamma12; > A4 = -1*Gamma13; > Clear[z]; > Abs[Solve[Det[IdentityMatrix[2] - A1*z - A2*(z^2) - A2*(z^3) - A2*(z^4)] > ==0, z]] > > While I executing the last line, I got strage figures (please see the > attachment on my workings): > May be changing the last line above with the following is what you meant to do? Abs[z/.Solve[Det[IdentityMatrix[2]-A1*z-A2*(z^2)-A2*(z^3)-A2*(z^4)]==0,z]] > \!\({{Abs[z -> Root[\(-1.`\) + 1.63`\ #1 + > 0.31`\ -0\ #1 - 0.7068`\ #1\^2 - 0.3325`\ -0\ #1\^2 - \ > 0.1632`\ #1\^3 + 0.0643`\ -0\ #1\^3 - 0.1632`\ #1\^4 + > 0.07869999999999999`\ -0\ #1\^4 + 0.07679999999999998`\ > #1\^5 \ > + 0.033099999999999984`\ -0\ #1\^5 + 0.0432`\ -0\ #1\^6 + 0.0288`\ -0\ #1\^7 > \ > + 0.0144`\ -0\ #1\^8&, 1]]}, {Abs[z -> Root[\(-1.`\) + 1.63`\ #1 + 0.31`\ > -0\ > \ #1 - 0.7068`\ #1\^2 - 0.3325`\ -0\ #1\^2 - 0.1632`\ #1\^3 + 0.0643`\ -0\ > #1\ > \^3 - 0.1632`\ #1\^4 + 0.07869999999999999`\ -0\ #1\^4 + > 0.07679999999999998`\ #1\^5 + 0.033099999999999984`\ -0\ \ > #1\^5 + 0.0432`\ -0\ #1\^6 + 0.0288`\ -0\ #1\^7 + 0.0144`\ -0\ #1\^8&, > 2]]}, {Abs[ > z -> Root[\(-1.`\) + 1.63`\ #1 + > 0.31`\ -0\ #1 - 0.7068`\ #1\^2 - 0.3325`\ -0\ #1\^2 - \ > 0.1632`\ #1\^3 + 0.0643`\ -0\ #1\^3 - 0.1632`\ #1\^4 + > 0.07869999999999999`\ -0\ #1\^4 + 0.07679999999999998`\ > #1\^5 \ > + 0.033099999999999984`\ -0\ #1\^5 + 0.0432`\ -0\ #1\^6 + 0.0288`\ -0\ #1\^7 > \ > + 0.0144`\ -0\ #1\^8&, 3]]}, {Abs[z -> Root[\(-1.`\) + 1.63`\ #1 + 0.31`\ > -0\ > \ #1 - 0.7068`\ #1\^2 - 0.3325`\ -0\ #1\^2 - 0.1632`\ #1\^3 + > 0.0643`\ -0\ #1\^3 - 0.1632`\ #1\^4 + > 0.07869999999999999`\ -0\ #1\^4 + 0.07679999999999998`\ > #1\^5 \ > + 0.033099999999999984`\ -0\ #1\^5 + 0.0432`\ -0\ #1\^6 + 0.0288`\ -0\ #1\^7 > \ > + 0.0144`\ -0\ #1\^8&, 4]]}, {Abs[z -> Root[\(-1.`\) + 1.63`\ #1 + 0.31`\ > -0\ > \ #1 - 0.7068`\ #1\^2 - 0.3325`\ -0\ #1\^2 - 0.1632`\ #1\^3 + 0.0643`\ -0\ > #1\ > \^3 - 0.1632`\ #1\^4 + > 0.07869999999999999`\ -0\ #1\^4 + 0.07679999999999998`\ > #1\^5 \ > + 0.033099999999999984`\ -0\ #1\^5 + 0.0432`\ > -0\ #1\^6 + 0.0288`\ > -0\ #1\^7 + 0.0144`\ -0\ #1\^8&, 5]]}, {Abs[ > z -> Root[\(-1.`\) + 1.63`\ #1 + 0.31`\ -0\ #1 - 0.7068`\ \ > #1\^2 - 0.3325`\ -0\ #1\^2 - 0.1632`\ #1\^3 + > 0.0643`\ -0\ #1\^3 - 0.1632`\ #1\^4 + > 0.07869999999999999`\ -0\ #1\^4 + 0.07679999999999998`\ > #1\^5 \ > + 0.033099999999999984`\ -0\ #1\^5 + 0.0432`\ -0\ #1\^6 + 0.0288`\ -0\ #1\^7 > \ > + 0.0144`\ -0\ #1\^8&, > 6]]}, {Abs[z -> Root[\(-1.`\) + 1.63`\ #1 + 0.31`\ -0\ #1 - > \ > 0.7068`\ #1\^2 - 0.3325`\ -0\ #1\^2 - 0.1632`\ #1\^3 + 0.0643`\ -0\ #1\^3 - > \ > 0.1632`\ #1\^4 + > 0.07869999999999999`\ -0\ #1\^4 + 0.07679999999999998`\ > #1\^5 \ > + 0.033099999999999984`\ -0\ #1\^5 + 0.0432`\ -0\ #1\^6 + 0.0288`\ > -0\ #1\^7 + 0.0144`\ -0\ #1\^8&, 7]]}, {Abs[z -> \ > Root[\(-1.`\) + 1.63`\ #1 + 0.31`\ -0\ #1 - 0.7068`\ #1\^2 - > 0.3325`\ -0\ #1\^2 - 0.1632`\ #1\^3 + > 0.0643`\ -0\ #1\^3 - 0.1632`\ #1\^4 + 0.07869999999999999`\ > -0\ #1\^4 + 0.07679999999999998`\ #1\^5 + 0.033099999999999984`\ -0\ \ > #1\^5 + 0.0432`\ -0\ #1\^6 + 0.0288`\ -0\ #1\^7 + 0.0144`\ -0\ #1\^8&, > 8]]}}\) > > My intention is to get the absolute values for all root including complex > root. I am expecting exactly one root must be "1". > > I am sorry as my question looks very simple. However forgive me as I am very > new on Mathematica and trying to switch from R. > > Thanks and regards, > > On Fri, Oct 29, 2010 at 4:16 PM, Nasser M. Abbasi<nma at 12000.org> wrote: >> On 10/29/2010 3:26 AM, Christofer Bogaso wrote: >>> >>> Hello all, >>> >>> I am a new user of Mathematica and would appreciate if somebody help >>> me with some hints how can I use Mathematica to solve a typical >>> problem. >>> >>> Suppose I have a matrix polynomial for "z" (which is a scalar) like: >>> >>> Determinant of (Identity_matrix[5] - A1*z - A2*(z^2)) = 0 >>> >>> Here A1 and A2 are 2 separate given square matrices of length 5. >>> >>> I have faced this problem while solving the characteristic polynomial >>> of a multivariate time series model. I am aware of the capability of >>> Mathematica for it's symbolic computation. >>> >>> It would really be helpful if somebody helps me how to do that using >>> Mathematica. >>> >>> Thanks and regards, >>> >> >> may be something like this: >> >> In[59]:= Clear[z]; >> >> n=5; >> A1=Table[RandomReal[1],{i,5},{j,5}]; >> A2=Table[RandomReal[1],{i,5},{j,5}]; >> >> Solve[Det[IdentityMatrix[n]-A1*z-A2*(z^2)]==0,z] >> >> Out[63]= >> > {{z->-2.4021738242972597},{z->-1.340898151721915},{z->-0.8241488489166163-0.2913103890152045 >> I},{z->-0.8241488489166163+0.2913103890152045 >> I},{z->0.2868840290088525-1.8095777731669567 >> I},{z->0.2868840290088525+1.8095777731669567 >> I},{z->0.30173526317565597},{z->1.0027788027642381-0.527105585145346 >> I},{z->1.0027788027642381+0.527105585145346 I},{z->2.005527612079525}} >> >> --Nasser >> > --Nasser