-1
$\begingroup$

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

$\endgroup$
3
  • $\begingroup$ Could you supply the data? $\endgroup$ Dec 8, 2011 at 11:37
  • $\begingroup$ 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/… $\endgroup$
    – Jeepstone
    Dec 8, 2011 at 11:40
  • $\begingroup$ 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?". $\endgroup$ Dec 8, 2011 at 11:42

1 Answer 1

1
$\begingroup$

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.

$\endgroup$
6
  • $\begingroup$ 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! $\endgroup$
    – Jeepstone
    Dec 8, 2011 at 11:52
  • $\begingroup$ Oh god! The curve is too steep at the start!!!!!!!!!!! #slitswrist $\endgroup$
    – Jeepstone
    Dec 8, 2011 at 11:57
  • 1
    $\begingroup$ @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. $\endgroup$ Dec 8, 2011 at 12:02
  • $\begingroup$ @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 $\endgroup$
    – ReV
    Dec 8, 2011 at 12:07
  • $\begingroup$ @ReV That's much better, (apparently). Thanks very much. $\endgroup$
    – Jeepstone
    Dec 8, 2011 at 12:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .