Questions tagged [conversion]

Questions on changing Mathematica expressions of one type or format to another, for example date formats, Boxes and other typesetting representations, or different units of measurements.

Filter by
Sorted by
Tagged with
49
votes
7answers
3k views

Character edge finding

The following line of code finds the edge of a character: ...
41
votes
2answers
8k views

The correct way to linearize colorspace before resizing, blurring etc

There was an interesting discussion on MathGroup dealing with the fact that image-processing functions in Mathematica (and many other software, including Adobe Photoshop) work with RGB, Grayscale etc. ...
30
votes
2answers
2k views

How do I extract the contents of a selected cell as plain text?

My aim is to extract the contents of an Input cells as plain text. Ideally I would like to be able to select one or more Input cells and press a button which would then extract the text from these ...
23
votes
7answers
7k views

How to express an integer number in English words?

How do I convert a number to a readable string? I would like to implement a function, inWords[], inWords[n_]:= ? which ...
21
votes
1answer
548 views

Why Except is so slow as compared to equivalent RegularExpression?

When comparing performance of the solutions suggested for this question I discovered that StringExpression involving Except is ...
21
votes
1answer
307 views

Can Mathematica convert a RegularExpression into a StringExpression or vice-versa?

I know that Mathematica can perform string comparison using either StringExpression or RegularExpression. Although regular ...
20
votes
2answers
482 views

Understanding evaluation and typesetting

Background So, one could be surprised by the fact that: Hold @ Grid[{{1, 2}}] (*or*) Hold @ Graphics @ Disk[] This issue and methods of prevention are ...
18
votes
4answers
1k views

How to convert Graphics3D object into an Image3D object?

How does one convert a Graphics3D object into an Image3D object? E.g., start with ...
16
votes
3answers
921 views

How to convert between various ItemSize/ImageSize units?

How can one convert between the implicit units used by Grid (ems and line height for horizontal and vertical dimensions) and printers points (in ...
15
votes
3answers
1k views

Display grayscale image as 3d plot

How to build 3d plot of grayscale image where x,y - pixel coordinates, z - pixel intensity? I tried ListPlot3D[ImageData[image]], but ...
15
votes
2answers
1k views

Exporting notebook to HTML, using conversion rules

The idea is to export the whole notebook to HTML with all the math equations in latex form. In this way we can add the mathjax script and it will take care of the math. Suppose we have the following ...
14
votes
4answers
255 views

How to convert this term to a Hypergeometric function?

term=8*(-1)^(1/4)*Sqrt[b]*q0^(3/2)*\[Kappa]* EllipticF[I*ArcSinh[((-1)^(1/4)*Sqrt[b]*r)/Sqrt[q0]], -1] This is a physical term and it is not convenient to appear ...
13
votes
3answers
441 views

How to extract something from DelaunayMesh and similar family of functions

I was looking at this question here and I tried the suggested idea by Anton Antonov to use DelaunayMesh It will look like this: ...
13
votes
5answers
1k views

Built-in way to convert Integer to Ordinal String

Is there a built-in way to convert an integer into its ordinal string representation (as per this page). That is, something akin to ...
13
votes
2answers
12k views

Converting Mathematica to $\LaTeX$

Is there a Mathematica-to-$\LaTeX$ converter, so that I can place Mathematica code, including things like A // MatrixForm, just as they are in the console straight ...
13
votes
1answer
220 views

Arrows from GraphicsComplex not converted to Normal form correctly

Bug introduced in 7.0 or earlier and persisting through 12.0 Show @ Graph[{1 -> 2, 2 -> 3}, Frame -> True] Normal @ % Is this a pure bug, or have I ...
13
votes
1answer
963 views

Exporting numbered equations to HTML/TeX using conversion rules

This question is a follow up from this one. It may also be considered a duplicate since I have already asked this question in stackoverflow almost a year ago. For a background on using numbered ...
13
votes
1answer
118 views

What types of string patterns can't be translated into regexes and hence do not work?

In a comment to related question Oleksandr R. made an interesting remark: ... because string patterns are converted into regular expressions and matched using PCRE, they are subject to some ...
13
votes
1answer
203 views

Safe alternatives to ToExpression

Background Conversion from string/boxes to expression is quite common. Very often the goal would be a simple switch from "1" to ...
12
votes
1answer
3k views

How to convert the Latex format to Mathematica input?

How to convert the Latex format to Mathematica input? For example, if I have a formula: $$ \sum_{m_{i}=0}^M\sum_{n_{j}=0}^N \frac{(z_{i}/2)^{m_{i}}(z_{j}/2)^{n_{j}}}{m!n!} $$ in terms of Latex ...
12
votes
2answers
243 views

How to define Normal for new “data types”

In Mathematica 9 and earlier, one of the points under "Details"/"More Information" section for the function Normal was (this is gone after version 10): I have ...
11
votes
2answers
755 views

Does Mathematica have an equivalent of Python's float.as_integer_ratio?

The Python programming language has a float.as_integer_ratio(x) function which exactly converts an IEEE 754 floating-point number into a numerator/denominator pair ...
11
votes
1answer
156 views

TextString evaluation leak

Bug introduced in 10.4 or earlier and persisting through 11.3 [...] I checked and reproduced your issue, and have passed along a report to our developers on the same [...] CASE:3972929 ...
11
votes
2answers
196 views

How do you import “ISODateTime” and capture the time zone?

Bug introduced in V10.4 or earlier and persisting through 11.3 (CASE:3920785) Back in version 10.2 or so, Mathematica began supporting the ISO 8601 date/time format, which is nice because it's used ...
10
votes
2answers
248 views

TeXForm handling of derivative higher than two

When the expression is only up to second derivative, TeXForm works correctly: ode = y''[x] == 0; TeXForm[ode] But when the ...
10
votes
2answers
387 views

Working with Java hashmaps from Mathematica

I'm using J/Link to access data from an external Java program. The data are represented as a ConcurrentHashMap (see the official specification here). ...
10
votes
2answers
230 views

Schrödinger's MatrixForm: feature or bug?

Recently I noticed a peculiar behavior of MatrixForm that I failed to find a way to explain. Consider the following example: ...
10
votes
1answer
695 views

How to export strings as pure ASCII?

The "PrintableASCII" characters set consists of 97 characters, including space (\[RawSpace]) and two control characters: the ...
10
votes
2answers
400 views

How to copy formatted numbers as MathML without quotation marks?

I have the following code: a = 6.08717*10^6; b = a/3; c = a*1.5; d = a^2; matrix={{a, b, c, d},{b, c, d, a},{c, d, a, b},{d, a, b, c}}; matrix // EngineeringForm ...
10
votes
1answer
242 views

A bug in Rasterize and Graphics: diagonal line is under-diagonal

I plot a straight diagonal line and then simply rasterize it. Consider what happens (Mathematica 8.0.4, 10.2, 11.1.1 and 12.0 on Windows 7 x64): ...
10
votes
2answers
1k views

Creating and editing new stylesheets

I'm trying to create a stylesheet, but the process has become painful. I'm sure that this has to do something with resetting something in Mathematica everytime I make changes to the stylesheet. To ...
9
votes
6answers
11k views

Convert a string into a list of numbers

I got the following problem I don't know how to solve or if it's at all possible to solve(I'm quite new to Mathematica and don't have an IT background, so please explain slowly if possible:)) I'm ...
9
votes
3answers
407 views

