Tobias,
Also, you can simplify your function quite a bit and make it not use any global variables with:
fehler2[exp_, vars_List] :=
Sqrt[Plus @@
Map[(D[exp, #]*ToExpression["\[CapitalDelta]" <> ToString[#]])^2 &,
vars]]
which is used like this
fehler2[a*const + b*2, {a, b}]
Note that the variables are given as a list and not inlined in the function. You can make them inlined as you originally had but I think that is less conforming to Mathematica standards for functions:
fehler2[exp_, vars__] :=
Sqrt[Plus @@
Map[(D[exp, #]*
ToExpression["\[CapitalDelta]" <> ToString[#]])^2 &, {vars}]]
which is called your old way:
fehler2[a*const + b*2, a, b]
You also have a big mistake in the way you use the function -- you must have the a,b,etc NOT defined as numbers when you call the function (in any of the versions). My suggestion is to do the following:
error = fehler[a*const + b*2, a, b]
error /. {a -> 1, b -> 2, const -> 9}
The same applies for fehler2 in either format. This approach will not define the a,b,const so you can change things without clearing anything in the kernel. Hope this helps.
Regards,
Neil