masterxilo
  • Member for 8 years, 9 months
  • Last seen more than a week ago
Learn Mathematica (Wolfram) Language in one day
Accepted answer
16 votes

For learning what I consider "just the wolfram/mathematica language" I would proceed as follows and start at the very low-level basics: Learn what is meant by a symbolic expression: ...

View answer
Partitioning with varying partition size
15 votes

This can be implemented elegantly with FoldPairList and TakeDrop (both new in v10.2), in fact it's one of the examples in the documentation: FoldPairList[TakeDrop, Range[10], {2, 3, 5}] {{1, 2}, {3, ...

View answer
Why is Graph an atomic expression in Mathematica?
10 votes

Graph being AtomQ has about the same implications as doing lots of overloadings of the type Part[_Graph,___] := Error[]; Replace[_Graph,___] := Error[]; .... It signifies that it is an "abstract data ...

View answer
Is it important that the front-end has a built-in parser?
10 votes

The result of the front-end's parsing is definitely used, but it does not need to be complete, it seems. This can be seen by constructing Cells/Boxes manually. Try RawBoxes@RowBox[{"1", "+", RowBox[{...

View answer
What are the most common pitfalls awaiting new users?
9 votes

Association/<||> objects are Atomic and thus unmatchable before 10.4 AtomQ@Association[] yields True. This is confusing because it is not stated anywhere in the manual. For example tutorial/...

View answer
Fast way to export large amount of data in "Table" format
Accepted answer
9 votes

I started working on a package and LinkedLibrary achieving significant speedups with this job: data = Table[{1. x, 1. y, 0.}, {x, 1000}, {y, 10^3}]~Flatten~1; << ExportTable` AbsoluteTiming@...

View answer
Programmatic formatting for Mathematica code - possible?
7 votes

It is worth mentioning GeneralUtilities`PrintDefinitions. Use it like <<GeneralUtilities` then GeneralUtilities`PrintDefinitions@f to get a pretty-printed, formatted version of ??f in a new ...

View answer
Is there any PythonForm ? to automate Sin[] to math.sin()?
Accepted answer
6 votes

If I where to do this manually, I would start with PythonForm~SetAttributes~HoldAll (*known symbols*) PythonForm[Sin[x_]] := StringTemplate["math.sin(``)"]@PythonForm@x PythonForm[Times[a_, b_]] := ...

View answer
How can I make Mathematica do, ArcTanh[x] + ArcTanh[y] = ArcTanh[x+y/1+xy]?
6 votes

Probably, MathematicalFunctionData["ArcTanh"] knows about this. First let's see what categories of things are known: MathematicalFunctionData["ArcTanh", "Properties"] ah well, let's just list them ...

View answer
Why doesn't Mathematica abort evaluation when I tell it to?
6 votes

If you ever develop a library for LibraryLink, be sure to include calls to AbortQ to support aborting lengthy computations. Code that runs for a long time should call AbortQ to see if the user has ...

View answer
Fast way to export large amount of data in "Table" format
5 votes

Here's an alternative: The package https://github.com/Masterxilo/PLYExport implements exporting of Points in PLY format, and extends Export with {"PLY", "BinaryFormat" -> True} to use it, allowing ...

View answer
List of Recently Opened Files
Accepted answer
5 votes

This gives the recently opened files as a list of rules: Lookup[Options@$FrontEnd, NotebooksMenu] Just the file names: First /@ Lookup[Options@$FrontEnd, NotebooksMenu] FileNameJoin instead of ...

View answer
Testing that an algorithm has converged
Accepted answer
4 votes

I think all of these algorithms can be described in the following form: Assume your iterative numerical algorithm f takes and returns a pair {x, additionalState}. x is the quantity (tensor) that ...

View answer
How to get the height of a triangle from three points
4 votes

Let's ask FormulaData. These should suffice (there are not that many anyways :( ): Flatten@{FormulaData["TriangleAreaSSS"], FormulaData["TriangleAreaBH"]} // TeXForm (I started looking for something ...

