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: ...
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 ...
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: ...
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. ...
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 ...
9
votes
4answers
467 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 ...
20
votes
2answers
481 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 ...
16
votes
3answers
920 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 ...
9
votes
1answer
195 views

ToExpression and ToBoxes aren't inverses of each other?

Applying ToExpression and ToBoxes repeatedly to Hold[1/1] gives many ...
7
votes
1answer
3k views

Combine multiple PDF files into one document

I have multiple single page PDFs I'd like to join together into a single file. (Obviously I mean the file format and not the probability distributions here!) I'm aware of free online services such as ...
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 ...
7
votes
3answers
235 views

Convert frequency counts to long notation in Mathematica

I have a series of frequencies of values, e.g. 5 times 1, 10 times 2 and 5 times 3, as in list={{1,5},{2,10},{3,5}} and I would like to convert this to long ...
10
votes
1answer
688 views

How to export strings as pure ASCII?

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

Why doesn't Normal[] work?

I have a polygon on which I'm applying a GeometricTransform and I want to get the coordinates of the transformed polygon. ...
8
votes
1answer
302 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 ...
7
votes
1answer
504 views

How to write aligned equations and export them HTML/TeX

This question is mainly about exporting to HTML/TeX. For those of you who do not know how to write aligned equations in Mathematica please see this answer. Lets assume that you modified your ...
7
votes
2answers
3k views

How to convert a string of number into real numbers without precision loss

I searched and did not find similar answers which can resolve the 'no precision loss' issue. A sample string is: ...
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 ...
5
votes
1answer
214 views

Decoding GZIP encoded Body, BodyBytes (ByteArray) and BodyBytesArray from URLRead

When calling the Stack Exchange API v2.2 using the new (Mma11) function URLRead we get a GZIP encoded Body in alternative formats: ...
11
votes
2answers
753 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 ...
6
votes
3answers
550 views

Transform Piecewise[] into sum of indicators

I'm interested in transforming a piecewise defined function into a sum of indicator functions, ultimately with the aim to be better able to integrate them. As an example I would like to transform the ...
8
votes
3answers
201 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 ...
7
votes
2answers
543 views

Revert FullForm-ed text to prettyprinted

Sometimes strings in a notebook/package file end up garbled due to some unknown/unintentional conversion of the expression/cell/notebook. I could not find a way to revert such unreadable text to its ...
6
votes
5answers
1k views

How to get exact Rationalize of a decimal number?

This is on Mathematica 11.1 on Windows 7. I have this value 0.97646105481464028 which I'd like to get exact rational for it. I have thought that every terminating ...
4
votes
2answers
1k views

How do I convert imported STL files to 3D images?

After importing a 3D image in STL format, my possibilities in regard to "3D Volumetric Image Processing" seem rather limited. All examples are given with TIFF files. Is there a way to convert from STL ...
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? ...
6
votes
3answers
321 views

Looking for PostScriptForm or ForthForm to print expressions as RPN code

Mathematica has very useful functions CForm and FortranForm. I want the same for a different language: ...
6
votes
3answers
320 views

Programmatically convert notebook input cells to text file

I have ~150 student-submitted Mathematica notebooks for an assessed assignment. While I've been marking them, I'm suspecting there is a reasonable amount of plagiarism going on, when multiple students ...
4
votes
4answers
951 views

Converting inequalities to intervals

I have an inequality, ie: 1.57116 < g < 14.1405 There will be a large set of similar inequalities, and I want to find the intersection of them all. I figured it would be easier to convert the ...
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 ...
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 ...
13
votes
1answer
202 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 ...
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 ...
6
votes
2answers
202 views

How to convert a RawArray of bytes to ByteArray?

A ByteArray can be converted to a RawArray: ...
5
votes
1answer
211 views

How to get “one Cell - one line” code format inside of NB files?

The PageWidth option controls the way the Cell's content is displayed, not the manner it's written in a ...
4
votes
1answer
163 views

Convert a Notebook directly to a package with boiler plate

I want to be able to turn a bunch of notebooks I have into packages so I can more easily share them with others, without having to go through the boiler-plate of choosing which cells to export / doing ...
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 ...
10
votes
2answers
399 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): ...
8
votes
1answer
152 views

Convert expression to string in a reversible manner

What is the best way to convert an expression to a string in a reversible manner? I need a toStr function so that it is always true that ...
5
votes
1answer
247 views

A bug in converting some Unicode characters into FullForm?

Currently I know only one well-documented way to convert all special characters in an arbitrary string into their FullForm: In ...
5
votes
1answer
729 views

Converting 3D graphics to 2D for better export

I noticed that exporting a Graphics3D object into a vector graphics format, like SVG or PDF, produces a rasterized version of the graphics, while 2D objects are ...
2
votes
1answer
134 views

Is NumberForm double rounding numbers?

A number like 0.644696875 is represented internally as 0.6446968749999...: N[FromDigits[RealDigits[0.644696875, 2], 2], $MachinePrecision] (* 0.6446968749999999 *) ...
2
votes
2answers
316 views

Want to convert a string to a SHA512 Base64 value

I am having trouble converting this: "333" Into this: "XjFVd0052XxfnhfBCMKz4EhaQ64069GW9hpvi/cy73GknlcQWUz8c5HbEU7fmfXaPtlu8dbKXlmOhfkb1B5+6w==" It is for a web based program (I need to get a ...
1
vote
2answers
92 views

Command to change binary mlf terms into Subscripted mlf terms?

I express multilinear functions in the following format. Is there any ready command to convert them to multilinear functions easily? Input ...
6
votes
1answer
339 views

How to transform general Ellipsoid into rotated axis-oriented one?

Recently, I discovered a long-standing bug in the rendering of Disk and Circle primitives after applying ...
1
vote
2answers
275 views

How can I re-create the original Graph object from Graphics object into which that Graph was converted previously?

We can convert a Graph into Graphics very easily like it is shown in this answer. My question is: how to convert a ...
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 ...
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 ...
7
votes
1answer
1k views

Visualize a tree structure using TreeGraph

I have a code that generates a tree of graphics objects. The structure can be visualized like this, with each Rule constituting a parent child relationship: ...