No BSD License
-
Fibonacci(n)
Fibonacci.m by David Terr, Raytheon, 5-11-04
-
GeneralizedFibonacci(n,a,b)
GeneralizedFibonacci.m by David Terr, Raytheon, 10-20-04
-
GeneralizedLucas(n,a,b)
GeneralizedLucas.m by David Terr, Raytheon, 10-20-04
-
JacobiSymbol(a,b)
Compute the Jacobi symbol (a/b), where a and b are integers with b odd and positive.
-
Lucas(n)
Fibonacci.m by David Terr, Raytheon, 5-11-04
-
MinkowskiQM(x)
Given x from 0 to 1, compute the Minkowski question mark function of x.
-
Pell(d,s,n)
-
QCF(d,u,v,quiet)
-
RoundQCF(d,u,v,quiet)
-
binomial(n,m)
binomial.m by David Terr, Raytheon, 5-11-04
-
cfrac(x,n)
-
factor2( n )
-
fromcfrac( a )
Return the number whose continued fraction coefficieints are given as a row or column vector.
-
harmonic(z)
harmonic.m by David Terr, Raytheon, 9-10-04
-
partitiontable(n)
PartitionTable.m by David Terr, Raytheon, 6-7-04
-
qftimes(f1,f2)
qftimes.m by David Terr, Raytheon, 11-17-04
-
roundcfrac(x,n)
-
rqf(f)
-
sigma(k,n)
-
tau(n)
-
partitionplot.m
-
View all files
from
numerical.zip
by David Terr
Archive containing numerical function files.
|
| qftimes(f1,f2)
|
% qftimes.m by David Terr, Raytheon, 11-17-04
% Compose (multiply) two binary quadratic forms and reduce result.
% This function requires rqf.m.
% Reference: H. Cohen, "A Course in Computational Algebraic Number Theory",
% Springer-Verlag, Vol. 138 (1993), pp. 241 (Algorithm 5.4.6)
function f3 = qftimes(f1,f2)
% Make sure inputs have the right size.
if ( size(f1) ~= [1 3] )
error('First argument needs to be a row vector of length 3.');
return;
end
if ( size(f2) ~= [1 3] )
error('Second argument needs to be a row vector of length 3.');
return;
end
a1 = f1(1);
b1 = f1(2);
c1 = f1(3);
D = b1^2 - 4*a1*c1;
a2 = f2(1);
b2 = f2(2);
c2 = f2(3);
if ( b2^2 - 4*a2*c2 ~= D )
error( 'Discriminants of inputs are not equal.' );
return;
end
s = (b1 + b2)/2;
n = (b1 - b2)/2;
[d1 u v] = gcd(a1,a2);
[d t w] = gcd(d1,s);
d0 = gcd(gcd(d,c1),gcd(c2,n));
a3 = d0*a1*a2/d^2;
b3 = b2 + 2*a2*(v*(s-b2)-w*c2)/d;
c3 = (b3^2 - D)/(4*a3);
f3 = rqf([a3 b3 c3]);
f3 = f3{1};
|
|
Contact us at files@mathworks.com