# Maximum gradient of function within a domain

I am making something on desmos and I need the maximum gradient of a function within a domain. I have no idea where to start.

f(x) {x:a<=x<=b}

find f'(x) max

The desmos graph plots the function f(x) with circles which are different colors depending on the gradient of the function. This works fine but, when dealing with a curve like x^2 where the gradient is forever increasing, we run out of colors quickly. This can be solved by dividing the gradient fed into the hue parameter by the maximum gradient but this will be a different number for each function you use as f(x).

Here is my desmos graph: https://www.desmos.com/calculator/xgrgkvnoqc

I tried searching this up online but everything went over my head and I don't know what to do with this. I also posted this to r/mathematics and was removed because too difficult. I then posted to another subreddit, nobody has been able to answer, and I was referred to this website.

Thanks :)

## Answer

**Answers can only be viewed under the following conditions:**

- The questioner was satisfied with and accepted the answer, or
- The answer was evaluated as being 100% correct by the judge.

- answered
- 812 views
- $3.92

### Related Questions

- Is my answer correct?
- Basic calc question
- Compute $\oint_C y^2dx+3xydy $ where where $C$ is the counter clickwise oriented boundary of upper-half unit disk
- True-False real analysis questions
- Exercise on Ito's rule for two correlated stocks.
- 2 questions in 1
- Evaluate the integral $\int_{-\infty}^{+\infty}e^{-x^2}dx$
- Solutions to Stewart Calculus 8th edition

1. For a difficult question the bounty should be much larger. 2. Are you dealing only with functions of one variable? 3. Are you always restricted to a closed domain like [a,b]?

1. I’m not sure how hard this question is. I am studying towards my second year of A levels, it may just be something we haven’t covered yet. 2. I might not understand what you mean but things like an ellipse where you have x and y, don’t worry about that, just in terms of x. 3. Yes the function is always restricted to the domain, between a and b. If it was unrestricted I would have thought it would make it harder for some graph though where the gradient tends to infinity.

Do you have formulas for your functions in terms of x?

Sorry I don’t really understand what anyone is talking about. I want to be able to put things like polynomials, cos, cosh, all that stuff into it and it works.

What do you mean by "it works"? If you have explicit formulas for your functions, you can find the maximum points of $f'$ by computing the second derivative $f''$. Is this acceptable?

It's not clear what you want to do, sadly. But if you care only about the maximum of f'(x), you could take its derivative, set it to zero, find critical points and evaluate those critical points and the endpoints of the interval [a,b] to find its maximum. Because you are only working in an interval [a,b] you are guaranteed to find a maximum for f'(x) like this.

Sorry. Yes this is what I want it to do. I’m just not sure how to implement it on the graph.

I have formulas for my functions

You don't have to graph the functions to find the maximum of f'. Is that ok? It would be extremely easier as long as you can compute and solve f'' (x)=0.

I can give more details if that's ok with you.

Desmos doesn’t allow you to do that

I want to be able to set f(x) to anything I want and it calculates the second derivative, sets it to 0, solves it… I understand I could do this manually but I want this to be something it calculates and does itself

Desmos is not the right way to do this then. This problem is indeed very challenging, and needs a much more sophisticated approach.

I will try to provide an answer as good as possible, but I also don't think desmos is the right tool to deal with this. I will give you better proposals. Also, your desmos graph (link) appears empty to me.

Oh god 🤦♂️ that would help. Hopefully what I am trying to do will be a more more clear when you see the graph. I have updated the link

If anyone is interested, I actually managed to get this working… to some extent. I made a list of the gradient at all plotted points, sorted it from smallest to largest, got the last value. I understand this is not going to be the true maximum gradient and only an estimation but it is close enough that for what I wanted it to do, it works fine. It doesn’t work for all graph. For some values of an and b the values of the sorted gradient list become undefined for some reason

https://www.desmos.com/calculator/jhwatkoi6j