Skip to main content

All Questions

2 votes
4 answers
277 views

Ignore higher order terms in an expression

I am trying to ignore terms that are higher order (third or more) in an expression. For example, for the input function: $$f_{in}= \alpha\beta + \alpha^2 + \beta^2 + \alpha\beta^2/2 + \alpha^2 \beta $...
7 votes
2 answers
207 views

Why does my list of positions contain a leading and following element not in the original list?

I have a list which contains non-integers (three in this case) each of which I need to replace with a different Random Variate. ...
6 votes
4 answers
1k views

Replace all integers by 1?

Let list1 be a list of variables of the form {c1 a, c2 b, ...} where $a,b,...\in\mathbb{C}$ and $c1,c2,...\in\mathbb{Z}$. I am ...
6 votes
5 answers
734 views

Manipulating rules

I tried searching in the docs in "Transformation Rules and Definitions", however there wasn't anything of help. So imagine I have these two rules: ...
1 vote
0 answers
43 views

Evaluate coefficients of delta functions in a given expression

Suppose that I have a function of the form: myfn[x_] = smoothfn[x] + A[x] DiracDelta[x-x0] + B[x] DiracDelta'[x-x0], where ...
5 votes
5 answers
442 views

How to subtract these two equations?

There are two equations: eq1 = x1^2/a^2 + y1^2/b^2 == 1; eq2 = x2^2/a^2 + y2^2/b^2 == 1; How to get this result by subtracting two equations? the result ...
4 votes
4 answers
191 views

How to use replacement rules in a named expression before a sub-expression evaluates?

I have a named expression: expr := a + b. a and b are also named expressions. Let's say <...
1 vote
1 answer
75 views

How to distinguish x[a] from x in replacement rules? [closed]

Quick to the point:is there a way to make Mathematica assume that $a \neq a[1] \neq a[2] , ...$ I notice that Solve assumes that $a$ is the same for all $a[1],a[2],...$ Also, if I replace $a \...
2 votes
0 answers
93 views

Don't simplify integer square roots

How can I rewrite an expression like $\frac{1}{2\sqrt{3}}$ as $\frac{1}{\sqrt{12}}$? This works in principle, but gets immediately simplified back to the original expression ...
1 vote
2 answers
106 views

Symbolic derivative of transposition

I have an expression: expr = Transpose[x]+Transpose[f[x]]+Transpose[x+f[x]] I want to differentiate this expression and desired result looks like this: ...
1 vote
1 answer
119 views

Substituting into equations

If I evaluate D[f[g[x]],{x,5}], I'll get a result containing derivatives of f and g, explained here. But suppose that I have explicit formulae for the derivatives $...
106 votes
5 answers
6k 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
0 answers
173 views

Back-substitution

Suppose that we have an expression (expr in the code below) and replace a long term with a new parameter (K). For a simple example; ...
1 vote
0 answers
37 views

Replace subexpression with variable in result from Laplace transform

I'd like to clean up the result I obtained from an inverse Laplace transform: First of all, I'd like to replace the square root expressions in the hyperbolic function arguments (part encircled in ...
1 vote
1 answer
79 views

Denoting the whole in Position/Extract/ReplacePart

Position returns lists of numbers consumed by Extract, ReplacePart and others as "...

15 30 50 per page
1
2 3 4 5