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

learn more… | top users | synonyms

4
votes
1answer
214 views

How to extract a possible closed form from WolframAlpha[] output

To find a possible closed form of a number, I can use the function WolframAlpha["6.38905609893065", IncludePods -> "PossibleClosedForm"] It returns a result ...
0
votes
2answers
80 views

I want to define a function that has integer power [closed]

I am defining this function: f[x_] = kr*g[x] + (c^l*x^l)/(KIR + c^l*x^l) But I want to make l bigger than 0, so if I evaluate ...
3
votes
3answers
71 views

Operations on expressions within Hold [duplicate]

I want to convert {Hold[1 + 2], Hold[3 + 4], Hold[5*6]} into Hold[{1 + 2, 3 + 4, 5*6}]. I have tried ...
1
vote
0answers
36 views

Matching Root[…] objects with patterns, unexpected hidden argument

I needed to write patterns that could distinguish between arbitrary-function and polynomial forms of Root objects, for example, ...
6
votes
2answers
107 views

Why is ToRadicals[] not able to handle all cases? Is there a workaround?

The documentation for the function ToRadicals says: ♦ There are some cases in which expressions involving radicals can in principle be given, but ...
7
votes
2answers
249 views

How to automatically get rid of trig functions in an expression?

I have a large expression containing many terms like this: Sin[1/2 ArcTan[(2 Log[5])/(Log[5]^2 - 2)]] where a trig function is invoked on a rational multiple ...
7
votes
1answer
84 views

Need a generalization of RootApproximant to recognize linear combinations over algebraic numbers

RootApproximant does a very good job when I need to recognize an algebraic number and when enough of its digits are known (or even when an unlimited number of ...
3
votes
2answers
235 views

Simplifying expressions involving Sum

I am trying to use Mathematica to simplify a symbolic expression involving Sum. Particularly, I define a sum via ...
10
votes
3answers
671 views

How can I transfer mathematical expressions between Mathematica and Maple?

Is there a simple way to copy mathematical expressions between Mathematica and Maple (or at least in one direction)? I mean only expressions built from numbers and predefined mathematical functions, ...
8
votes
2answers
160 views

How to reduce the number of operations needed to evaluate an expression? [duplicate]

For some numerical calculations in C++ I have, for example, this complicated expression to evaluate. Given as Mathematica input, in its original form it is ...
6
votes
1answer
202 views

Summa package problem

I need to use the features of the Summa package but it doesn't work in Mathematica 9. It gives the error Cannot open Utilities`FilterOptions` My question is: ...
40
votes
2answers
1k 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 ...
2
votes
0answers
31 views

Detecting a more general pattern [duplicate]

I need a function that, given 2 patterns, determines if the first pattern is more general than the second (i.e. that any expression successfully matched by the second, will be successfully matched by ...
2
votes
1answer
159 views

A question about derivatives (cubics)

Given an equation: f(z) = a (x + I y)^3 + b (x + I y)^2 + c (x + i y) + d Which can be re-written as: ...
4
votes
2answers
150 views

Getting a usable expression tree

I need to get the expression tree for some expression. expr //TreeForm The above grabs the expression tree but it isn't in some sort of usable format. Just an ...
5
votes
2answers
180 views

Passing list of options to Plot

I'm looking for a way to create a variable that I can use to hold all of the graphics directives for, say, a plot command. For example, I have 8 plots with variations on the following: ...
33
votes
3answers
610 views

Replace inside Held expression

I wish to make functional replacement inside Held expression like this: ...
2
votes
2answers
129 views

How to unthread?

For example {a + b} == {c + d} // Thread (*{a + b == c + d}*) how to get {a + b} == {c + d} from ...
9
votes
1answer
120 views

What are the scoping rules for function parameters shadowing System` symbols?

Here are some very contrived code snippets, highly unlikely to appear in real code, but still I am curious why they behave like this: ...
3
votes
1answer
117 views

Assigning Sequence to Part of a SparseArray (bug?)

Part ▪ You can make an assignment like t[[spec]]=value to modify any part or sequence of parts in an expression. ▪ If ...
5
votes
1answer
77 views

Why is NHoldFirst not propagated to symbolic derivatives?

I encountered a nasty problem that N cannot evaluate expressions containing a symbolic Derivative of a multi-parameter function ...
3
votes
0answers
160 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 ...
11
votes
1answer
173 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 ...
2
votes
1answer
487 views

How to import a Microsoft Word document into Mathematica?

I have a Microsoft Word document in DOCX format. I need to import it into Mathematica as a String preserving all formatting (font, size, bold/italic style, colors, ...
5
votes
1answer
192 views
1
vote
1answer
372 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
146 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 ...
21
votes
7answers
848 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
240 views

Symbolic manipulation of functional form

I have a functional polynomial expression of the form: ...
14
votes
3answers
434 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
118 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
96 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
115 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 ...
8
votes
1answer
717 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 ...
10
votes
1answer
228 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
316 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
122 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 ...
2
votes
2answers
145 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, ...
7
votes
4answers
549 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: ...
1
vote
1answer
431 views
2
votes
1answer
514 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
250 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
259 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
417 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 ...
5
votes
2answers
206 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, ...
9
votes
3answers
595 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: ...