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. javascript form表单常用的正则表达式

    form验证时常用的几个正则表达式 座机: \d{3,4}-\d{7,8} 手机号: /^1[34578][0-9]{9}$/ (\86)?\s+1[34578]\d{0-9} (\+86)?\s*1 ...

  2. simhash类的使用

    首先感谢作者yanyiwu贡献的开源项目https://github.com/yanyiwu/simhash. 在做项目过程中,翻了一遍<这就是搜索引擎  核心技术详解>这本书的查重算法, ...

  3. 规模数据导入高效方式︱将数据快速读入R—readr和readxl包

    本文由雪晴数据网负责翻译整理,原文请参考New packages for reading data into R - fast作者David Smith.转载请注明原文链接http://www.xue ...

  4. 一句Python,一句R︱pandas模块——高级版data.frame

    先学了R,最近刚刚上手python,所以想着将python和R结合起来互相对比来更好理解python.最好就是一句python,对应写一句R. pandas可谓如雷贯耳,数据处理神器. 以下符号: = ...

  5. spring schedule定时任务(二):配置文件的方式

    接着上一篇,这里使用spring配置文件的方式生成spring定时任务. 1.相应的web.xml没有什么变化,因此便不再罗列.同样的,相应的java代码业务逻辑改动也不大,只是在原来的基础上去掉@C ...

  6. RAPIDIO高速串行协议

    RapidIO是由Motorola和Mercury等公司率先倡导的一种高性能. 低引脚数. 基于数据包交换的互连体系结构,是为满足和未来高性能嵌入式系统需求而设计的一种开放式互连技术标准.RapidI ...

  7. ASP.NET Core 2.0 : 系列目录

    目录: ASP.NET Core 2.0 : 一. 概述 ASP.NET Core 2.0: 二. 开发环境 ASP.NET Core 2.0 : 三. 项目结构 ASP.NET Core 2.0 : ...

  8. 【BZOJ2820】YY的GCD(莫比乌斯反演)

    [BZOJ2820]YY的GCD(莫比乌斯反演) 题面 讨厌权限题!!!提供洛谷题面 题解 单次询问\(O(n)\)是做过的一模一样的题目 但是现在很显然不行了, 于是继续推 \[ans=\sum_{ ...

  9. 【Luogu1876】开灯(数论)

    [Luogu1876]开灯(数论) 题面 题目描述 首先所有的灯都是关的(注意是关!),编号为1的人走过来,把是一的倍数的灯全部打开,编号为二的的把是二的倍数的灯全部关上,编号为3的人又把是三的倍数的 ...

  10. BZOJ4321: queue2

    题面 传送门 Sol 先设一个套路的状态:\(f[i][j]\)表示到第\(i\)个人,有\(j\)对冲突 但是我们不能确定\(i-1\),所以不好决策i的位置 所以再加一维\(0/1\),\(f[0 ...