http://i.stack.imgur.com/JOS9o.png the question is to analyze $f(x)$ for monotonicity. I know I need to use D[f[x], x] and check if it is less than or greater to zero, but NSolve is not working properly.

f[x_] := 
  Sqrt[1 - a + (b + c) (c + b x + c x) - 
    Sqrt[(b + 2 c + a c)^2 - (b^2 - c^2)(3 + 4 a - a^2 + b^2 - c^2) x + 
      (b^2 - c^2) x^2]] + 
  Sqrt[1 - a + (b + c) (c + b x + c x) + 
    Sqrt[(b + 2 c + a c)^2 - (b^2 - c^2) (3 + 4 a - a^2 + b^2 - c^2) x + 
     (b^2 - c^2) x^2]] + 
  Sqrt[1 + a - (b - c) (c - b x - c x) - 
    Sqrt[(b - 2 c - a c)^2 - (b^2 - c^2) (3 - 4 a - a^2 + b^2 - c^2) x + 
      (b^2 - c^2) x^2]] + 
  Sqrt[1 + a - (b - c) (c - b x - c x) + 
    Sqrt[(b - 2 c - a c)^2 - (b^2 - c^2) (3 - 4 a - a^2 + b^2 - c^2) x + 
      (b^2 - c^2) x^2]]

  0 <= (1/4) (1 - a - b - c) <= 1 &&
  0 <= (1/4) (1 + a + b - c) <= 1 &&
  0 <= (1/4) (1 + a - b + c) <= 1 &&
  0 <= (1/4) (1 - a + b + c) <= 1 &&
  a^2 < b^2 < c^2, 
  {a, b, c}, Reals];

NSolve[D[f[x], x] > 0]

I did try to do this im many ways. I'm pretty new to Mathematica and today I thought of doing it this way, but it's not working


closed as off-topic by MarcoB, user9660, Artes, Jens, Öskå Jun 6 '16 at 16:49

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "The question is out of scope for this site. The answer to this question requires either advice from Wolfram support or the services of a professional consultant." – MarcoB, Community, Jens, Öskå
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ 1. Post mathematica code for your function, not an image. 2. Show the code you have put together so far. $\endgroup$ – MarcoB May 31 '16 at 16:09
  • $\begingroup$ im pretty new so im just learning sory for all my bads is it properly posted now ? $\endgroup$ – k_z May 31 '16 at 16:16
  • 1
    $\begingroup$ Much better. Now consider that in Mathematica bx indicates a single variable called $bx$, not the product b*x as you wanted. To indicate the product, add a space in your code between $b$ and $x$: b x, or use an explicit multiplication sign (*). Also, you have some special character [Minus] in your Reduce expression: replace it with a "normal" minus sign, i.e. a hyphen on the keyboard. When you make those changes, your Reduce expression will return a result. Solve or NSolve, however, will really struggle to solve your equation symbolically. $\endgroup$ – MarcoB May 31 '16 at 16:35
  • $\begingroup$ is there anyway i can speed up the proces? like stop using numerial methods or something ? $\endgroup$ – k_z May 31 '16 at 16:56
  • 1
    $\begingroup$ What does the Reduce expression have to do with the rest of the code? (Note that the trailing semicolon returns null output from the Reduce expression!) Are the conditions there meant to represent constraints upon the parameters a, b, and c? $\endgroup$ – murray May 31 '16 at 19:00

You may use Simplify.

If $f(x)$ is a function, then

Simplify[f[x]>=f[y], x>=y]

should evaluate to the necessary condition for the monotonicity to hold. If necessary, you can use FullSimplify

  • $\begingroup$ but true or false dont give me answer in which areas the function is increasing or decreasing? and i have to know that, thats why i thought i had to use D[f[x],x] and check when its + or - $\endgroup$ – k_z May 31 '16 at 16:27
  • $\begingroup$ @k_z, your function is monotonic if and only if it is either entirely increasing or decreasing; if there are areas in which it is increasing and also areas in which it is decreasing, then it is not monotonic. $\endgroup$ – MarcoB May 31 '16 at 16:38
  • $\begingroup$ ok english is not my native language i need to check in what parts is it increasing and decreasing. I'm pretty sure in a "usuall" math u have to calculate derivative and check if its bigger or smaller than "0" $\endgroup$ – k_z May 31 '16 at 16:41

