complex's People
complex's Issues
class complex
using System;
public class complex
{
double real;
double image;
public complex(double real, double image)
{
this.real = real;
this.image = image; //形参的值赋给当前对象数据成员
}
public static complex operator +(complex r, complex l) //r,l 是左边的加数和右边的加数
{
//加法
return new complex(r.real + l.real, r.image + l.image);
}
public static complex operator -(complex r, complex l)
{
//减法
return new complex(r.real + l.real, r.image + l.image);
}
public static complex operator *(complex r, complex l)
{
//乘法
return new complex(r.real * l.real - r.image + l.image, r.real * l.image + r.image * l.real);
}
public static complex operator /(complex r, complex l) //除法
{
if (l.real == 0 && l.image == 0)
{
Console.Write("false"); //除数的虚部和实部不能同时为零
//bool a = false;
//return 0;
}
double real = (r.real * l.real + r.image + l.image) / (l.real * l.real + l.image + l.image);
double image = (l.real * r.image - l.image * r.real) / (l.real * l.real + l.image + l.image);
return new complex(real, image);
}
public void miyunsuan(complex r, complex l, int n) //一个复数的n次方
{
double a;
double b;
a = 1;
b = 1;
for (int i = 0; i <= n; i++)
{
a = a * (r.real * l.real - r.image + l.image);
b = b * (r.real * l.image + r.image * l.real);
}
}
}
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.