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

learn more… | top users | synonyms

1
vote
1answer
72 views

How can I access a variable using Position?

I want to define a vector PosVec[a, b] dependent on the variables a and b of a matrix ...
6
votes
2answers
147 views

What is the Difference Between Rule (->) and RuleDelayed (:>)?

I am new to Mathematica so this question may seem rudimentary. Sorry for that! :) I want to implement the well-known property of Kronecker's Delta $$\Sigma_{i=1}^{n} a_i \delta_{ij}=a_j,\quad 1 \le ...
0
votes
1answer
33 views
1
vote
0answers
42 views

ReplaceAll and derivatives

I have the following coming from a computation, $$h_1 (u,v,w) = \frac{1}{v}\partial_v g(u,v,w)$$ and in Mathematica I have different quantities in terms of $h_1$ and its derivatives like $\...
1
vote
1answer
109 views

How to remove parts of an expression [closed]

I have an expression where terms Transpose[R].R appear. R is a matrix with the property Transpose[R].R=IdentityMatrix[3]. How ...
0
votes
0answers
33 views

How to solve a quadratic inequality containing parameters?

I have the following inequality to solve for $R$ in terms of $\delta$ and $n$, with assumption that $n \geq 3$ and $\delta>0$: $$-2 < 2 -\frac{16n\delta^{2}}{R^{2}\sin^{2}\frac{\pi}{n}} \left(...
9
votes
1answer
190 views

How do I insert OwnValues inside a held expression without evaluating it?

Here is a very long and complicated expression, which we abbreviate as a. I store it using SetDelayed because I want to perform ...
0
votes
0answers
34 views

Gradient Descent's Update Rule for Multiparameter Functions

I'm sure this has been answered before, but I haven't been able to find it. I'm trying to manually implement gradient descent for some function, f, with a vector of any length. I define the update ...
-1
votes
2answers
63 views

How can I get the coordinates of a graphics primitive from a Graphics expression?

For example I have square = Graphics[Polygon[{{0, 0} ,{0, 1}, {1, 1}, {1, 0}}]] What functions can I apply to sqaure to ...
3
votes
0answers
80 views

Bringing rational functions to canonical form

I have a complicated expression, which among other things has stuff like functions of rational functions: expr = f[x/(-x^2 + y)] + f[-(x/(x^2 - y))] (* + ...*) ...
1
vote
0answers
39 views

How to invert an Elliptic function where the elliptic nome is a function of an independent variable?

I have a Jacobian elliptic function as a function of two independent variables $x$ and $y$. The elliptic parameter $m=m(y)$, $0 \leq m \leq 1$, is also a function of the variable $y$, and thus the ...
22
votes
2answers
793 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: <...
3
votes
1answer
48 views

Newline in code with MakeExpression

I start with f[x]. In boxes, this is RowBox[{"f", "[", "x", "]"}]. I apply ...
33
votes
2answers
2k views

Scan vs. Map vs. Apply

I cannot understand the difference between Apply, Scan, and Map. I have tried to play with ...
2
votes
2answers
90 views

CoefficientList for exponentials terms

I have a long expression with exponentials of variable t1. I need to create a list of the coefficients for each exponential. The problem seems to be that several ...
12
votes
1answer
535 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 ...
8
votes
2answers
88 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? ...
3
votes
1answer
80 views

Replace pattern for exponentials

Ultimately, I want to replace every Exp[(const) w[i,j]] to T[i,j] and Exp[-(const) w[i,j]] to 1/T[i,j] in the following expression ...
4
votes
2answers
604 views

Simplifying expressions involving Sum

I am trying to use Mathematica to simplify a symbolic expression involving Sum. The expression is defined as follows: ...
3
votes
3answers
157 views

How to get the long logic expression with a terse method

I have a long logic expression (x==2||x==3||x==4)&&(y==2||y==3||y==4)&&(z==2||z==3||z==4)&&(m==2||m==3||m==4) How to get it by a terse ...
0
votes
0answers
50 views

Force expression in certain form

Is there a function in Mathematica to force an expression to be transformed into a given form. For example f[x] is a function of ...
4
votes
2answers
117 views

Efficiently strip off coefficients in front of variables?

I am working with multivariate polynomials and need a very efficient way to decompose monomials into coefficients and pure monomials. for instance consider variables ...
2
votes
2answers
118 views

How to extract the structure of relationships amongst variables in a system of equations? [closed]

Mathematica being a CAS, I would have thought what I'm trying to do a natural task. But I have not been able to find any information on this in the Internet. Basically, I have a large collection of ...
3
votes
0answers
71 views

Can Mathematica reliably determine the equality of any two constructible numbers?

A constructible number is any number which can be expressed with only natural numbers and the operators $+$, $-$, $\times$, $/$, $\sqrt{}$ (square root only). Is Mathematica's ...
1
vote
1answer
79 views

Deriving the Fourier Coefficients Formulas with a Manual Procedure

I already know that there are built-in functions to compute the Fourier coefficients but I want to derive their formulas manually. In fact, I want to obtain the final well-known formulas for the ...
62
votes
3answers
2k views

Replacement inside held expression

I wish to make a replacement inside a held expression: f[x_Real] := x^2; Hold[{2., 3.}] /. n_Real :> f[n] The desired output is ...
0
votes
1answer
55 views

Error: Recursion Depth of 1024 Exceeded During Evaluation

I wrote a function that exchanges integration and summation in an expression. ...
0
votes
1answer
67 views
3
votes
2answers
69 views

Creating Boolean expressions over a set of indexed variables

I've read lots of examples here on how to set one matrix Equal to another, but how do you nest And and ...
12
votes
1answer
140 views

A weird issue with Interval[$MaxNumber]

From the Interval documentation: For approximate machine- or arbitrary-precision numbers x, Interval[x] yields an interval reflecting the uncertainty in x. <...
1
vote
2answers
134 views

Express roots of quadratic equation in a specific form [closed]

By solving this equation, I got two roots as follows: Solve[1 + Subscript[a, 1]*s + Subscript[a, 2]*s^2 == 0, s] Is there a way to express it in the form below ...
0
votes
2answers
42 views

Substituting a Value into an Expression

I am new to Mathematica so pardon me for the elementary question. Can some one kindly explain that what is happening in the simple code below? The With command ...
1
vote
0answers
33 views

How can PowerExpand be made to evaluate the ArcTan form that takes two arguments?

Consider c = Cos[phi]; s = Sin[phi]; ArcTan[c, s] // PowerExpand ArcTan[s/c] // PowerExpand which yields ...
12
votes
5answers
2k 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 ...
1
vote
2answers
104 views

Extract all elements from a list that belong to a set or have a set element as an argument

EDIT: Added that I want to extract not only the variables from a specific set, but also functions involving variables from a specific set. Given the set ...
1
vote
1answer
46 views

Formatting the prime factorization of expressions

I have a series expansion in $x$ and $a,b$ are constants which I want to type in $\LaTeX$. But the numbers/integers are pretty large (have a lot of digits) so it becomes a bit messy in $\LaTeX$. ...
1
vote
1answer
46 views

Rearranging dynamic equations

I'm deriving dynamic equations for a simple system, this is what I get: How can I rearrange these 2 equations into the form like this: My code is: ...
2
votes
1answer
71 views

Separation of variables in an expression

I am looking for the function equivalent of Sympy's function: as_independent (*deps, **hint) in Mathematica. The function naively separates an expression into arguments that are not dependent on deps. ...
3
votes
1answer
35 views
6
votes
1answer
199 views

How to efficiently find all combinations of the letters in an alphabet given a condition

Problem: I want to find all unique expressions with n number of terms that contain all the digits (or characters) in alphabet. ...
3
votes
2answers
262 views

Is there a function in Mathematica which removes brackets wrapping an expression?

Is there a function in Mathematica which removes brackets from an expression? RemoveBrackets[ {3} ] 3 Note: inspired by @garej's answer to this question :...
11
votes
4answers
199 views

Evaluation of Alternatives

I recently stumbled upon a few examples that suggest patterns containing Alternatives do not evaluate for individual alternatives. For example: ...
2
votes
2answers
81 views

intermediate steps of simplification of algebraic expression without evaluation [closed]

I am using MMA do do some algebra and I need to do some simplification. For example, I have the following expression $$ x^2 \left( \frac{6 \left(2 c_1 x^6+c_2\right)}{x^4} \right)-x \left( 4 c_1 x^3-\...
1
vote
2answers
85 views

What's the easiest way to remove overall factors from polynomials?

I have code that outputs polynomials (in #1) such as the ones below (note that the trailing Function character ...
4
votes
1answer
153 views

How do I disable that Mathematica orders terms in lexicographic order?

I have matrices with entries where the order of the entries is important. Unfortunately Mathematica resorts terms in products in a lexicographic order. For example, ...
0
votes
1answer
51 views

Simple grouping equations [closed]

I'm new in the Mathematica world. A very basic question. I have been using the command Eliminate on a set of equations as follow: ...
0
votes
1answer
59 views

Eliminate variable on multiple equations [closed]

I'm pretty new with Mathematica. I have to perform a really simple operation, but I'm really struggling with that. I have a set of 4 equations, for example (they can also be more complex): $ AA = 2 ...