This is a snippet of a code that I have:
ClearAll["Global`*"]
ReArrangedTable[{x_, YReal1_, YImag1_, YReal2_, YImag2_}] := {x,
YReal1, YImag1, FunctionValue[YReal1, x],
YReal2, YImag2, FunctionValue[YReal2, x]}
MappedTable = Map[ReArrangedTable, SolutionInTableForm]
Here, SolutionInTableForm
consist of numerical values with dimensions which depends on the input- lets say that for this case its {1000,5}. This 5 values is taken into
x_,YReal1_,YImag1_,YReal2_,YImag2_
. And, FunctionValue
is a sample function that I define earlier and then I use Map
. This seems to be fair enough.
But, when value of 5 changes to 7 or 9 or 13, then I am forced to type arguments of ReArrangedTable
manually and also RHS of ReArrangedTable
. Is there any way to "automate" this?
Edit 1:
Ideally I am expecting to have a code like this:
ValueOfY = 20
ReArrangedTable[{x_, YReal1_, YImag1_, YReal2_, YImag2_, ....,
YReal19_, YImag19_, YReal20_, YImag20_}] := {x,
YReal1, YImag1, FunctionValue[YReal1, x],
YReal2, YImag2, FunctionValue[YReal2, x], ... .. YReal19, YImag19,
FunctionValue[YReal19, x],
YReal20, YImag20, FunctionValue[YReal20, x]}
MappedTable = Map[ReArrangedTable, SolutionInTableForm]
Is this possible to do this automatically?
I am using Mathematica 11.0.0.
Thanks in advance