New answers tagged data-structures
3
This isn't really an answer, but it's too big for a comment.
Here's some code to brute force solve the problem (since there wasn't any code provided in the question). It lists all the possible numbers; finds the ones whose product matches; then of those, finds the ones whose sum of squares match, etc..
Module[{h = 50, r, product, squared, fourth, sixth},
...
3
I prefer a slightly different approach to Jonathan's, and I believe it is simpler and more in line with the spirit of using rule replacements for getting things done. First, note that since you're dealing with elements in the periodic table, which are finite and small in number (and pairs of those), you can easily generate your matrix of pairs of elements ...
5
The following will take all of the data that you want from the json file and give you a Table that you can use as you wish. Is this what was wanted?
elementList = {"Sc" -> 1, "Ti" -> 2, "V" -> 3, "Cr" -> 4, "Mn" -> 5,
"Fe" -> 6, "Co" -> 7, "Ni" -> 8, "Cu" -> 9, "Zn" -> 10, "Y" -> 11,
"Zr" -> 12, "Nb" -> 13, "Mo" ...
9
This might be the general sort of operation you seek.
keyvalpairs =
DownValues[arr] /. Verbatim[HoldPattern][arr[k_]] :> k
(* Out[121]= {1.5 :> 0.4, 3.5 :> 0.7, 7 :> 0.3} *)
9
Here is one way to do it:
{arr[1.5] = 0.4, arr[3.5] = 0.7, arr[7] = 0.3}
Total[DownValues[arr][[All, 2]]]
1
I'd recommend rethinking your data structure a bit. How about defining lists like:
data[[i]] = {{DataSetName1, m1, m2, m3,m4},{DataSetName2, m1, m2, m3, m4},...}
for i=1 to however many pieces of data you have. Then the corresponding
time[[i]] =[5, 10, 20, 1440]
and etc for all the different items. Now you can just index through the i, instead of ...
1
I am not certain where your trouble lies, but since you mention ToString and ToExpression you're surely making this harder than it needs to be. Let me show you a couple of methods to format your data in the way I think you intend. Sample data:
dat = {{"cat", 8, 18, 9, 1}, {"dog", 19, 15, 15, 7}, {"fox", 7, 10, 9, 20},
{"bird", 17, 10, 1, 5}, ...
8
There is a built-in function DirectedGraph[ (*your undirected graph*) , "Random"] for this job:
myGraph = RandomGraph[{10, 13},
VertexLabels -> Table[v -> Style[v, 20], {v, 10}],
ImagePadding -> 20, VertexSize -> Medium]
DirectedGraph[myGraph, "Random"]
(Note the layout may not be the same as myGraph.)
Edit:
As OP asked in a ...
Top 50 recent answers are included