View answer
Disable "The option to save automatically after each result is enabled" warning
Accepted answer
4 votes

Go to Edit > Preferences > Messages and set Minor user interface warnings: to Ignore.

View answer
Where can I find examples of good Mathematica programming practice?
4 votes

ApplicationMaker shows how to create packages that look like native functionality, including integration into the Documentation Center.

View answer
Is it possible to attach a debugger to a dynamically linked library on the supported OS?
4 votes

https://mathematica.stackexchange.com/a/118739/6804 discusses compiling a library link dll and attaching a debugger. With say Visual Studio, you can just attach to process -> WolframKernel.exe after ...

View answer
Has anybody been able to build WSTP applications under Visual Studio 2015's IDE?
4 votes

The following approach works for me with a Vanilla Visual Studio 2015 installation (14.0) and Mathematica 10.2 (for Windows 8.1, x64). Open vs2015. Create a new empty project, let us call it ...

View answer
Print[] to console in Mathematica 11
3 votes

Run SetOptions[$FrontEnd, PrintAction -> "PrintToConsole"] The setting will persist across restarts of Mathematica.

View answer
Running external pdflatex command and importing the generated PDF document
3 votes

It would be helpful if Mathematica could at least say that the error lies in the pdf version mismatch. Thanks @Jens. Here is another way to fix a pdf generated from pdflatex to be Importable in ...

View answer
How to draw an infinitely long line that automatically scales with the plot?
3 votes

This can now be done with an InfiniteLine in Epilog or Prolog since version 10: Manipulate[ Plot[10^f*x^3, {x, -E/2, 1}, PlotRangePadding -> 0, Epilog -> InfiniteLine[{0.5, 0}, {0, 1}]], {{...

View answer
Why does `Times` evaluate within `Hold` when doing replacement?
3 votes

This is purely a formatting "issue":

View answer
How to change styling of HoldForm expressions?
3 votes

I'm using this now: Unprotect@HoldForm; Format[HoldForm[x_], StandardForm] := {boxes = MakeBoxes@x, bg = LightBlue}~With~ RawBoxes@ InterpretationBox[ TagBox[StyleBox[boxes, ...

View answer
Improving `$AssertFunction` to always tell what the assertion test resulted in
3 votes

Defining $AssertFunction might be a place to get started, but it is not ideal since when it gets called, the evaluation will have already happened. You will change the program behaviour if you ...

View answer
How to use "managed library expressions" to free the memory?
3 votes

For returning multiple values, you'll find it much easier to return them via a WSTP/Mathlink link object. Start from this: #include <mathlink.h> #pragma comment(lib, "ml64i4m") // only 4 seems ...

View answer
How is pattern specificity decided?
3 votes

It seems the behaviour of Internal`ComparePatterns changes from version to version. On 10.4.1 I get Internal`ComparePatterns[(_) .., __] Internal`ComparePatterns[__, (_) ..] (*=>*) "Specific" "...

View answer
What are the most common pitfalls awaiting new users?
3 votes

Understanding $Context, $ContextPath the parsing stage and runtime scoping constructs A symbol in Mathematica can never be without a context. We can assume that the internal representation of any ...

View answer
How to transform the $y$ values in a list of $(x,y)$ pairs
3 votes

{#1, f@#2} & @@@ data But we can also generalize MapAt to do the job: Note that MapAt[f, data, {1, 2}] === {{1, f[0]}, {0, 1}, {1, 1}} So we can use MapAtP[f_, expr_, positionPattern_] := ...

View answer
SymbolicC`: Is there a CChar, i.e. a way to generate a single character constant?
2 votes

You could do CArray[CString@"a", 0] // ToCCodeString giving "a"[0] maybe wrap it in CParentheses. Alternatively, just put it there verbatim (losing the type information): CAssign[a, "'a'"] // ...

View answer
Possible bug with `KeyValuePattern` and `Optional`
Accepted answer
2 votes

This was fixed in 11.0.0. The output is all 0 now as expected.

View answer