Tag Info

Hot answers tagged

6

Will a = -3; Print[Defer[\[FormalA] x + 5 + x^2] /. \[FormalA] -> a] -3 x + 5 + x^2 work for you?


4

What about Print[HoldForm[3 x + 5 + x^2]] ?


3

There are two problems. One is that you want SolveAlways to find values for the parameters for which the expressions are equivalent. The second is that, as stated, it's not possible because the system is overdetermined. You'll want to allow for a constant term in your second expression. expr1 = -0.433284 - 0.758719 x + 0.00289158 x^2 - 0.443672 y + ...


3

Please check the result by doing the following eqn = FullSimplify[ 2*a*b*n*c*Q - 3*a*b*n*p*c*Q + a*b*n*p^2*c*Q - 4*a^2*b*n*p*Q^2 - 4*a*b^2*n*p*Q^2 + 6*a^2*b*n*p^2*Q^2 + 6*a*b^2*n*p^2*Q^2 - 2*a^2*b*n*p^3*Q^2 - 2*a*b^2*n*p^3*Q^2 + a^2*b*c*Q^2 + a*b^2*c*Q^2 - 2*a^2*b*p*c*Q^2 - 2*a*b^2*p*c*Q^2 == 0] // TraditionalForm This returns ...


2

Solution If the equations always use this pattern we can simply use pattern matching: findCoefficients[expr_] := PadLeft[Cases[ expr, coeff : Except[F1[_] | F2[_] | F3[_]] :> coeff, {2} ], Length@expr, 1] findCoefficients[expr1] (* Out: {1, 4 I, -2} *) I wonder, though, how you intend to use these coefficients. I'm padding with ones to ...


2

Clear["Global`*"] g[x_] := x^3 f1[x_] := g[x^2] f2[x_] := g[x^3] Definition@f1 f1[x_] := g[x^2] FullDefinition@f1 f1[x_] := g[x^2] g[x_] := x^3 Head@f1 Symbol Information["f*"] a[1] = 1; a[2] = 2; ?a DownValues@a UpValues@a


2

Or like this: List @@ expr1 /. {F1[a_] -> 1, F2[b_] -> 1, F3[c_] -> 1} (* {4 I, -2, 1} *) List @@ expr2 /. {F1[a_] -> 1, F2[b_] -> 1, F3[c_] -> 1} (* {-I, 2, 4, -1} *)


1

What you need is Block instead of Module. It changes the extent to which the variables are localized. func[var_String] := Block[{var1, var2},var1="some words";var2="other words";ToExpression[var]]; func["var1"] (*Out[2]="some words"*)


1

I am not sure if this help or not but if you have coefficient for each term, this cloud help: ((expr /. Plus -> List) /. Times -> List)[[;; , 1]] As mentioned by Pickett, the Times and Plus are Odorless. In this case I would suggest the following: expr1 = HoldForm[ F1[0]*F2[3]*F3[2] + 4 I*F1[1]*F2[2]*F3[1] - 2*F1[0]*F2[-2]*F3[2]]; expr2 = ...


1

This particular problem can dealt with algebraically by completing squares, equating coefficients and subtracting constants. (I am making the assumptions this is a left hand side whose right hand side is 0). pol = -0.433284 - 0.758719 x + 0.00289158 x^2 - 0.443672 y + 0.00149027 y^2; cr = CoefficientRules[pol, {x, y}] {p, q, r, s, t} = cr[[All, 2]]; {h, ...



Only top voted, non community-wiki answers of a minimum length are eligible