I have a set of of functions I keep re-using (as in this question).
My question
How can I efficiently plot a linear combination of these functions and easily load different scenarios based on different sets of parameters?
My target
Easily plot scenarios based on initial values
I feel limited in my analysis to defined sets of variables The heavy/not elegant code makes me think I am dragging a bad habit (I’d like to correct)
I clumsily use (LinearCombination, LC)
LC(\a,\b,\c,\d,\e,\f)=\a*\d+\b*\e+\c*\f ;
I need your thoughts to update all this in a civilized way 😃
Explanations in the MWE below
What I do so far
In a future question, I’ll ask how to load a different format (surf, colormap) along the scenario I load. To get easily the kind of output (the real functions I use in my flow)
This is something rather simple-minded and potentially dangerous, at least if you use it in ways this was not made for. First of all, you can define your set of parameters simply with a style, e.g.
This means that the functions W1
and so on are not defined before you (locally) use the style. However, you also want to redefine the functions. pgf “protects” the functions from being simply overwritten, for good reasons. However, this also means that you cannot just redefine W1
. This is usually not a problem because you are supposed to use such functions locally just once, and then there is no need to redefine them. However, in the case at hand in which you want to make small modifications to a large family of parameters. Therefore I added a key force declare function
that overwrites functions without complaining. PLEASE USE WITH CARE. Using a variant of this style, redefine
, you can modify parameters of your set.
P.S. pgf keys are another option. However, they cannot simply be used in the formulae in the same way as W1
, say, gets used above. Therefore I decided to play, for the moment, with fire and use the redefining function route.