필터 지우기
필터 지우기

Quadratic numbers in matlab

조회 수: 2 (최근 30일)
Mayur Punekar
Mayur Punekar 2015년 5월 18일
댓글: Mayur Punekar 2015년 5월 24일
I inverted a matrix H with entries from quadratic field, e.g., Q(sqrt(3)) and the inverted matrix G gives me entries also from Q(sqrt(3)), e.g., entry at (1,1) is 12 - 8*3^(1/2). However, is there a way to decouple integer coefficient 12 and -8? I want to store these integer values separately.
In fact I want to generate two integer matrices G1 and G2 from G which contains integer coefficients of each entry in G.
Can anyone suggest how can I do it??
Thanks in advance !

답변 (1개)

Nalini Vishnoi
Nalini Vishnoi 2015년 5월 20일
Hi Mayur,
I can think of one way to do what you asked by using Symbolic Math toolbox. It has a function coeffs which can return the coefficients of a polynomial. I have included a small example below demonstrating how to do it.
syms x; % Create a symbolic variable
G = repmat(12-8*x, 10,2); % Create a matrix of polynomials
for i = 1:size(G,2), % Use coeffs column by column
[C(:,i)] = arrayfun(@(z) coeffs(z,x), G(:,i),'Uniformoutput', false);
end
G1 = cellfun(@(x) double(x(1)), C, 'UniformOutput', false); % extract the coefficients as doubles
G1 = cell2mat(G1); % Convert the cell to a matrix
G2 = cellfun(@(x) double(x(2)), C, 'UniformOutput', false);
G2 = cell2mat(G2);
Please note that you can use subs to substitute symbolic variable 'x' with sqrt(3).
I hope this helps.
Nalini
  댓글 수: 1
Mayur Punekar
Mayur Punekar 2015년 5월 24일
Hello Nalini,
Thanks for the reply but unfortunately it didn't solve my problem.
I state my problem more explicitly here. I have a matrix H which has entries from quadratic field Q(3^(1/2)) i.e., entries are in form of h(i,j) = a+b*3^(1/2), where a,b are integers.
H = [0, 0, 1/x, 0, 0, 1/x, 0, 1; 1/x, 0, 0, 0, 0, 1, 0, 1/x; 0, 0, 1, 1/x, 0, 0, 1/x, 0; 0, 1/x, 0, 1, 1/x, 0, 0, 0; 1/x, 1, 0, 0, 0, 1/x, 0, 0; 0, 1/x, 0, 0, 1/x, 0, 1, 0; 0, 0, 0, 1/x, 1, 0, 0, 1/x; 1, 0, 1/x, 0, 0, 0, 1/x, 0];
Now I want to invert this matrix in such a way that the inverted matrix G still has entries of the form G(i,j) = a+b*3^(1/2).
As far as I know, theory suggests that any matrix with entries in Q(3^(1/2)) (or in general Q(D^(1/2)) can be inverted so that the inverted matrix also contains entries from the same field.
I tried many methods but couldn't find a way to get desired results with matlab. Can you suggest a method to solve this problem?
Thanks !

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Number Theory에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by