Q:

Switch in functions and their derivatives

Consider the following simple example:
tlist1[a_: "a"] = Switch[a, "a", {1, 2, 3}, "b", {4, 5, 6}];
tfct1[a_: "a", x_] := #[[1]] + #[[2]]*x^#[[3]] &[tlist1[a]];
tfct2[a_: "a", x_] = D[tfct1[a, x], x];

What I want to do is to save a set of parameters as a list (tlist1) in order to generate multiple functions from the same pattern (in real, this will be Sellmeier coefficients for the Sellmeier formula). So tfct1 should give me the desired function when I specify a. E.g. tfct1["a",x]=1+2*x^3 or tfct1["b",x]=4+5*x^6.
Now, tfct2 uses derivatives (and second-order derivatives, but I skipped that for simplification), and I would like a result like tfct2["a",x]=6*x^2and tfct2["b",x]=30*x^5. But it should be usable as tfct2["a",2]=24 or tfct2["b",2]=960.
Because of the Switch statement I was using delayed evaluation := in the definition of tfct1 but this somehow screws up the derivation process.
So, how do I use Switch right like in this example when I would like to use derivatives? Or is there a better way to deal with such things? (still, I would like to use symbols like "a", "b", "c" for my coefficient sets)

A:

I would implement this as follows:
tlist1 is essentially a lookup table, so let us use an association:
tlist1 = <|"a" -> {1, 2, 3}, "b" -> {4, 5, 6}|>;

(If you use Mathematica 9 or earlier, which does not have associations, then simply define tlist1["a"] = ...; tlist1["b"] = ..., etc.)
Let us use a slightly different notation for tfct1:   tfct1[a][x] instead of tfct1[a,x]. This way tfct1[a] is a function in its own right that can be operated on e.g. by Derivative.
tfct1[a_] := Function[x, #1 + #2 x^#3] & @@ tlist1[a]

Example usage:
tfct1["a"]
(* Function[x, 1 + 2 x^3] *)

tfct1["a"][z]
(* 1 + 2 z^3 *)

We can also take the derivative:
tfct1["a"]'
(* Function[x, 6 x^2] *)

tfct1["a"]'[x]
(* 6 x^2 *)

tfct1["a"]'[2]
(* 24 *)

If you still want to define tfct2, you can do so as
tfct2[a_] := tfct1[a]'

