# Tag Info

1

<< DiscreteMathCombinatorica; g[f_,n_,s_]:=Plus@@Apply[f,PadRight[TransposePartition[#],s]&/@Partitions[n,s],1]; should even work in version 4.0

3

The function g you describe can be implemented in a simple way like this: g[n_, s_] := Total[Multinomial @@@ IntegerPartitions[n, {s}]] I'll admit I didn't go through your code. Is the above helpful?

1

Here is the final result if you are interested. data = Import /@ FileNames["/home/marco/LatexDocs/analytical/uvvis/PHOS_*.CSV"]; data = data[[All, 2 ;;, {1, 2}]]; ListLinePlot[data, PlotLegends -> {"BB", "MR", "PT", "TB", "UI"}, AxesLabel -> {Style["wavelength (nm)" , FontSize -> 16], Style["Absorbance", FontSize -> 16]}, PlotRange ...

4

Import the data and filenames, cull the datasets of information that is not useful: data = Import /@ FileNames["*.csv"]; filenames = FileNames["*.csv"]; data = data[[All, 2 ;;, {1, 2}]]; ListLinePlot[data, PlotLegends -> filenames] Looks like PT data was either incorrectly collected or is effectively transparent in the region of interest. The ...

2

Please examine this and determine if it is giving the result that you desire: m = 3; mem : mult[i_, j_] := mem = (tstar[Abs[i - j]] + tstar[i + j - 2])/2 ptab = Table[Expand @ Sum[a[i - 1]*mult[i, j], {i, m}], {j, m}] Table[Coefficient[j, tstar[i - 1], 1], {j, ptab}, {i, m}] // Transpose If you include the definitions of a and tstar I may be able to ...

3

Leonid already named the big one, With, but there are a few more approaches I'd like to outline. First of all you can use Evaluate if you wish to evaluate the entire body of the Function, and if the Function isn't part of some larger held expression. I fully agree with Leonid however that With is more general and less prone to surprises here. Nevertheless ...

8

The general way to construct functions with partially evaluated pieces is to use With, which is a general device for injecting evaluated pieces in otherwise unevaluated or held expressions. In your case, it would look like f[a_] := With[{sqa = a^2}, sqa * # &] The method based on Evaluate is generally less powerful, since evaluation of the entire body ...

Top 50 recent answers are included