分式线性变换的保交比性
对于分式线性变换,具有保交比性
应用
在复数域下,存在分式线性变换,给定三个输入和输出,再给定第四个输入,求其在这个分式线性变换下的输出。
https://codeforces.com/gym/103427/problem/I
解:
根据上式求得 \(w_4\) ,注意特判 \(z_4\) 和 前三个 \(z\) 相等的情况(这时分母为0)
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const double eps = 1e-8;
complex<double> z[5], w[5]; // a + b * i 实部 虚部
int t;
double x, y;
int main() {
cin >> t;
while(t--) {
for(int i = 1; i <= 3; i++) {
scanf("%lf%lf", &x, &y);
z[i] = {x, y};
scanf("%lf%lf", &x, &y);
w[i] = {x, y};
}
scanf("%lf%lf", &x, &y);
z[4] = {x, y};
bool f = 0;
for(int i = 1; i <= 3; i++) {
if(z[4] == z[i]) {
w[4] = w[i];
f = 1;
break;
}
}
if(!f) {
complex<double> tem = (z[4] - z[1]) * (z[3] - z[2]) * (w[3] - w[1]) /
((z[4] - z[2]) * (z[3] - z[1]) * (w[3] - w[2]));
w[4] = (-w[1] + tem * w[2]) / (tem - complex<double> {1, 0});
}
printf("%.10f %.10lf\n", w[4].real(), w[4].imag());
}
system("pause");
return 0;
}
标签:%.,线性变换,tem,int,icpc,2021,保交比性,分式
From: https://www.cnblogs.com/re0acm/p/16835140.html