While arguments can be typed directly into a formula, it is generally more convenient to specify arguments as the contents of a cell or a range of cells. Editing values contained in cells is much easier than editing values embedded in a formula. And, if entered in a cell, Mathematica syntax does not need to be wrapped in quotes. Method | Notes | =EVAL("Random[Integer,{1,6}]") | function and its arguments entered as a single expression | =EVAL("Random","Integer","{1,6}") | function arguments passed individually | =EVAL("Random",C2,"{1,6}") | symbol Integer now provided by cell C2 | =EVAL("Random",C2,D2:E2) | list {1,6} now provided by range D2:E2 |
Specifying range arguments. Using the last form of the example, you can easily change the upper and lower bound of the random number by changing cells D2 and E2. Also, by typing Real in cell C2 you can change the type of random number returned. A single column or single row of cells is interpreted as a one-dimensional Mathematica list; if a range has multiple rows and multiple columns, it is returned as a 2D list of lists. To specify a string in Mathematica, you can wrap a text argument with the DATA function. The following methods return a list of Mathematica functions that end in Solve. Method | Notes | =EVAL("StringLength",DATA(" Hello ")) | evaluates StringLength["Hello"] | =EVAL("Names",DATA(A1)) | string now provided in cell A1 |
Specifying string arguments. Mathematica evaluations are performed at the precision of the inputs provided. If you would like the kernel to perform evaluations numerically at floating-point precision, wrap your inputs with the DATA function. Method | Notes | =EVAL("Eigenvalues",A1:C3) | performs evaluation using symbolic or numeric methods depending on the inputs provided in A1:C3 | =EVAL("Eigenvalues",DATA(A1:C3)) | always performs evaluation using numeric methods |
Specifying numeric arguments. Using the EXPR function you can build up multi-function expressions for a single evaluation. Method | Notes | =EVAL("f",EXPR("g",EXPR("h",1)),EXPR("h",2)) | evaluates f[g[h[1]],h[2]] |
Specifying subexpressions. Mathematica functions may have defined options associated with them. To specify an optional argument you can use the RULE worksheet function. Method | Notes | =EVAL("ListPlot",A1:B100,RULE("PlotJoined",D2)) | specifies an option using the value in cell D2 |
Specifying an option. |