把变量定义出来,按照这个公式写代码就好了啊
double stk = sqrt(2.0) * V2f / (4 * J2 * Vdc);
double sgmk = sqrt(2.0) * V1f / (4 * J1 * Vdc);
#include <iostream>
using namespace std;
#include <math.h>
int main()
{
double J1 = 0.519109833970756,J2 = 0.431782727623023;
double V1f,V2f,Vdc;
cin>>V1f>>V2f>>Vdc;
double stk = sqrt(2.0) * V2f / (4 * J2 * Vdc);
double sgmk = sqrt(2.0) * V1f / (4 * J1 * Vdc);
cout<<stk<<endl;
cout<<sgmk<<endl;
return 0;
}
你到底是python还是c++,为什么打2个标签
怎么看下python的数学库
https://blog.csdn.net/weixin_42212924/article/details/124910005
import math
J1 = 0.519109833970756
J2 = 0.431782727623023
def get_θ(V1f, VDC):
"""
:param V1f:
:param VDC:
:return:
"""
base = math.sqrt(2) / (4 * J2)
return base * (V1f / VDC)
def get_ε(V2f, VDC):
"""
:param V2f:
:param VDC:
:return:
"""
base = math.sqrt(2) / (4 * J1)
return base * (V2f / VDC)
if __name__ == '__main__':
get_θ(1, 1)
get_ε(1, 1)
在不安装其他第三方库的情况下希望python自带的decimal模块可以帮到你,decimal默认的精度是28位,精度应该说是相当地高了。跟详细地信息可以关注一下此链接https://docs.python.org/zh-cn/3/library/decimal.html