As an example, consider this function g and its derivative gd:

g[x_] := x - 1/10*x^3;
gd[x_] = D[g[x], x];

enter image description here

Now you want to study monotonicity in a certain interval. For this, you will need to find the local extrema of your function. The corresponding x-values of your extrema can be found using Solve, NSolve or FindRoot (for this simple example, Solve works - in general the other two approaches are required for numerical solutions).

xextreme = Solve[gd[x] == 0, x][[;; , 1, 2]]
{-Sqrt[(10/3)], Sqrt[10/3]}

Now you need to study the derivative's sign in the intervals separated by these values. To do so, we generate a list that has values "left" and "right" as well as in between the values found in xextreme. This is general, though very likely not the most beautiful approach (but the first that came to my mind and suffices).

testvals = Append[Prepend[(Drop[Riffle[#, # + 1/2*Append[Differences@#, 0]], -1] &@xextreme), -2*#], 2*#] &@Max[Abs[xextreme]]
{-2 Sqrt[10/3], -Sqrt[(10/3)], 0, Sqrt[10/3], 2 Sqrt[10/3]}

Now check the sign of the derivative:

TableForm[Transpose[{testvals, Sign[gd[#]] & /@ testvals}], TableHeadings -> {None, {"x", "sign(g'(x))"}}]

enter image description here

  • Negative sign: decreasing function
  • Positive sign: increasing function
  • Zero: local extrema (including possibility of saddle point)

Note that if you use NSolve or FindRoot, you should rather use Sign[Chop@gd[#]] inside the TableForm line to get around numerical issues.


To be very specific for your function in question: Have a look at this beautiful package and evaluate these lines

ClearAll[fc,fcs, rule1,rule2];
{fc[x_], rule1} = GroupConstants[f[x], x, GeneratedParameters -> (Symbol["kf" <> ToString[#]] &)];
{fcs[x_], rule2} = GroupConstants[Numerator@Together@D[fc[x], x], x, GeneratedParameters -> (Symbol["kfs" <> ToString[#]] &)];

Then, observe the "beauty" of fcs[x]. All these hundreds of constants kxyz depend on a,b,c as specified in rule1,rule2. You may even do fcs[x]/.rule2/.rule1 and see how large your expression becomes. Note that this is only the numerator of the derivative f'[x]. You would need to find roots of this thing, which appears to be impossible symbolically. Also, the numerical values will all (AFAIK) fail unless you specify values for a,b,cbecause there will be non-numerical values inside your expressions.

  • $\begingroup$ I got the method but I can not folow it. It works easy if try it for simple functions, but i can not apply it to the one im trying to solve. If anyone can tell me how can i do this step by step it would be great. My problem is I can not use FindRoot on my function and if i try something like xextreme = NSolve[{fd[x] == 0, 0 <= (1/4)*(1 -a - b -c) <= 1, 0 <= (1/4) (1 + a + b- c) <= 1, 0 <= (1/4) (1 + a- b + c) <= 1, 0 <= (1/4) (1 - a + b + c) <= 1, a^2 < b^2 < c^2}, {x, a, b, c}, Reals] its not working $\endgroup$ – k_z Jun 1 '16 at 11:53
  • $\begingroup$ @k_z Please the my updated answer. I doubt you will find a solution of the problem as stated right now. $\endgroup$ – Lukas Jun 1 '16 at 12:13
  • $\begingroup$ I installed the package. First i did try to this myself and i failed. I did try to copy what u worte and its not working properly either way I did something wrong or it do not work with this expression. This is what i got postimg.org/image/t5zftffu3 $\endgroup$ – k_z Jun 1 '16 at 13:22
  • $\begingroup$ @k_z Is the GroupConstants command written in blue colour? $\endgroup$ – Lukas Jun 1 '16 at 13:31
  • $\begingroup$ Yes it is writen in blue colour $\endgroup$ – k_z Jun 1 '16 at 13:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.