dionys
  • Member for 7 years, 3 months
  • Last seen this week
Generating terms of the Stirling series
12 votes

Using Series as suggested by Wolfgang Hintze: Series[n!, {n, Infinity, 4}]/(Sqrt[2 π n] n^(n Exp[n])) // FullSimplify (*Exp[(-1 - Log[1/n]) n + SeriesData[n, DirectedInfinity[1], {}, -1, 1, 1]^5] * (...

View answer
Character to replace _ in symbol names?
11 votes

The issue is that Mathematica interprets underscore as Blank and interprets my_variable as a Pattern, when what we'd like is a legitimate symbol name. Head[Unevaluated[my_variable]] (* Pattern ...

View answer
How to smooth the noise
10 votes

Mathematica has a lot of utilities for smoothing. If your data is evenly sampled, a simple MovingAverage filter may suit your needs, but your abscissa values jump around a bit: Part[Differences@data,...

View answer
How to make Import recognize a new file extension?
Accepted answer
8 votes

New solution using RegisterFormat from Wolfram Function Repository: ResourceFunction["RegisterFormat"]["BVH", <|"Extension" -> "bvh"|>] Original Post: Copy/paste from the excellent BVH ...

View answer
Import citation data for BibTeX using DOI?
7 votes

Using URLFetch with a specific header "text/bibliography" should return BibTeX citation data: URLFetch["http://dx.doi.org/10.1007/978-3-642-10892-1_3", "Headers" -> {"Accept" -> "text/...

View answer
How can I number the section titles automatically in Mathematica?
Accepted answer
7 votes

The documentation on Automatic Numbering mentions how to number section titles automatically. Section numbers can be tracked by creating an automatic numbering object linked to a counter. This can be ...

View answer
Newton's Method Glitch
Accepted answer
6 votes

Here's an attempt at a clean example using a stand-in definition for Iter. Note: it's generally better to avoid creating symbols that start with a capital letter or shadow built-in functions, so I've ...

View answer
Syntax for making a custom `Import` converter with parameters?
5 votes

RegisterImport has specific requirements for the form of the output returned by conditional raw importers: The output of the low-level function must match the form {elem->{subelem->output}}. The ...

View answer
How to change the brackets on a matrix
5 votes

Borrowing from another answer here, you can make your matrices display with bars using this function: makeBrackMat[mat_?MatrixQ] := DisplayForm[RowBox[{ StyleBox["|",...

View answer
Listing sequence with rules
5 votes

Module[{full, a5, b5, excl}, full = Tuples[{a, b}, 10]; a5 = Cases[full, {___, a, a, a, a, a, ___}]; b5 = Cases[full, {___, b, b, b, b, b, ___}]; excl = Cases[Union[a5, b5], Except[{a, a, a, a, a, ...

View answer
Plotting data with extremely small variation in the dependent variable
5 votes

Looks like a pretty boring plot, unless you do something to visualize those very small variations in the ordinate. Maybe this can point you in the right direction: data = {{-5., 1....

View answer
Number of line in website
Accepted answer
4 votes

One approach is to split the imported data on newlines using StringSplit so the length of the resulting list is the line count. Then we can use Riffle and StringJoin to get the selected lines: Module[...

View answer
Almost all integers contain the digit $3$
4 votes

int3[k_Integer] := Module[{fn}, fn = Boole@MemberQ[IntegerDigits[#], 3] &; fn /@ Range[k] // Total] int3[33] (* 7 *) Limit[int3[k]/k, k -> \[Infinity], Assumptions -> ...

View answer
Importing data from notepad to mathematica
Accepted answer
4 votes

Make some sample data consisting of numbers and spaces: samepleData = Module[{seed = ToString@Table[RandomInteger[{0, 10000}], 50]}, StringReplace[seed, {"{" -> " ", ...

View answer
BubbleChart ignores Ticks option
Accepted answer
4 votes

Ticks generally aren't visible on graphics, when Frame->True is set. Module[{ticks = {#/10., FromLetterNumber[#]} & /@ Range[10]}, GraphicsGrid[{{BubbleChart[RandomReal[1, {10, 3}], ...

View answer
How a novice user better understand the Q/A
4 votes

Built-in Mathematica symbols can be looked up directly in a Mathematica session by selecting the symbol/command text and hitting F1. This is also available in the menu: Help --> Find Selected Function....

View answer
Irregular image binning
3 votes

binPixels[img_, binSize_] /;Length[binSize]==2 := Module[{pieces, avg}, pieces = ImagePartition[img, {{1, binSize[[1]]}, {1, binSize[[2]]}}]; avg = Mean@Flatten@ImageData[#] &...

View answer
Error message Graphics`Colors`
3 votes

The message Get::noopen is a warning indicating that your package was not loaded. This particular package was useful in version 5.2 and earlier, but has been superseded by the functionality built ...

View answer
How to convert a matrix to MATLAB format?
3 votes

Multidimensional matrices can be converted to Matlab's input format using the ToMatlab package: << ToMatlab` m = {{0, 0, 2 Sqrt[4 + n], 0, Sqrt[4 + n], 0, 0, 0, Sqrt[4 + n], 0, 0, 0, 0, 0, 0, ...

View answer
Export Graphics using Move in Optica
3 votes

You should check out the OutputType option, which allows you to specify Graphics output instead of the default Optical System output from functions like AnalyzeSystem, DrawSystem, and ShowSystem. ...

View answer
Logic Gates - How to show eight ways an AND function can be realized using negative and postivie logic
3 votes

This sounds like something straight out of an undergrad EE course. If you're talking about circuits, the idea of positive and negative logic is in regard to the difference between the physical ...

View answer
Simple arithmetic operations on elements of a list
Accepted answer
3 votes

You should read through the help docs on accessing list elements. If your data is a list of lists in the following form w = {{417864.69,5332858.39,0.00,3629.824,2,0,0,0.10}, {417864.94,5332858....

View answer
How can I plot a list of 1-D data along the x-axis?
3 votes

You should check out the docs for List, Table, and ListPlot to get a handle on how Mathematica is set up to handle your data. Your data is already formatted as a 1-D List, so it can be plotted ...

View answer
ReplaceAll with a list of parameters
2 votes

keys = {a, b, c}; values = {1, 2, 3}; Flatten@Inner[Rule, {keys}, Transpose@{values}, List] (* {a -> 1, b -> 2, c -> 3} *) (a + b + c) /. % (* 6 *)

View answer
Why is Carbon and other elements (not available) in StoppingPowerData?
2 votes

As far as I know, StoppingPowerData is just a construct to interface with a compilation of NIST data, along the same lines as ChemicalData and ThermodynamicData. They cite three primary sources in the ...

View answer
Calculating a value
2 votes

You are seeing Null because that is what Print, by design, should always return. Ordinarily Print would also make a cell with your expression printed in it, but this doesn't work inside Manipulate and ...

View answer
How to draw table with multiple variables
2 votes

You should read the docs on defining functions in Mathematica. From there it is pretty convenient to generate tables of the values you want using Table, and then you can display this data with the ...

View answer
Setting value of number on certain decimal points
2 votes

Note that commas have a specific meaning in Mathematica syntax, and "." is normally used to mark the decimal. Another useful syntax detail to be aware of is "`" (NumberMarks), used to indicate the ...

View answer
Autoregressive Process Question
2 votes

Manipulate[ Module[{f = RandomFunction[ARProcess[x, {y}, z], {1, 10^2}]}, ListPlot[SeedRandom[1234]; f, Filling -> Axis, PlotRange -> {Automatic, {-0.5, 0.5}}]], {{x, -a}, -1, 1}...

View answer
Different Order of Magnitude on Distinct Interval Plot Axes
2 votes

Module[{f, p1, p2, opts, labels, nlist}, f[x_] := 9*10^-9*(Exp[x/(2*23*10^-3)] - 1); opts = {Frame -> True, AxesOrigin -> {0, 0}, FrameTicks -> {{labels, None}, {Automatic, None}}...

View answer