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. linux远程控制

    linux远程控制 SSH协议:为客户机提供安全的shell环境,默认端口22OpenSSH服务服务名称:sshd主程序:/usr/sbin/sshd ,/usr/bin/ssh配置文件:/etc/s ...

  2. 如何构造一个简单的USB过滤驱动程序

    本文分三部分来介绍如何构造一个简单的USB过滤驱动程序,包括"基本原理"."程序的实现"."使用INF安装".此文的目的在于希望读者了解基本 ...

  3. 嵌入式 视频编码(H264)

    这几天在编写视频录制模块,所以,闲暇之余,又粗粗的整理了一下,主要是API,以备不时之用    摄像头获取的模拟信号通过经芯片处理(我们使用的是CX25825),将模拟信号转成数字信号,产生标准的IT ...

  4. 错误代码: 1582 Incorrect parameter count in the call to native function 'str_to_date'

    1. 错误描述 1 queries executed, 0 success, 1 errors, 0 warnings 查询:SELECT t.`name`, DATE_FORMAT(str_to_d ...

  5. INS-30002 口令和确认口令不同

    1.错误描述 2.错误原因 由截图上的提示,可以看出是管理口令和确认口令不一致 3.解决办法 重新输入密码

  6. SDL显示文字

    前面教程里,我们只显示图片,没提到如何显示文字, SDL本身没有显示文字功能,它需要用扩展库SDL_ttf来显示文字.ttf是True Type Font的缩写,ttf是Windows下的缺省字体,它 ...

  7. 【BZOJ1212】L语言(AC自动机)

    [BZOJ1212]L语言(AC自动机) 题面 BZOJ 题解 很自然的,既然要匹配单词,那就全部都丢到\(AC\)自动机里面去 现在想想怎么匹配 先是\(AC\)自动机正常的匹配 如果此时这个位置能 ...

  8. 如何使用Git以及GitHub

    Git在程序的版本控制上有着极大的优势,下面是简单对其的简介 Git 的特点: 1 Snapshots, Not Differences 直接记录快照而非差异对比. 传统的版本控制系统(version ...

  9. 读取MySQL存储二进制的语音、图片(Blob类型)

    /**   * 下载语音   * Remarks:   * @throws Exception   */ public void downloadYuyin() throws Exception { ...

  10. HTTP架构介绍(2) 缓存

    web缓存是自动复制所请求数据并将其保存在本地存储中的设备. 通过这样做, 可以实现: 减少网络流量 消除网络瓶颈 防止服务器超载 减少长距离的响应延迟 因此, 您可以清楚地说, web 缓存可提高用 ...