Is there a function in Mathematica to force an expression to be transformed into a given form. For example f[x] is a function of x with known symbolic expression, and the goal is to find constants A and B such that f[x] = A*x + B.

Is yes, is this also possible in Wolfram Alpha?

  • $\begingroup$ This is sorta kinda vague. If f[x] is indeed linear, then yes; otherwise, where are A and B supposed to come from? $\endgroup$ Commented Apr 7, 2016 at 9:52
  • $\begingroup$ The actual case was having is f[x] = A + B/x, so I wondered if Mathematica can determine if an expression can be written in that form. $\endgroup$
    – tmlen
    Commented Apr 7, 2016 at 10:06
  • 4
    $\begingroup$ Perhaps Reduce[f[x] == a /x + b, {x}] // FullSimplify could be a start. Also please update your question to ask exactly what you need. $\endgroup$ Commented Apr 7, 2016 at 10:47
  • 1
    $\begingroup$ WolframAlpha does not understand user defined functions, so no this is not possible in WolframAlpha. In Mathematica you might try adapt this example to if it can do what you want: f[x] = Sin[x]* x + Tan[3]; f[x] /. {a_* x + b_ -> A* x + B} will then display B + A x. Or possibly f[x] /. {a_* x + b_ -> HoldForm[A* x + B]} which returns A x+B. But that does not assign any values to A or B that you can later use, it just successfully does the substitution and displays that. If you need more or different results then please edit your question to be more precise and detailed. $\endgroup$
    – Bill
    Commented Apr 7, 2016 at 17:17


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.