Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Bear with me - it's been a while since I did this at school!

I need to plot a curve in the form of a square root (kind of an 'r' shape if you will)

I have 6 intervals along my x axis, and my maximum y value can be 180. Given a value of x, how can I work out my value of y?

Many thanks

share|improve this question
    
Could you supply the data? –  Raskolnikov Dec 8 '11 at 11:37
    
There isn't any data per se, I just want a quadrant between the values supplied, a bit like bellabathrooms.co.uk/media/catalog/product/cache/1/image/… –  Jeepstone Dec 8 '11 at 11:40
    
So, if I understand your question correctly, you are actually asking: "How do I draw an r shape or a $\sqrt{\phantom{r}}$ shape from a mathematical function?". –  Raskolnikov Dec 8 '11 at 11:42

1 Answer 1

up vote 1 down vote accepted

If I understand well your question, you want a function that returns a 'r' like shape between $0$ and $x_{max}$ and in a range from $0$ to $y_{max}$.

To do so you can just use: $$y(x) = \frac{\sqrt{x}}{\sqrt{x_{max}}}*y_{max}$$

Here your $y_{max}=180$ so you can use: $$y(x) = \frac{\sqrt{x}}{\sqrt{x_{max}}}*180$$

This should give you the shape you expect.

Here (see comments) are the plots for different functions shaped like you asked.

share|improve this answer
    
Perfect, this is for a progress bar on a website (I kid you not). The person responsible wants the progress to appear to start off quickly and slow down (as it'll mean the user is more encouraged to enter data on a form). I bit like when Windows says "98% complete" for a very long time. Thanks very much! –  Jeepstone Dec 8 '11 at 11:52
    
Oh god! The curve is too steep at the start!!!!!!!!!!! #slitswrist –  Jeepstone Dec 8 '11 at 11:57
1  
@Jeepstone: You should have said from the very start what the use of this function would have been. A square root function is definitely not appropriate since the steepness at the start is infinite. But there are many other functions that could be useful. –  Raskolnikov Dec 8 '11 at 12:02
    
@Jeepstone Yes you should have told us. You can use a sine function like this if you want: $$\sin(\frac{x}{2*x_{max}}*\pi))*y_{max}$$ You have an example comparing the square root function, the sine function and a "circle shaped like" function with $x \in [0;6]$ and $y\in[0;1]$ here: tinyurl.com/77dwbxa –  ReV Dec 8 '11 at 12:07
    
@ReV That's much better, (apparently). Thanks very much. –  Jeepstone Dec 8 '11 at 12:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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