How to manipulate expressions structurally, not necessarily complying with the rules of algebra.

learn more… | top users | synonyms

2
votes
1answer
22 views

Conditional replacement of all occurrences of a variable?

I know there is functionality in Mathematica to perform replacements like: x[a] d[a,b]/.y_[z_] d[z_,p_]->y[p] Which naturally gives ...
15
votes
1answer
323 views

List of atomic expressions

I was surprised to see Graph objects are atomic. Is there a way (through documentation or programmatically) to find all atomic heads? The ones I know of are: ...
6
votes
4answers
143 views

Expression manipulation: Explode sums and products? [duplicate]

I wonder if the functionality exists to explode a sum, or product? What I mean by that is the following. Imagine, you have input data data = a + b c - d e f ; Is ...
2
votes
2answers
113 views

How can I get Solve to combine Sin/Cos into Tan?

I want to solve an equation in x, containing Sin[x], Cos[x] and a positive real constant ...
5
votes
6answers
120 views

Trying to write out the prime factorization of a number with CenterDot and Superscript

I am trying to use CenterDot and Superscript, in conjunction with Apply to write out the prime factorization of any given integer. Everything works well UNLESS the prime factorization of the number ...
3
votes
1answer
202 views

Indexing of Large Autonomous System of Equations for Use in NDSolve

I currently have a list of ~150 autonomous ODE's that I need to be able to work with using NDSolve. Fortunately I already have them formatted in plaintext, which ...
0
votes
1answer
43 views

Factor out square root terms [closed]

How to go from Sqrt[x^3]Sqrt[x - a x]/x to x Sqrt[1 - a]? All terms inside square are positive.
2
votes
1answer
51 views

Range and decimal digits [duplicate]

When I set Plot[Sin[x], {x, -2, -1}, Frame -> True, Axes -> False, FrameTicks -> {{Automatic, Automatic}, {Range[-2, -1, 0.2], Automatic}}] I ...
4
votes
0answers
187 views

Strange behavior of undocumented RawArray and ArrayObject expressions

I discovered several strange results and inconsistencies while trying to understand what undocumented RawArray and ArrayObject ...
5
votes
4answers
191 views

Concatenating strings, unevaluated expressions and evaluated expressions/values

Maybe this is something very simple to some of you. Anyway, I think this can be useful to many others like me. I would like to build an output that involves strings, unevaluated expressions and ...
8
votes
2answers
180 views

Keep Mathematica from simplifying functions with a specified Head

I want to run Simplify and/or Refine on various expressions, but keep it from touching anything that contains a specific ...
3
votes
3answers
82 views

Unexpected Behaviour with local variables and ToExpression

I encountered an unexpected behaviour in my mathematica-code, and want to understand whether that's a mathematica bug, or a misinterpretation on my side. ...
4
votes
2answers
186 views

Time-efficient creation of matrix

I have expressions like xx1=FF[1, 1] GG[1, 1] + FF[1, 1] GG[2, 2] + FF[2, 2] GG[2, 2] xx2=2*FF[1, 2] GG[1, 1] + FF[1, 1] GG[1, 2] + FF[2, 2] GG[2, 2] and I want ...
3
votes
2answers
107 views
2
votes
1answer
96 views

Extracting rational coefficients from an irrational sum [closed]

I have a function that returns results that always can be represented as $p+q\,\pi^2+r\ln2+s\ln^22+t\sqrt2$ where $p,q,r,s,t\in\mathbb Q$. But the actual Mathematica expression returned not always in ...
2
votes
3answers
83 views

Problem with InverseFunction of Sqrt

I want to build a table of InverseFunctions, f.e.: ...
0
votes
3answers
98 views

List of Coefficients of Expression with symbolic Terms

