# Search Results

Results tagged with Search options answers only user 862
8 results

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

This is my take on the pad, thread normally, then remove padding approach. fred[expr_, head_: List, seq_: All] := Module[{myhold, maxlength, dummy, paddedexpr}, SetAttributes[myhold, HoldAllComp …
answered Jun 9 '14 by Simon Woods
Similar to wolfies' approach - find the part for which the condition is True when x->0. p = Piecewise[{{x^2 + 2*x - 4, 0 <= x <= 1/4}, {0, True}}]; Cases[First@p, {e_, c_} /; (c /. x -> 0) :> e] (* …
answered Apr 11 '14 by Simon Woods
Maybe this Replace[Expand@expr, Times[terms__ /; Count[{terms}, _f | _g, Infinity] > 1] -> 0, 1]
answered May 7 '13 by Simon Woods
You could make your mark thing work like this: evalmark = Function[Null, Unevaluated[#] /. mark[x_] :> RuleCondition[x], HoldFirst]; evalmark[ test1[f_] := mark[5 + x - x] D[f, x]; test2[f_] := ma …
answered Feb 24 '17 by Simon Woods
As far as I know, there is no easy, general way to handle this kind of algebra with Sum expressions. What follows is an attempt to use replacement rules to handle a wider range of cases than chris's …
answered Nov 18 '14 by Simon Woods
I'm not sure why you don't like your merge function. This is the same pattern matching approach but using ReplaceAll: {e1, e2} /. {Hold[x_], Hold[y_]} :> Hold[x; y] If you would rather avoid patter …
answered Mar 3 '14 by Simon Woods
I prefer Mr Wizard's answer, but here is a method using the properties of Power and Times to deal with exponent 1 and single prime factors. Specifically: Power[x, 1] gives x Times[x] gives x The p …
answered Oct 3 '14 by Simon Woods
Just do the ComplexExpand after the Conjugate ComplexExpand[Conjugate[I Cos[z] Sin[y] + Sin[z] + A (Cos[z] - I Sin[y] Sin[z])]] (* A Cos[z] + Sin[z] - I (Cos[z] Sin[y] - A Sin[y] Sin[z]) *)
answered Jul 10 '13 by Simon Woods