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

learn more… | top users | synonyms

1
vote
1answer
51 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 ...
2
votes
2answers
86 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
512 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
82 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? ...
2
votes
1answer
72 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
555 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
145 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
46 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
106 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
114 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
68 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 ...
6
votes
2answers
111 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 ...
1
vote
1answer
77 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 ...
58
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
44 views

Error: Recursion Depth of 1024 Exceeded During Evaluation

I wrote a function that exchanges integration and summation in an expression. ...
0
votes
1answer
66 views
3
votes
2answers
67 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
136 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
131 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
41 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
29 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 ...
0
votes
0answers
73 views

Using Mathematica to derive an equation

My goal is to obtain Eq. (5) given in this Paper using Mathematica. First we need to define Eqs. (2) and (3) ...
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
102 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
43 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
66 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
33 views
6
votes
1answer
196 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
239 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
191 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
74 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 ...
1
vote
2answers
81 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
148 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
48 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
57 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 ...
5
votes
1answer
72 views

Display position of expression as Tooltip

How could we display the position of any sub expression in an expression using Tooltip? This would be useful for example in order to locate the position of an ...
4
votes
2answers
57 views

Is it possible to match a sequence with multiple heads without using Condition

Suppose I have: expr = Times[2, a[x,r], a[y,1], c[z,0,0], d[w,m]]; If I want to match a sequence of expressions with the same head ...
3
votes
5answers
190 views
5
votes
1answer
79 views
2
votes
1answer
65 views

Is there some way to implement automatic TimeSeries extrapolation or series continuation?

I am working with a large number of TimeSeries of irregular length. This means that if I sum them, or compute the mean, it cuts off at the terminus of the shortest ...
5
votes
2answers
150 views

How to name a repeated pattern sequence inside Plus?

Here is a sample expression that contains a bunch of f and some other stuff: ...
0
votes
0answers
57 views

How do I use Replace All? [duplicate]

I have an expression: a + b 2^(1/2) + (c + d 2^(1/2))*I I want to replace each occurrence of 2^(1/2) with ...
7
votes
3answers
90 views

How to organize expression by symbols (like Collect), but apply different functions to each coefficient

I want to mimic the functionality of Collect[expr, {vars}, func], but with the following modification: The function f that is ...
0
votes
0answers
36 views

Replace function and its derivatives [duplicate]

When I have a complicated expression that depends on some variable, say, $f$, the following usually works ok: Expression ./ { f-> x^2 } But if $f$ is a ...
0
votes
1answer
44 views

Solving a trigonometric equation for all $x$ using constant coefficients

I want to find the coefficients $a$, $b$, $c$, etc. that make an equation like $a+bx=x$ true for all $x$, but for trigonometric functions of $x$. For example ...