Description

Consider the AC circuit below. We will assume that the circuit is in steady-state. Thus, the voltage at nodes 1 and 2 are given by v1 = VS coswt and v2 = VRcos (wt + q ) where VS is the voltage of the source, w is the frequency (in radians per second), and t is time. VR is the magnitude of the voltage drop across the resistor, and q is its phase.

You are to write a program to determine VR for different values of w. You will need two laws of electricity to solve this problem. The first is Ohm's Law, which states v2 = iR where i is the current in the circuit, oriented clockwise. The second is i = C d/dt (v1-v2) which relates the current to the voltage on either side of the capacitor. "d/dt"indicates the derivative with respect to t.

Input

The input will consist of one or more lines. The first line contains three real numbers and a non-negative integer. The real numbers are VS, R, and C, in that order. The integer, n, is the number of test cases. The following n lines of the input will have one real number per line. Each of these numbers is the angular frequency, w.

Output

For each angular frequency in the input you are to output its corresponding VR on a single line. Each VR value output should be rounded to three digits after the decimal point.

Sample Input

1.0 1.0 1.0 9
0.01
0.031623
0.1
0.31623
1.0
3.1623
10.0
31.623
100.0

题意:给出公式V2=iR,V2=Vr * cos(wt + q), V1=Vs * cos(wt), i = C * d(v1 - v2)/dt; d是求导数的意思。已知Vs,R,C,w,求Vr。

分析:利用V2分别等于两个式子,将i,V2和V1带入,可得方程:R*C*d(Vs * cos(wt) - Vr * cos(wt + q))/dt  = Vr * cos(wt + q)

根据求导公式:d(cos(x))/dx = -sinx可将原方程化为:R*C*w*(Vr*sin(wt + q) - Vs*sin(wt)) = Vr * cos(wt + q)

在这里三角函数的参数有两个:wt+q和wt,我们分别令他们为0,方程分别可变为:R*C *w*Vs*sin(q) = Vr; R*C * w*sin(q) = cos(q)

由2式得:cot(q) = R * C * w。

由公式:sin^2(a) = 1/(cot ^2(a) + 1)

可得:sin(q)=sqrt(1/(cot^2(q) + 1))

即:sin(q) =sqrt(1/(R^2*C^2*w^2 + 1))

#include<iomanip>
#include<iostream>
#include<cmath>
using namespace std;
int main()
{ double vs,r,c,w;
int n;
cin>>vs>>r>>c>>n;
while(n--)
{
cin>>w;
cout<<fixed<<setprecision(3)<<r*c*w*vs*sqrt(1/(r*r*c*c*w*w+1))<<endl;
} return 0;
}

  

代入1式可得:Vr = R * C * w * Vs * sqrt(1/(R^2*C^2*w^2 + 1))

												

poj-1045(数学不好怪我咯)的更多相关文章

  1. 一个数学不好的菜鸡的快速沃尔什变换(FWT)学习笔记

    一个数学不好的菜鸡的快速沃尔什变换(FWT)学习笔记 曾经某个下午我以为我会了FWT,结果现在一丁点也想不起来了--看来"学"完新东西不经常做题不写博客,就白学了 = = 我没啥智 ...

  2. html5 canvas高级贝塞尔曲线运动动画(好吧这一篇被批的体无完肤!都说看不懂了!没办法加注释了!当然数学不好的我也没办法了,当然这还涉及到一门叫做计算机图形学的学科)

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  3. BL老师的建议,数学不好的,大数据一票否决--后赋从java转大数据

    __________________________ 作者:我是蛋蛋链接:https://www.zhihu.com/question/59593387/answer/167235075来源:知乎著作 ...

  4. POJ 1045

    #include<iostream> #include<cmath> #include<iomanip> using namespace std; int main ...

  5. POJ 2906 数学期望

    开始时直接设了一个状态,dp[i][j]为发现i种bug,j个系统有bug的期望天数.但很错误,没能转移下去.... 看了题解,设状态dp[i][j]为已发现i种bug,j个系统有bug,到完成目标状 ...

  6. POJ 1045:Bode Plot

    Bode Plot Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 13392   Accepted: 8462 Descri ...

  7. 程序员的数学 三册数学,概率统计、线性代数pdf

    程序员的数学1 2012.pdf 2012版 程序员的数学2 概率统计 ,平冈和幸,(日)堀玄著 ,P4006 2015.pdf 2015版 程序员的数学3-线性代数 2016.pdf 2016版 如 ...

  8. 扒一扒IT大佬高考:马云数学1分考北大 李彦宏是状元

    http://news.cnblogs.com/n/522622/ 高考今天正式拉开序幕,而像李彦宏.马云等 IT 大佬之前也都参加过高考,他们成绩又都是怎样的呢? 马化腾:放弃天文梦选择计算机 20 ...

  9. POJ 1905 题解(二分+几何)

    题面 传送门 分析 如图:已知AB=L,弧AB=L(1+nC)" role="presentation" style="position: relative;& ...

随机推荐

  1. 使用阿里云主机离线部署CDH步骤详解

    一.Linux文件系统准备 1. 拍摄快照 登录阿里云控制台,拍摄快照,注意有几个关键点尽量拍摄快照,系统初始状态.CM环境准备完成.CM安装完成.CDH安装完成. 2. 挂载设备 三个主机都执行. ...

  2. 关于用wubi安装Ubuntu,总是提示“没有定义根文件系统”的问题

    用diskgenius测试一下分区问题,就发现一些错误,所以怀疑可能就是因为这个分区参数错误导致WUBI安装不成功,费了大力气转移数据后,重新对硬盘分区,这里称赞一下diskgenius,的确不错,当 ...

  3. java注解之二

    从JDK5开始,Java增加了Annotation(注解),Annotation是代码里的特殊标记,这些标记可以在编译.类加载.运行时被读取,并执行相应的处理.通过使用Annotation,开发人员可 ...

  4. dojo表格分页之各个参数代表的意义(一)

    下面是dojo表格分页参数代表的意义 //每页可以显示10/15/20/25/30条记录 (1)pageSizes: [10, 15, 20, 25,30], //每页显示的记录从多少到多少,共多少条 ...

  5. R语言之内存管理

    转载于:http://blog.csdn.net/hubifeng/article/details/41113789 在处理大型数据过程中,R语言的内存管理就显得十分重要,以下介绍几种常用的处理方法. ...

  6. JBoss启动项目报错

    具体报错如下: WARNING: -logmodule is deprecated. Please use the system property 'java.util.logging.manager ...

  7. java重写和重载

    方法的重载: 在一个类中的两个或两个以上的方法,他们方法名相同但是参数列表不同,这种方式称为方法的重载,方法的重载是实现多态性的方式之一. 参数列表不同指的是参数的个数不同或相同的个数但顺序不同或者类 ...

  8. toggle的用法(点击更换不同的function)当指定元素被点击时,在两个或多个函数之间轮流切换。

    一,用法 <html> <head> <script type="text/javascript" src="/jquery/jquery. ...

  9. Outlook 2010 对话简介 邮件自动关联

    对话简介 默认情况下,Microsoft Outlook 2010 收件箱中的电子邮件按日期进行组织并按对话进行排列,对话将具有相同主题的邮件组合为能以展开或折叠形式进行查看的对话.这在帮助您提高浏览 ...

  10. GridView中使用 jQuery DatePicker (UpdatePanel)

    1.无UpdatePanel   1.代码 <script> $(function () { $('.myDatePickerClass').datepicker({ dateFormat ...