Skip to main content
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
Source Link

Create a function runRxn using Module which runs n times and appends each reaction output.

noise1 := RandomReal[NormalDistribution[0, 0.2]] totaltime = 10; rxn = NDSolve[{a'[t] == -a[t] + noise1, a[0] == 10}, a, {t, 0, totaltime}]; runRxn[n_Integer] := Module[{rxnOutput = Table[{}, 10], output}, Do[ output = Table[a[t] /. rxn, {t, 0, totaltime}]; rxnOutput = Join[rxnOutput, output, 2];, n]; rxnOutput = rxnOutput /. Null -> Sequence[]; Join[{#} & /@ Range[0, totaltime], rxnOutput, 2] ]; 

For n=4,

runRxn[4] // MatrixForm 

enter image description here

Check thisthis and thisthis to know more about adding rows and columns to a list

Create a function runRxn using Module which runs n times and appends each reaction output.

noise1 := RandomReal[NormalDistribution[0, 0.2]] totaltime = 10; rxn = NDSolve[{a'[t] == -a[t] + noise1, a[0] == 10}, a, {t, 0, totaltime}]; runRxn[n_Integer] := Module[{rxnOutput = Table[{}, 10], output}, Do[ output = Table[a[t] /. rxn, {t, 0, totaltime}]; rxnOutput = Join[rxnOutput, output, 2];, n]; rxnOutput = rxnOutput /. Null -> Sequence[]; Join[{#} & /@ Range[0, totaltime], rxnOutput, 2] ]; 

For n=4,

runRxn[4] // MatrixForm 

enter image description here

Check this and this to know more about adding rows and columns to a list

Create a function runRxn using Module which runs n times and appends each reaction output.

noise1 := RandomReal[NormalDistribution[0, 0.2]] totaltime = 10; rxn = NDSolve[{a'[t] == -a[t] + noise1, a[0] == 10}, a, {t, 0, totaltime}]; runRxn[n_Integer] := Module[{rxnOutput = Table[{}, 10], output}, Do[ output = Table[a[t] /. rxn, {t, 0, totaltime}]; rxnOutput = Join[rxnOutput, output, 2];, n]; rxnOutput = rxnOutput /. Null -> Sequence[]; Join[{#} & /@ Range[0, totaltime], rxnOutput, 2] ]; 

For n=4,

runRxn[4] // MatrixForm 

enter image description here

Check this and this to know more about adding rows and columns to a list

Source Link
Anjan Kumar
  • 5k
  • 1
  • 18
  • 29

Create a function runRxn using Module which runs n times and appends each reaction output.

noise1 := RandomReal[NormalDistribution[0, 0.2]] totaltime = 10; rxn = NDSolve[{a'[t] == -a[t] + noise1, a[0] == 10}, a, {t, 0, totaltime}]; runRxn[n_Integer] := Module[{rxnOutput = Table[{}, 10], output}, Do[ output = Table[a[t] /. rxn, {t, 0, totaltime}]; rxnOutput = Join[rxnOutput, output, 2];, n]; rxnOutput = rxnOutput /. Null -> Sequence[]; Join[{#} & /@ Range[0, totaltime], rxnOutput, 2] ]; 

For n=4,

runRxn[4] // MatrixForm 

enter image description here

Check this and this to know more about adding rows and columns to a list