Hot answers tagged

13

Nothing is like Sequence[]: it gets removed during evaluation. But there is one significant difference: it only gets removed from lists. {{Nothing}, {Sequence[]}} (* {{}, {}} *) {foo[Nothing], foo[Sequence[]]} (* {foo[Nothing], foo[]} *) Update from @ilian It only gets removed from lists is correct for Mathematica 10.4.0 and later; Nothing did get ...


4

Probably you should use NotebookEvaluate instead of SelectionEvaluate. According to the Documentation, By default, NotebookEvaluate evaluates the cells of a notebook in the same way that Get evaluates the lines of a package file. For example try: nb = CreateDocument[ExpressionCell[Defer[Pause[10]], "Input"]]; NotebookEvaluate[nb] Print["!"] The ...


4

There is probably no package or algorithm that can give you answer in all cases. However, I would like to suggest a semi-automatic solution. I will illustrate it with few examples. Notice, I do not know solutions in advance. Example 1 t[1] = Table[Sum[Fibonacci[3 i], {i, 0, k}], {k, 0, 10}] *({0, 2, 10, 44, 188, 798, 3382, 14328, 60696, 257114, 1089154}*) ...


4

There are two processes running. The first process is the FrontEnd. The FrontEnd receives your keypresses and renders text and plots. The second process is the Kernel. The Kernel receives commands to perform calculations, stores the states of variables, and does pretty much all the calculating. When you press <Alt>-., the FrontEnd immediately ...


2

f1[n_] = Sum[Fibonacci[i]*(-1)^i, {i, 0, n}]; If you know or suspect the general form of the model model = (-1)^n Fibonacci[b*n + c] + d; data = Table[f1[n], {n, 10}] // Simplify; f2[n_] = model /. ( NonlinearModelFit[data, model, {b, c, d}, n][ "BestFitParameters"] /. x_?NumericQ /; (Abs[x - Round[x]] < 10^-10) :> Round[x]) (* -1 + ...


2

It's all explained in the Documentation Center. Equal Subscript[e, 1] == Subscript[e, 2] == Subscript[e, 3] gives True if all the Subscript[e, i] are equal. LessEqual Subscript[x, 1] <= Subscript[x, 2] <= Subscript[x, 3] yields True if the Subscript[x, i] form a nondecreasing sequence. That is, the three arguments in Equal must be equal ...


2

Presumably you want a function like Normal that converts all NumberForm expressions to their plain numeric form. This can be done with replacement. expr = {NumberForm[N@Pi, 3], N@E, NumberForm[N@Degree, {1, 5}]} {3.14, 2.71828, 0.02000} expr /. NumberForm[n_, ___] :> n {3.14159, 2.71828, 0.0174533} To catch most number formatting wrappers we ...


1

A useful principle in using the Wolfram Language: Remove values you assign to variables as soon as you finish using them. See Defining Variables. How to Work with Variables and Functions Variables and functions are integral to the Wolfram Language's symbolic programming language. These "How tos" give step-by-step instructions for common tasks related to ...



Only top voted, non community-wiki answers of a minimum length are eligible