(I am affraid that this is a duplicate, but I read several already asked questions and non of them helped me. If it's already answered, please tell me) I have expressions like this ...
-1
votes
1answer
65 views

How to get solution from DSolve

How to get the solution from DSolve in such way that there is no need to copy the result. When for example solving: ...
4
votes
1answer
74 views

How do I constrain variables to a user-defined domain in ArgMax?

I am trying to ArgMax a function over x, but x is only defined between ...
8
votes
1answer
96 views

How to get a list of all expressions in a notebook matching a certain pattern?

Suppose I have a Mathematica notebook saved to a certain location on disk. Given a pattern I need to get the list of all expressions matching this pattern that appear in input, output or print cells ...
13
votes
2answers
438 views

How to embed an image into a string?

Note: The bug described in the post is in Mathematica 9, and has been fixed in 10.0. The documentation for String contains the following statements: Strings ...
1
vote
1answer
53 views

Can someone please help me to state assumption?

I am currently trying to solve under what condition does the following term will be zero? ...
1
vote
2answers
63 views

How does one go from a string to the contents of a variable with the same name?

What command should I use if I want to convert a string to the contents of a variable with the same name as the contents of that string withing a function. ToExpression[] doesn't seem to do it. ...
8
votes
0answers
196 views

How to convert a notebook cell to a string retaining all formatting, colorization of identifiers etc?

I have an opened Mathematica notebook containing several cells. Suppose, I am interested in one of them -- it may contain a complete or incomplete expression (e.g. with syntax errors, highlighted ...
0
votes
1answer
56 views

Is there a command returning information about a particular object? [closed]

Suppose I have a variable var1, a function MyFunction, and a graphic SomePlot. I remember ...
11
votes
2answers
584 views

Displaying a series obtained by evaluating a Taylor series

Description of problem I would like to use Mathematica to display the series obtained by substituting a value for $x$ in a Taylor series expansion. The terms of the series will be rational numbers, ...
1
vote
2answers
125 views

Stopping Mathematica from reordering expressions [duplicate]

I want Mathemtica to stop manipulating my polynomials! I mean, I want the output of Print[3 x + 5 + x^2] to be just $3x+5+x^2$, not $5+3x+x^2$ as Mathematica ...
0
votes
2answers
68 views

Convert an expression from one form to another

I have this expression -0.433284-0.758719 x+0.00289158 x^2-0.443672 y+0.00149027 y^2 I want to express it in terms of ...
1
vote
1answer
31 views

Adding various combinations of rational expressions [closed]

as a newbie to Mathematica I wonder if someone can help... I'm generating a puzzle worksheet for some students and wish to add linear rational expressions, three at a time from a pool of six. e.g. ...
3
votes
1answer
71 views

Convert an expression's symbols of form a$x to a[x]

I want a function that takes expressions of the following form: a$x and converts them to a[x]. In particular, consider the ...
0
votes
1answer
144 views

How can I obtain Wolfram Alpha's “alternative forms” of an expression inside Mathematica?

When I type in Wolfram Alpha, say, cos(a+b) or cos(a+b)^2 or (OK this next one can easily be obtained in Mathematica, ...
7
votes
3answers
129 views

Thread over uneven (ragged) expressions with full functionality?

There are a number of questions on this site about "threading" including several relating to uneven (ragged) lists. However, none that I could find deal with the full functionality of ...
2
votes
4answers
367 views

How to completely delete the head of a function expression

Is there any way to completely remove the head of an expression function? For example, how would I remove the head Cos from ...
0
votes
1answer
54 views

Converting expression to C

I have an expression of the form ...
5
votes
5answers
171 views

Is there an analogue of the Variables command for general expressions?

The command Variables[poly] gives me a list of all variables that appear in the expression poly, which involved sums, ...
2
votes
3answers
372 views

How to manipulate nested expressions?

I have the following expression, only slightly complicated, and I'd like to do two things: Plot the elements of the lists (though messy, all are in the same ...
2
votes
1answer
45 views

Quoting definition explicitly

I'm trying to quote a definition using DownValues, OwnValues, etc. Everything seems to be fine, except for temporary symbols' ...
8
votes
2answers
188 views

The most external subexpression with given pattern

Suppose there is a deep expression with several instances of some _f. I want to get the most external case of _f from it (I also ...
1
vote
1answer
37 views

Converting an expression to modular arithmetic automatically

I have the expression $\frac{1}{15} \left(-(-1)^n-5\times 2^{n+2}+3\times 2^{2 n+1}+15\right)$ which I want to calculate mod m for a very large n. My current method is to ask for this exression in ...
2
votes
1answer
155 views

Truncate High order terms

Suppose I want to compute this : Series[Sin[1/f], {f, Infinity, 10}] but finally I prefer Sin[1/f] up to the fourth order in ...
5
votes
1answer
83 views

MapIndexed stops at levelspec 1 if only the index is passed?

If the function passed to MapIndexed references the first (or data) argument, the following performs as expected: ...
0
votes
2answers
77 views

Expand expression into quotient of negative power series

I have a function T(z) and want to expand it to the following form: At the end I want to have a list of equations, which can calculate a0, a1, a2, b0, b1 and b2 with different values of h1, h2, ...
2
votes
3answers
189 views

Conjugating symbolic expression

I am trying to conjugate a symbolic expression, and I have explicitly stated the real terms. However, I simply can't get it to work: ...
1
vote
1answer
42 views

expression contained across multiple cells

Is it possible to span one expression across multiple cells? E.g. long if statement or function evaluation. I looked in documentation and searched forum/google and could not find.
3
votes
2answers
198 views

Replace every Minus to Plus in Expression

Thought this is a rather simple thing, but I was not able to find a solution: I have a polynomial expression like: expr1=a^2-b+c*d expr2=a-b expr3=-a+b-c and ...
0
votes
1answer
81 views

Decompose Expression into Segments

Say I have an expression test = 3 x1^2 - 2 x3^-3 and I would like to decompose the expression into {3 x1^2, -(2/x3^3)}, I can do ...
0
votes
1answer
87 views

Working with functions

I am required to write a function that takes a function as a parameter. ...
17
votes
1answer
486 views

List manipulation to build a functional expression

Since Mathematica deals with Head[a, b] as an expression in this way The first Part of Head[a, b] is ...
0
votes
1answer
132 views

Patterns of function-arguments in expressions

I want a function that compares an expression with a specific pattern. The expression has always the following form: ...