A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

New answers tagged

1

One way could be ClearAll[t,a,b} z1 = CoefficientList[(3*t^2 + 5*t + a)*(4*t^2 + b*t - 2), t]; z2 = CoefficientList[12*t^4 + 26*t^3 - 8*t^2 - 16*t + 6, t]; eqs = Thread[z1 == z2]; Solve[eqs,{a,b}]


2

The simple ComplexityFunction cf[e_] := LeafCount[e] + 10 Count[e, _Times] also works: FullSimplify[(a b)^i, a > 0 && b > 0 && i > 0, ComplexityFunction -> cf] (* a^i b^i *) If (a b)^i lies lower in the expression, then its level must be specified. For instance, cf2[e_] := LeafCount[e] + 10 Count[e, _Times, {2}] FullSimplify[...


0

You can always brute force it. eq = x y + y^2 - 1 + (z + Cos[z]) y x - 24*(z + Cos[z]) + Tan[x] == x^4 (Solve[eq /. {z + Cos[z] -> f[z]}, f[z]][[1, 1]] /. Rule -> Equal) /. f[z] -> z + Cos[z] (*z + Cos[z] == (x^4 - Tan[x] - x y - y^2 + 1)/(x y - 24)*) This, of course, requires that all expressions containing z be the same form.


2

This function brings everything to one side (f), takes a derivative with respect of variable of interest var and integrates back to get an expression dependent on this variable. This is then the left hand side lhs, the right hand side rhs is formed by the rest of the expression: Clear[e,iso] iso[eq_,var_]:=Module[{f,lhs,rhs,g}, f=eq/.Equal[a_,b_]->a-b; ...


1

With Reduce you can actually solve this problem; you need, though, to specify the variable you want to use to solve it for: Reduce[xy + y^2 - 1 + zyx - 24*z + Tan[x] == x^4, z] which yields as a solution z == 1/24 (-1 - x^4 + xy + y^2 + zyx + Tan[x]) This will obviously work only if your variable can be expressed explicitly.


0

another way is to use Simplify or Fullsimplify Simplify @@ ConditionalExpression[-Sqrt[1 - x - x^2], 1/2 (-1 - Sqrt[5]) < x < 1/2 (-1 + Sqrt[5])] returns -Sqrt[1 - x - x^2]


3

To get the first-order state-space equations you can use an internal function that NonlinearStateSpaceModel uses under the hood. NonlinearStateSpaceModel cannot handle this at the moment because it has algebraic equations, but the internal function has no problem with such equations. {{f, h, e}, x} = Control`DEqns`nonaffinestatespaceForm[ eqns, {PX[t], ...


2

ReplaceAll is not designed to do algebra, which does not try any algebraic transform. But Reduce etc. can do them. However, I still can make something work with ReplaceAll. For the first line, it's not replaced because there isn't any x+y at all, as you can see that with FullForm: Plus[1,Times[2,x],y] I recommend this command: /. y->-x For the ...


1

You could like this: z /. ToRules[Reduce[z == 2 x + y + 1 && x + y == 0, {z, y}]] which yields: 1 + x


3

Let me show you an example of series solution of ODE with given f0 and f1 for your differential equation. {f0[z_] = Sin[z], f1[z_] = 1}; deq = Derivative[2][w][z] + f1[z]*Derivative[1][w][z] + f0[z] == 0 For comparison the solution with DSolve at initial conditions. wdsol = w /. First@DSolve[deq && w[0] == 4 && w'[0] == 3, w, z] (* ...


Top 50 recent answers are included