Under construction

Still being built. Things may change

Bode Plot

Time limit1sMemory limit128 MB

Summary
Given source voltage, resistance, capacitance, and several angular frequencies, compute the resistor voltage magnitude from the RC low-pass circuit equations.
Level

Easy3 of 10

Topics
Math, Simulation, Implementation, Brute force
Solved
No attempts yet

Problem

Consider an alternating-current (AC) circuit that is assumed to be in steady state. The circuit consists of a voltage source, a capacitor, and a resistor. Node 1 is the source terminal, and node 2 is the point between the capacitor and the resistor. The voltages at the two nodes are

v1=VScos⁡(ωt),v2=VRcos⁡(ωt+θ)v_1 = V_S \cos(\omega t), \qquad v_2 = V_R \cos(\omega t + \theta)

where VSV_S is the source voltage, ω\omega is the angular frequency (in radians per second), and tt is time. VRV_R is the magnitude of the voltage drop across the resistor, and θ\theta is its phase.

Write a program that determines VRV_R for different values of ω\omega. You will need two laws of electricity. The first is Ohm's Law: if ii is the current in the circuit, oriented clockwise, then v2=iRv_2 = iR. The second relates the current to the voltages on either side of the capacitor: i=Cddt(v1−v2)i = C \dfrac{d}{dt}(v_1 - v_2), where ddt\dfrac{d}{dt} denotes the derivative with respect to tt.

Input

The input consists of one or more lines. The first line contains three real numbers and a non-negative integer. The real numbers are VSV_S, RR, and CC, in that order. The integer nn is the number of queries. Each of the following nn lines contains a single real number, the angular frequency ω\omega.

Output

For each angular frequency, output the corresponding VRV_R on its own line. Round each VRV_R value to three digits after the decimal point.

Examples2

  1. Example 1

    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
    
    Expected output
    0.010
    0.032
    0.100
    0.302
    0.707
    0.953
    0.995
    1.000
    1.000
    
  2. Example 2

    Input
    1.0 2.0 0.5 3
    0.5
    1.0
    2.0
    
    Expected output
    0.447
    0.707
    0.894