How to manipulate expressions structurally, not necessarily complying with the rules of algebra.
12
votes
2answers
237 views
How to embed an image into a string?
The documentation for String contains the following statements:
Strings can contain any sequence of ordinary and special characters:
…
Strings preserve ...
7
votes
3answers
164 views
Is it possible to define custom compound assignment operators like ⊕= similar to built-ins +=, *= etc?
I would like to do something like this:
...
4
votes
0answers
71 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 ...
6
votes
3answers
132 views
Counting multiplications (complexity function)
I'm trying to count the number of times multiplication appears in an expression (for the purpose of constructing a ComplexityFunction that would help me simplify a terrible algebraic expression for ...
0
votes
0answers
146 views
Collapse a Sum / factor an element out of a sum
I am trying to get something in the form of a $\Sigma (\dots) * \alpha_i = (\dots)$ from the output of the code below. The thing is that I cannot figure out how to tell Mathematica to "collapse" down ...
4
votes
1answer
78 views
How to decompose a complex expression containing repeated subexpressions? [duplicate]
Suppose I have an expression like
...
1
vote
1answer
117 views
How can I get Mathematica to write Log instead of ArcTan?
ArcTan really bothers me, so is there a way to make Mathematica write Logarithm instead of ...
2
votes
1answer
102 views
Indexing of Large Autonomous System of Equations for Use in NDSolve
I currently have a list of ~150 autonomous DAE's (differential-algebraic equations) that I need to be able to work with using NDSolve. Fortunately I already have ...
18
votes
7answers
596 views
How do I get my equation to have the form $(x-a)^2 + (y-b)^2 + (z-c)^2-d = 0$?
I want Mathematica to express the equation $$-11 - 2 x + x^2 - 4 y + y^2 - 6 z + z^2=0$$ in the form $$(x - 1)^2 + (y - 2)^2 + (z - 3)^2 - 25=0$$ How do I tell Mathematica to do that?
2
votes
3answers
158 views
11
votes
3answers
231 views
Comparing Mathematica expressions like diff
I am looking for a way to compare (or "diff") two Mathematica expressions, similarly to how to diff utility can compare two text files and report the differences.
Has anyone already written such a ...
2
votes
1answer
67 views
Examine function parameters programmatically
I write a lot of scripts in Mathematica and I'd like to eliminate the boilerplate that parses command-line arguments and assigns them to variables of the correct type before doing the real work. I was ...
-1
votes
1answer
65 views
How to extract the coefficient from an expression
Here is the expression.
I want to extract the coefficient just as the table showing below.
I can do it by hand, but I expect a code that can automatically identify how many differenct terms ...
1
vote
1answer
88 views
Trying to show an expression is always zero
I have a symbolic matrix
$$m = \begin{pmatrix}A1 & B1 & C1\\A2 & B2 & C2 \\ A3 & B3 & C3\end{pmatrix}$$
and I believe that Det[m] is ...
7
votes
1answer
282 views
How do I expand a sum?
I have a problem with Mathematica's symbolic manipulations. As an example, consider the following expression:
$$\sum _{i=1}^n -2 x_i \left(-a x_i-b+y_i\right)=0$$
How do I get Mathematica to expand ...
9
votes
1answer
151 views
Why is ReplaceAll behaving like this?
I'm learning to use the ReplaceAll function and I found the behavior of which is quite confusing.
For
Sqrt[f[x, y]] /. f[___] -> u
Mathematica returns
...
0
votes
2answers
77 views
Dropping Higher Order Terms in symbolic evaluation
I have a series of symbolic manipulations (along with some coefficients).
As a sample, here is one of the intermediate forms
...
1
vote
1answer
67 views
Match and replace subexpression
I would like to replace the expresion $(n1-1)$ to $z1$ in following:
In[1] := 2*n1*p[n1-1,n2]
Out[1] := 2*(z1+1)*p[z1,n2]
I have tried ...
33
votes
2answers
708 views
Head and everything except Head?
I have been working on picking expressions apart using Head and Part and encountered a little mystery. Consider the canonical ...
1
vote
2answers
74 views
2
votes
2answers
96 views
How to change the Integer to a special form in an expression?
I have an expression. I want to change all the Integers to a new form. The rule is, x_Integer->x._f. But we should consider some special cases.
For example,
...
4
votes
4answers
136 views
Extracting variables from an expression
I'm looking for a way to extract a list of variables from an expression, for example with an input like:
...
0
votes
1answer
141 views
2
votes
1answer
133 views
Variable name string to expression
I'm not sure how to name this problem appropriately. But anyway.
I have, say, three variables (arrays in my case), which I call:
A1, A2, A3
I would like to ...
6
votes
2answers
150 views
How to get the matrix coefficient from a QuadraticForm expression in a very fast way?
As we know, QuadraticFormDistribution is the distribution of z.a.z + b.z + c for a real-valued p x p symmetric positive definite ...
6
votes
3answers
227 views
Threading Distribute[]
I wish to use Distribute[p.(q+r)+m] to get p.q+p.r+m. However, Distribute apparently does not thread through all parts of the ...
4
votes
1answer
167 views
Behavior of expression evaluation in Plot
I'm confused with Mathematica's way of parsing expressions. I've been struggling with this for a while and never found an exhaustive answer, sometimes things don't parse the way I think they would ...
13
votes
1answer
171 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 ...
5
votes
2answers
129 views
How can I retrieve the point coordinates from a LOG Plot after the data points were manually moved?
I'm having problems with getting coordinates out ofa ListLogLogPlot
I basically plotted a list, then selected data points on the graph, moved these points around, ...
7
votes
3answers
311 views
Pattern matching a pattern with patterns
Confusing title, I know. But the question is, if we have two patterns which have the same general structure but different names used in the patterns and different names:
...
2
votes
3answers
112 views
how to extract some terms out from an expression
I have an expression as below:
$-\frac{1}{2} A[a,v] A[b,h] A[c,v] A[d,h] \text{Cos}[\theta ]^2+\frac{1}{2} A[a,h] A[b,v] A[c,v] A[d,h] \text{Cos}[\theta ]^2+\frac{1}{2} A[a,v] A[b,h] A[c,h] A[d,v] ...
6
votes
0answers
93 views
What are the default TransformationFunctions used in Simplify and FullSimplify?
If I do
Simplify[(c^3 - s^3)^2 - (s^3 + c^3)^2,
TransformationFunctions -> Automatic]
(i.e. a verbose version of default behaviour), what transformation ...
7
votes
2answers
817 views
How to expand tan(x+y) as normal form?
TrigExpand@Tan[x + y]
gives
$\frac{\sin (x) \cos (y)}{\cos (x) \cos (y)-\sin (x) \sin (y)}+\frac{\cos (x) \sin(y)}{\cos (x) \cos (y)-\sin (x) \sin (y)}$
but I ...
20
votes
1answer
196 views
How can I see which transformations Simplify attempts?
The documentation for Simplify[expr] says that it performs a sequence of algebraic and other transformations on expr, and returns the simplest form it finds. How can I see which transformations it ...
1
vote
1answer
138 views
Comparing two symbolic expressions
Does Mathematica provide any way to compare two symbolic expressions and find which is the greatest? For example, I want to find which is the greatest of ...
10
votes
5answers
216 views
Construct an infix operation from a list
Inspired by this question, if I have a list
{a, p, b, q, c}
where p and q are binary ...
1
vote
0answers
174 views
Can mathematica simplify an expression setting simplified answer equal to zero?
Basically I want to reduce something like:
Subscript[P, 4] - Subscript[P, 5] == Subscript[R, 4, 5]* Subscript[i, 4, 5]
when only one of them is known (...
3
votes
0answers
116 views
Why doesn't Log[Gamma[]] simplify to LogGamma[] where it could?
I have been playing with various equations involving amount of permutations in relatively large sets. Easiest way to look at these is something like Log[10, bignumber!] . Often expressions, even ...
10
votes
1answer
191 views
Transform an expression into a graph that can be plotted with TreeGraph (not TreeForm)
I would like to plot an expression (like TreeForm does), but using the new TreeGraph functionality.
...
3
votes
1answer
119 views
Change values in equation with slider
I want to make an equation where the values adjust to my slider which I inserted with manipulate.
Well, I tried, but when I use the slider the equation starts to fall apart.
Actually this should ...
2
votes
2answers
85 views
Subvalue and level
I'm interested in the arguments of f in expressions like
f[a]@f[b]@f[c]
By argument I mean what is here ...
2
votes
1answer
82 views
How to prevent substitution?
I have a function:
$\bar{u}:=u[t,x,y,z]$ (1)
How do I prevent it from expanding and substituting in instructions like those following:
$\partial _t {\bar u}$ (2)
Thanks in advance
EDIT: ...
17
votes
3answers
403 views
How can I completely ban usage of some functions in output and mandate use of others?
For example, I hate that Mathematica uses Pochhammer symbol in outputs and prefer all the expressions in Gamma function. How can ...
10
votes
4answers
297 views
Extracting equations from Piecewise expressions
Say I have a PDF:
PDF[LogNormalDistribution[1.75, 0.65], x]
Calculating it, Mathematica gives me an expression that looks like this:
I want to extract the ...
1
vote
3answers
256 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
...
9
votes
2answers
362 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, ...
11
votes
2answers
454 views
Google Code Jam: Mountain View code review
After participating in Google Code Jam 2012 Round 2, it occurred to me that the Mountain View problem boiled down to solving a set of linear inequalities, which could be done in Mathematica. I've only ...






