# Tag Info

16

First of all, I agree, as OP mentioned in his comment, ANTLR is one of the proper ways to go. Now for this specific task, it might be easier to just compose a parser in the "dirty" way, except we don't have to go so far to regex. In my opinion Mathematica's StringExpression is much more powerful and very suitable for the job. All we have to do is (as OP ...

8

I extended the original question to support piping like the following. wget -qO- "http://google.com" // cat and it outputs the following. cat[][wget[-qO-,http://google.com][]] To get the following. CellPrint@ Cell[BoxData[""], "Input", Evaluatable -> True, CellEvaluationFunction -> Function[ Module[{t}, t = List@ReplaceRepeated[ ...

7

Question 1: What is the typesetting in Mathematica? What procedures does it include? I think that this 2008 year MathGroup post by John Fultz completely answers this question, so I'll cite it here: In version 6, the kernel has absolutely no involvement whatsoever in generating the rendered image. The steps taken in displaying a graphic in ...

5

As I somehow forgot but Szabolcs reminded me many System variables (typically with names beginning with $) check the values they are set to, e.g.:$MinPrecision := -6 $MinPrecision \$MinPrecision::precset: Cannot set \$MinPrecision to -6; value must be a non-negative number or Infinity. >> 0 In this case the check causes evaluation you do not ... 5 Since any function in Mathematica can be used in postfix form by appending & to make it a pure function, the following code can be used: In[39]:= 20 // Range[#]-1 & // Map[#*# &] // Select[EvenQ] // Take[#, 10] & // Fold[Plus, #] & Out[39]= 1140 Alternatively, Total or Apply[Plus] could be used instead of Fold[Plus, #] &; Fold is ... 5 This is an extended comment. This behaviour is new in 10.4. I can reproduce it with 10.4.1 on OS X, but not with 10.3.1. This may be related: DistributeDefinitions and synchronization in Mathematica 10 We can try to analyse what happens like this: z := (Print[$KernelID]; 1); SetSharedVariable[z]; ParallelEvaluate[z] ...

4

To change the assumptions dynamically, this can be used: $Assumptions := b b = {c > 0}; Refine[{c < 0, c == 0, c > 0}] b = {c < 0}; Refine[{c < 0, c == 0, c > 0}] If you need to evaluate the Print every time, this can be used:$Assumptions := Evaluate[b] b = {c > 0, Unevaluated@Print[kount]}; kount = 1; Refine[{c < 0, c == 0, c > 0}] kount = 2; ...

4

I am going to attempt to answer your questions off the cuff. I have been somewhat inactive on this site recently and also not using Mathematica much, so I am surely not at my best, so "take this with a grain of salt" as they say. Question 1 What is the typesetting in Mathematica? What procedures does it include? Typesetting is anything that is done for ...

3

ClearAll[leftSplit, rightSplit] leftSplit[q2_?NumericQ] := NMinimize[Max[Abs[q1 - 0], Abs[q2 - q1]], {q1}] rightSplit[q2_?NumericQ] := NMinimize[Max[Abs[q3 - q2], Abs[1 - q3]], {q3}] NMinimize[Max[leftSplit[q2][[1]], rightSplit[1 - q2][[1]]], {q2}] (* or NMinimize[Max[leftSplit[1 - q2][[1]], rightSplit[q2][[1]]], {q2}] *) {0.5, {q2 -> 0.5}}

1

Perhaps something like: test[steps_] := Module[{}, n = 0; Print["% Complete: ", Dynamic[n*100/steps]]; For[n = 0, n < steps, n++, Pause[1]]; NotebookFind[SelectedNotebook[], "Print", All, CellStyle]; NotebookDelete[]] See also: A self-deleting button to delete Print cells

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