I have a program that implements a multivariate function, call it $f = \mathcal{Q}(Z,v)$ that I can compute given $Z,v$. The $v$ variable is related to the $f$ variable by another relation, call it $v = \mathcal{L}(f)$ (so given $f$ I have a program that can compute $v$). I would like to use this to obtain how $v$ varies with $Z$.

My present approach is to evaluate $\mathcal{L}(f)$ for a bunch of $f$, and store the $v$ against $f$. Then, I would input different values of $Z$ (held constant) and $v$ to compute $f$, and compare these $f$ and $v$ with those from the earlier evaluation. The closest pair would be selected and I have my $v$ for a certain $Z$.

Is there a better way than this ad hoc method? I use Python, so using any associated libraries to solve the task is allowed.

  • 3
    $\begingroup$ If you recast this as a nonlinear system $f - \mathcal{Q}(Z,\mathcal{L}(f)) = 0$, then this is a pretty standard numerical continuation problem and you can just look at $v$ evaluated along this $f$ curve $\endgroup$
    – whpowell96
    Feb 5 at 17:43
  • 1
    $\begingroup$ Are $v,Z,f$ all scalars, or what are their dimensions? $\endgroup$ Feb 5 at 18:22
  • $\begingroup$ @whpowell96 Thanks! Apologies if it was obvious, I've never heard of this method. Could you suggest any up to date Python tools for computing these level sets? Most of what I could find (pycont, pacopy) are outdated and are no longer supported. $\endgroup$
    – haricash
    Feb 7 at 14:22
  • $\begingroup$ @WolfgangBangerth $v,f$ are vectors in 3D, Z is a scalar. $\endgroup$
    – haricash
    Feb 7 at 14:23
  • $\begingroup$ I think there are a few Python packages out there purpose-built for continuation but for simple problems it's pretty easy to build your own tool around an existing nonlinear solver using, e.g., arc length continuation $\endgroup$
    – whpowell96
    Feb 7 at 14:24


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.