Create Array from list of indices/values

Is there is a performat way to convert something like {{0,0},a},{{0,1},c},{{1,0},d},{{1,1},e} into {{a,b},{c,d}} The ...
9
votes
4answers
1k views

How to convert a string having nested parentheses into an expression?

I am a Wolfram Language/Mathematica beginner and trying to convert STEP ISO10303 commands into geometrical regions. A simple command looks like ...
9
votes
1answer
737 views

How to use an image as a number?

How to define an image as a number? for instance I want to do something like this where but there is an error massage ...
9
votes
2answers
26k views

How can I create an empty JSON object?

For creating non-empty object, I use following syntax ExportString[{"key" -> "value"}, "JSON"] (*{"key" : "value"}*) But how can I create an empty object? ...
9
votes
4answers
469 views

Incompatibility of Row and TeXForm

Bug introduced in 9.0 and persisting through 11.0 Update: Since no one has been able to give a reason for this change in behavior or provide a solution I am tagging this as a bug. Please report it ...
9
votes
4answers
242 views

How can one convert an expression to a string while keeping the quotation marks of strings that are part of the expression?

How can I for example convert {"a","b"} to "{\"a\",\"b\"}", so keeping the quotations marks.? I tried ...
9
votes
1answer
196 views

ToExpression and ToBoxes aren't inverses of each other?

Applying ToExpression and ToBoxes repeatedly to Hold[1/1] gives many ...
9
votes
1answer
325 views

How can I convert the dates returned by FinancialData into decimal representation?

I'm trying to run a regression using Fit on the output of FinancialData["SPY", "Jan. 1, 2011"]. However, the dates returned ...
9
votes
0answers
260 views

Wolfram Data Framework specification?

Motivated by a recent question on the meaning of all sorts of W* acronyms, I would like to get more information about the Wolfram Data Framework (WDF). On its web page http://www.wolfram.com/data-...
8
votes
3answers
264 views

Graphics in Notebook Different from Graphics Expression?

Consider the expression TreeForm[a+b^2+c^3+d] which displays as This is a nice Graphics object, as I can prove by typing ...
8
votes
2answers
314 views

Programatically adding/retaining comments within a nested list

Is it possible to convert the following list of strings to computable numbers with the comments preserved? ...
8
votes
3answers
203 views

Re-encode text file to use Mathematica's character name, like \[Alpha]

How can I re-encode a text file (or string) so that non-ASCII characters will be represented using Mathematica's standard names? For example, if the original contents of the file was ...
8
votes
1answer
95 views

DateObject granularity conversion

Is there a way to convert the DateObject whose FullForm is: ...
8
votes
2answers
662 views

How to convert expression with Subscript to string

I've tried ToString[], but it doesn't work properly with subscripts: How to convert expr containing subscript to a string with ...
8
votes
1answer
303 views

How to convert arbitrary raw boxes directly into String?

This question is motivated by the recent question about searching inside of the NB files. According to the Documentation, ToString expects a high-level WL ...
8
votes
2answers
167 views

Reading Cells or Boxes expression by expression

Let's say we have a cell: (*newline*) (*newline*) Plot[ x, {x, 0, 1} ] (*newline*) Plot[x, {x, 0, 2}] How to read it expression by expression? So e....
8
votes
2answers
167 views

How to open and explore the codes of the system Palettes files

The built in Palettes of Mathematica are simply .nb files which can be found in the following place: ...
8
votes
1answer
112 views

Errors in converting LaTeX using ToExpression

I am trying to write a function which takes Maple Latex generated, feed it to Mathematica, use ToExpression then convert it back to Latex. This is because ...