The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
2
votes
3answers
230 views

How to convert numbers to currency values?

I am trying to create a way to convert some values of numbers into currency (dollars). The example I display below takes in three random numbers between -4 and 4, and rounds them to the second decimal ...
4
votes
1answer
273 views

Conversion between Piecewise[] and Abs[] representations [duplicate]

Is there a utility in Mathematica that can convert between two representations of an expression? The simplest example I can think of is Abs[x] Which I'd like to ...
2
votes
0answers
59 views

Is there a substitute for the “Show” function to use within the Mathematica kernel?

I needed to implement a function to convert an object from Graphics3D to Image3D, basically a 3D version of rasterisation (I need the geometry in a discretised form). I used the method suggested by R....
3
votes
1answer
156 views

How to restore a Notebook saved as Package?

A Notebook I was working on was saved as "Package" (with the extension ".m"). Upon opening this file, everything is unreadable. How do I convert this file back to ...
2
votes
1answer
498 views

Circle to Hexagon Conversion [closed]

I have a set of circles defined by a Middlepoint and a radius e.g. Circle1: x = 10, y = 10, r = 3 Circle2: x = 15, y = 2, r = 10 etc... But I want to have them ...
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 ...
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 ...
7
votes
1answer
146 views

Problem with conversion of UI controllers' boxes to expressions

Bug introduced in V10 and partially fixed in V11.1.1 TLDR Various of expressions which have fancy typeset form or are designed as UI elements won't survive ...
13
votes
1answer
116 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 ...
8
votes
1answer
151 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 ...
10
votes
2answers
395 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 ...
8
votes
2answers
166 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: ...
1
vote
2answers
274 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 ...
8
votes
1answer
300 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 ...
5
votes
1answer
210 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 ...
20
votes
2answers
479 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 ...
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....
1
vote
2answers
339 views

How to convert Image3D object into Graphics3D object and vice versa?

There are some rendering options (for example, Lighting) which are associated with the Graphics3D objects. I cannot apply these ...
6
votes
2answers
470 views

How convert old version 2.2 .ma files to .nb notebooks?

I have a lot of old Mathematica version 2.2 .ma files that simply crash the current (10.4.1) version of Mathematica if I try to open them. Is there some way to ...
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 ...
3
votes
1answer
298 views

Can one prevent $\TeX$ conversion from changing form of expressions?

This is similar to my previous question Can one prevent operators like `Factor` or `Apart` from changing full form of some algebraic expressions? but concerns $\TeX$ and I cannot figure out whether I ...
3
votes
1answer
99 views

$CellContext issue while trying to export the current output of a Manipulate

Having just read this question Getting variables out of Dynamic Modules after restoring the program and the Kuba's answer I'm trying to optimize my workflow. I'm writing a Mathematica notebook to ...
21
votes
1answer
306 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 ...
3
votes
1answer
72 views

An issue regarding the use of CopyToClipboard with dynamic content

Please, consider the following code: ...
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 ...
6
votes
2answers
190 views

How can DateObject handle calender weeks

I have dates given for a TimeLinePlot. These dates are in {year,week} format. DateObject ...
9
votes
0answers
258 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-...
5
votes
1answer
135 views

Custom rules for expressions in export to HTML(Fragment)

ExportString[Grid[{{a, b}}], "HTMLFragment"] ...
1
vote
0answers
302 views

Convert large KML coordinate datasets to UTM [closed]

I was wondering if there are ways to convert massive amounts of KML coordinates into UTM coordinates using Mathematica. Other programs would also be acceptable. Thanks. I have the KML file from ...
4
votes
1answer
303 views

convert MeijerG to form Standard Functions in Mathematica

I'd like to convert MeijerG[{{}, {1., 1.}}, {{0., 0., 4.}, {}}, -1. T λ] to its Standard Functions (For example Bessel function or ...). Any suggestion?
6
votes
3answers
319 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: ...
0
votes
1answer
137 views

Electromagnetism units conversion in Mathematica 10 (possible bug)

Is this a bug in Mathematica 10? Why can't I convert Amps/m to Gauss? ...
7
votes
1answer
5k views

Why Base64 ends with a newline? (\n)

Why everything converted to Base64 has a newline at the end? It isn't one of base characters, is it? ...
4
votes
1answer
91 views

Whitespace is lost during MathML -> XMLElement conversion

ImportString["<mtext> </mtext>", {"MathML", "XMLElement"} ] XMLElement["mtext",{},{}] while I'd expect: ...
3
votes
0answers
386 views

Export Mathematica to $\LaTeX$ properly

I am simply trying to convert an existing sample in Mathematica to $\LaTeX$. For example, if I open a new Mathematica notebook using styled templates such as Journal article and save it as $\TeX$. ...
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: ...
10
votes
1answer
229 views

A bug in Rasterize?

I plot a straight diagonal line and then simply rasterize it. Consider what happens (Mathematica 8.0.4, 10.2 and 11.1.1 on Windows 7 x64): ...
1
vote
1answer
85 views

FromDigits gives “not a list of digits” error for integer string in StringExpression rule of StringCases

I have large StringExpression that is used in StringCases. Some of the parts being pulled out are integer strings. These pull ...
11
votes
2answers
752 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 ...
0
votes
0answers
46 views

Possible bug of Exporting as HTMLFragment at Linux

This is the result of Mathematica 10.0.2 of Linux Version. There are two style inside one tag, and this fragment cannot be Imported as XML by Mathematica. This is the result of Mathematica 10.1 of ...
3
votes
0answers
75 views

How to convert a list of polynomials into a list of equations and plug into Contourplot? [duplicate]

Given a list q of polynomials (output of GroebnerBasis) in two variables I want to transform the list into a list of equations and plug it into CountourPlot. For ...
7
votes
3answers
537 views

Converting between AbsoluteTime and Unix time

By trial and error, I've found that the following gives the current Unix time: AbsoluteTime[] - UPOCH where UPOCH can be defined in any of the following ways: <...
4
votes
5answers
305 views

How can I convert a Piecewise into a nested If?

For later conversion into a programming language where if is the only conditional construct, I would like to convert a Piecewise ...
3
votes
2answers
226 views

What's real analogue for FromDigits?

FromDigits only works for integer strings. What's its real-number analogue?
3
votes
1answer
115 views

Converting path list to the nested list

I'm trying to convert the plain path list to the nested tree list like the following codes. ...
8
votes
2answers
650 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 ...
0
votes
2answers
460 views

Decimal-to-ASCII conversion

I have to write a program that converts a number (decimal notation) to an ASCII string. For example, x = 26728 (or 0x6868) and the string is "hh". I wrote this, but it seems that it is not the ...
5
votes
1answer
208 views

ConversionRules and style inheritance

Take the LaTeX-Article stylesheet stylesheet = FileNameJoin[{"Article","LaTeX-Article.nb"}]; Compare these outputs ...
2
votes
1answer
49k views

Conversion of Sine to Cosine

I'm solving equations with many Cosines and Sines. And I want to convert all the Sines to Cosines using trigonometric formulas such as cos(x)=sin(x+pi/2). How can I do this?
2
votes
2answers
82 views

How do I extract the value of a 'Style'?

I have a Style displaying an underlying Real value. For example I might have ...