Estimating the parameters governing the dynamics of a system is a prerequisite for its optimal control. We present a simple but powerful method that we call STEADY, for STochastic Estimation Algorithm for DYnamical variables, to estimate the Hamiltonian (or Lindbladian) governing a quantum system of a few qubits. STEADY makes efficient use of all measurements and its performance scales as the information-theoretic limits for such an estimator. Importantly, it is inherently robust to state preparation and measurement errors. It is not limited to evaluating only a fixed set of possible gates, rather it estimates the complete Hamiltonian of the system. The estimator is applicable to any Hamiltonian that can be written as a piecewise-differentiable function and it can easily include estimators for the non-unitary parameters as well. At the heart of our approach is a stochastic gradient descent over the difference between experimental measurement and model prediction.A common task in physics and engineering is the control of a system, where the control pulses sent to the system pass through a complex transfer function before they effect a useful change to the state of the system. There are two overarching prerequisites for good control: learning the dynamical law that governs the system (the goal of disciplines like experimental design and parameter estimation) and, consecutively, the derivation of control pulses for the given system (broadly covered by optimal control theory). Advances in these areas are crucial for applications in quantum information science, where the precise control of well-characterized quantum systems will form the basis for quantum computers.Here we present STEADY, a conceptually simple but performant method for approaching the parameter estimation problem for dynamical variables. We can model a piece of quantum hardware with a Hamiltonian (or Lindbladian)H(ω; d) which depends on the parameters to be estimated ω and on the control pulses d(t). Our goal becomes finding the value for ω that leads to anH that (for any value of the control pulses d) most closely mimics the dynamical law H governing the real hardware. As is commonly done in parameter estimation, we do this by searching for a value of ω that minimizes some measure of distance betweenH and H.Our contribution follows in the rich traditions of stochastic methods and compressed sensing: instead of performing full process tomography on the hardware which would be extremely time consuming, we run a relatively small number of random control pulses on it and study its response. For each control pulse we sample the final state of the system (for instance by projectively measuring the qubits in the computational basis). We then estimate the difference between this experimental measurement and the prediction based on theH(ω) model. This measure of "difference" is stochastic, as it uses only a small finite sample of possible control drives.This leads to a number of properties that make STEADY perform particularly well. First, the distance measur...