- #1
RicardoMP
- 49
- 2
My objective is to make a list of functions and afterwards be able to make operations with those functions.
In the above code, I receive a list of functions like this one:
These are vectors which I'll want to use to build other functions using dot product and norms. However, while testing this, I wanted to make sure that variable a is always a variable of these functions, so I can, for example, plot my functions later. If I use, for example,
The function returns the list of the functions I appended.
However, if I return auxList[1], for example, (or any other number), I get
How can I keep adding (appending) my functions to the list and still be able to use variable a? Basically, can I still use my list of functions as a function of variable a, after appending other functions, also of variable a?
Thank you
Code:
Hyfield[list_, bits_] := Module[{i, auxList, Hy},
auxList[a_] := List[];
For[i = 1, i <= bits*2, i++,
auxList[a] =
Append[auxList[a],
c1*ArcCos[(list[a][[i]].list[a][[i + 1]])/(Norm[list[a][[i]]]*
Norm[list[a][[i + 1]]])]]
];
Return[auxList[a]]
]
Code:
bits2[a_] := List[
{(w + a), -d},
{-a, -d},
{-(w + a), -(t + d)},
{-a, -(t + d)},
{-a, -d},
{(w - a), -d},
{-a, -(t + d)},
{(w - a), -(t + d)}
];
These are vectors which I'll want to use to build other functions using dot product and norms. However, while testing this, I wanted to make sure that variable a is always a variable of these functions, so I can, for example, plot my functions later. If I use, for example,
Code:
Hyfield[bits2, 2]
The function returns the list of the functions I appended.
However, if I return auxList[1], for example, (or any other number), I get
Code:
{}
Thank you