New answers tagged variable-definitions
3
votes
Create a list of indexed variables and assign values in one line of code
Clear[F]
MapThread[Set,{F /@ {1, 3, 6, 8}, {2, 4, 6, 0}}];
F /@ {1, 3, 6, 8}
(* {2,4,6,0} *)
3
votes
Create a list of indexed variables and assign values in one line of code
Just another way:
...
8
votes
Create a list of indexed variables and assign values in one line of code
another method:
F = AssociationThread[{1, 3, 6, 8} -> {2, 4, 6, 0}]
F[1]
2
Top 50 recent answers are included
Related Tags
variable-definitions × 502functions × 75
function-construction × 63
variable × 52
scoping × 37
list-manipulation × 36
evaluation × 32
equation-solving × 25
assignment × 23
symbols × 22
plotting × 21
matrix × 19
syntax × 16
replacement × 15
programming × 14
manipulate × 13
symbolic × 13
core-language × 12
differential-equations × 10
calculus-and-analysis × 10
pattern-matching × 10
warning-messages × 10
complex × 10
packages × 10
clear × 10