Description
Consider the AC circuit below. We'll assume that the circuit are in steady-state. Thus, the voltage at nodes 1 and 2 is given by V1 = VS Cos WT and v2 = Vrcos (wt + q) Where VS is the source of the voltage, 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 are its phase.
You is to write a program to determine VR for different values of W. You'll need the laws of electricity to solve this problem. The first is Ohm's law, which states V2 = IR where I am 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 would consist of one or more lines. The first line contains three real numbers and a non-negative integer. The real numbers is VS, R, and C, in that order. The integer, n, is the number of test cases. The following n lines of the input would have one real number per line. Each of these numbers is the angular frequency,W.
Output
For each angular frequency in the input you is to output its corresponding VR on a single line. Each VR value output should is rounded to three digits after the decimal point.
Sample Input
1.0 1.0 1.0 90.010.0316230.10.316231.03.162310.031.623100.0
Sample Output
0.0100.0320.1000.3020.7070.9530.9951.0001.000
/* A boring math problem derivation formula can */#include <iostream> #include <cmath> #include <stdio.h>using namespace Std;int Main () {double vs, R, C;int n;cin>>vs>>r>>c;cin>>n;while (n-->0) {double w;cin>>w; Double VR = R*C*W*VS*SQRT (1/(r*c*w*r*c*w+1));p rintf ("%.3lf\n", VR);} return 0;}
[POJ] Bode Plot