You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Mark <st...@gmail.com> on 2012/02/14 02:29:24 UTC

Need help with graphing function (MATH)

I need some help with one of my boost functions. I would like the 
function to look something like the following mockup below. Starts off 
flat then there is a gradual decline, steep decline then gradual decline 
and then back to flat.

Can some of you math guys please help :)

Thanks.




Re: Need help with graphing function (MATH)

Posted by Gora Mohanty <go...@mimirtech.com>.
On 14 February 2012 23:35, Mark <st...@gmail.com> wrote:
> Thanks I'll have a look at this. I should have mentioned that the actual
> values on the graph aren't important rather I was showing an example of how
> the function should behave.
[...]

>> either y = (100/(e^((x -50)/75)^2)) + 50
[...]

In general, the exponential will be better behave than the sinusoid.
You can change the exact values by tweaking the coeffiocients in the
equation.

Regards,
Gora

Re: Need help with graphing function (MATH)

Posted by Em <ma...@yahoo.de>.
Hi Mark,

did you already had a look at http://wiki.apache.org/solr/FunctionQuery ?

Regards,
Em

Am 14.02.2012 20:09, schrieb Mark:
> Or better yet an example in solr would be best :)
> 
> Thanks!
> 
> On 2/14/12 11:05 AM, Mark wrote:
>> Would you mind throwing out an example of these types of functions.
>> Looking at Wikipedia (http://en.wikipedia.org/wiki/Probit) its seems
>> like the Probit function is very similar to what I want.
>>
>> Thanks
>>
>> On 2/14/12 10:56 AM, Ted Dunning wrote:
>>> In general this kind of function is very easy to construct using sums
>>> of basic sigmoidal functions. The logistic and probit functions are
>>> commonly used for this.
>>>
>>> Sent from my iPhone
>>>
>>> On Feb 14, 2012, at 10:05, Mark<st...@gmail.com>  wrote:
>>>
>>>> Thanks I'll have a look at this. I should have mentioned that the
>>>> actual values on the graph aren't important rather I was showing an
>>>> example of how the function should behave.
>>>>
>>>> On 2/13/12 6:25 PM, Kent Fitch wrote:
>>>>> Hi, assuming you have x and want to generate y, then maybe
>>>>>
>>>>> - if x<  50, y = 150
>>>>>
>>>>> - if x>  175, y = 60
>>>>>
>>>>> - otherwise :
>>>>>
>>>>> either y = (100/(e^((x -50)/75)^2)) + 50
>>>>> http://www.wolframalpha.com/input/?i=plot++%28100%2F%28e^%28%28x+-50%29%2F75%29^2%29%29+%2B+50%2C+x%3D50..175
>>>>>
>>>>>
>>>>>
>>>>> - or maybe y =sin((x+5)/38)*42+105
>>>>>
>>>>> http://www.wolframalpha.com/input/?i=plot++sin%28%28x%2B5%29%2F38%29*42%2B105%2C+x%3D50..175
>>>>>
>>>>>
>>>>> Regards,
>>>>>
>>>>> Kent Fitch
>>>>>
>>>>> On Tue, Feb 14, 2012 at 12:29 PM,
>>>>> Mark<st...@gmail.com>> 
>>>>> wrote:
>>>>>
>>>>>     I need some help with one of my boost functions. I would like the
>>>>>     function to look something like the following mockup below. Starts
>>>>>     off flat then there is a gradual decline, steep decline then
>>>>>     gradual decline and then back to flat.
>>>>>
>>>>>     Can some of you math guys please help :)
>>>>>
>>>>>     Thanks.
>>>>>
>>>>>
>>>>>
>>>>>
> 

Re: Need help with graphing function (MATH)

Posted by Mark <st...@gmail.com>.
Or better yet an example in solr would be best :)

Thanks!

On 2/14/12 11:05 AM, Mark wrote:
> Would you mind throwing out an example of these types of functions. 
> Looking at Wikipedia (http://en.wikipedia.org/wiki/Probit) its seems 
> like the Probit function is very similar to what I want.
>
> Thanks
>
> On 2/14/12 10:56 AM, Ted Dunning wrote:
>> In general this kind of function is very easy to construct using sums 
>> of basic sigmoidal functions. The logistic and probit functions are 
>> commonly used for this.
>>
>> Sent from my iPhone
>>
>> On Feb 14, 2012, at 10:05, Mark<st...@gmail.com>  wrote:
>>
>>> Thanks I'll have a look at this. I should have mentioned that the 
>>> actual values on the graph aren't important rather I was showing an 
>>> example of how the function should behave.
>>>
>>> On 2/13/12 6:25 PM, Kent Fitch wrote:
>>>> Hi, assuming you have x and want to generate y, then maybe
>>>>
>>>> - if x<  50, y = 150
>>>>
>>>> - if x>  175, y = 60
>>>>
>>>> - otherwise :
>>>>
>>>> either y = (100/(e^((x -50)/75)^2)) + 50
>>>> http://www.wolframalpha.com/input/?i=plot++%28100%2F%28e^%28%28x+-50%29%2F75%29^2%29%29+%2B+50%2C+x%3D50..175 
>>>>
>>>>
>>>>
>>>> - or maybe y =sin((x+5)/38)*42+105
>>>>
>>>> http://www.wolframalpha.com/input/?i=plot++sin%28%28x%2B5%29%2F38%29*42%2B105%2C+x%3D50..175 
>>>>
>>>>
>>>> Regards,
>>>>
>>>> Kent Fitch
>>>>
>>>> On Tue, Feb 14, 2012 at 12:29 PM, 
>>>> Mark<st...@gmail.com>>  
>>>> wrote:
>>>>
>>>>     I need some help with one of my boost functions. I would like the
>>>>     function to look something like the following mockup below. Starts
>>>>     off flat then there is a gradual decline, steep decline then
>>>>     gradual decline and then back to flat.
>>>>
>>>>     Can some of you math guys please help :)
>>>>
>>>>     Thanks.
>>>>
>>>>
>>>>
>>>>

Re: Need help with graphing function (MATH)

Posted by Mark <st...@gmail.com>.
Would you mind throwing out an example of these types of functions. 
Looking at Wikipedia (http://en.wikipedia.org/wiki/Probit) its seems 
like the Probit function is very similar to what I want.

Thanks

On 2/14/12 10:56 AM, Ted Dunning wrote:
> In general this kind of function is very easy to construct using sums of basic sigmoidal functions. The logistic and probit functions are commonly used for this.
>
> Sent from my iPhone
>
> On Feb 14, 2012, at 10:05, Mark<st...@gmail.com>  wrote:
>
>> Thanks I'll have a look at this. I should have mentioned that the actual values on the graph aren't important rather I was showing an example of how the function should behave.
>>
>> On 2/13/12 6:25 PM, Kent Fitch wrote:
>>> Hi, assuming you have x and want to generate y, then maybe
>>>
>>> - if x<  50, y = 150
>>>
>>> - if x>  175, y = 60
>>>
>>> - otherwise :
>>>
>>> either y = (100/(e^((x -50)/75)^2)) + 50
>>> http://www.wolframalpha.com/input/?i=plot++%28100%2F%28e^%28%28x+-50%29%2F75%29^2%29%29+%2B+50%2C+x%3D50..175
>>>
>>>
>>> - or maybe y =sin((x+5)/38)*42+105
>>>
>>> http://www.wolframalpha.com/input/?i=plot++sin%28%28x%2B5%29%2F38%29*42%2B105%2C+x%3D50..175
>>>
>>> Regards,
>>>
>>> Kent Fitch
>>>
>>> On Tue, Feb 14, 2012 at 12:29 PM, Mark<st...@gmail.com>>  wrote:
>>>
>>>     I need some help with one of my boost functions. I would like the
>>>     function to look something like the following mockup below. Starts
>>>     off flat then there is a gradual decline, steep decline then
>>>     gradual decline and then back to flat.
>>>
>>>     Can some of you math guys please help :)
>>>
>>>     Thanks.
>>>
>>>
>>>
>>>

Re: Need help with graphing function (MATH)

Posted by Kent Fitch <ke...@gmail.com>.
agreeing with wunder - I don't know the application, but I think almost
always, a set of linear approximations over a few ranges would be ok (and
you could increase the number of ranges until it was), and will be faster.

And if you need just one equation, a sigmoid function will do the trick,
such as

110 - 50((x-100)/20)/(sqrt(1+((x-100)/20)^2))

http://www.wolframalpha.com/input/?i=plot+110+-+50%28%28x-100%29%2F20%29%2F%28sqrt%281%2B%28%28x-100%29%2F20%29
^2%29%29%2C+x%3D0..200

Regards

Kent Fitch

On Wed, Feb 15, 2012 at 6:17 AM, Walter Underwood <wu...@wunderwood.org>wrote:

> In practice, I expect a linear piecewise function (with sharp corners)
> would be indistinguishable from the smoothed function. It is also much
> easier to read, test, and debug. It might even be faster.
>
> Try the sharp corners one first.
>
> wunder
>
> On Feb 14, 2012, at 10:56 AM, Ted Dunning wrote:
>
> > In general this kind of function is very easy to construct using sums of
> basic sigmoidal functions. The logistic and probit functions are commonly
> used for this.
> >
> > Sent from my iPhone
> >
> > On Feb 14, 2012, at 10:05, Mark <st...@gmail.com> wrote:
> >
> >> Thanks I'll have a look at this. I should have mentioned that the
> actual values on the graph aren't important rather I was showing an example
> of how the function should behave.
> >>
> >> On 2/13/12 6:25 PM, Kent Fitch wrote:
> >>> Hi, assuming you have x and want to generate y, then maybe
> >>>
> >>> - if x < 50, y = 150
> >>>
> >>> - if x > 175, y = 60
> >>>
> >>> - otherwise :
> >>>
> >>> either y = (100/(e^((x -50)/75)^2)) + 50
> >>> http://www.wolframalpha.com/input/?i=plot++%28100%2F%28e
> ^%28%28x+-50%29%2F75%29^2%29%29+%2B+50%2C+x%3D50..175
> >>>
> >>>
> >>> - or maybe y =sin((x+5)/38)*42+105
> >>>
> >>>
> http://www.wolframalpha.com/input/?i=plot++sin%28%28x%2B5%29%2F38%29*42%2B105%2C+x%3D50..175
> >>>
> >>> Regards,
> >>>
> >>> Kent Fitch
> >>>
> >>> On Tue, Feb 14, 2012 at 12:29 PM, Mark <static.void.dev@gmail.com<mailto:
> static.void.dev@gmail.com>> wrote:
> >>>
> >>>   I need some help with one of my boost functions. I would like the
> >>>   function to look something like the following mockup below. Starts
> >>>   off flat then there is a gradual decline, steep decline then
> >>>   gradual decline and then back to flat.
> >>>
> >>>   Can some of you math guys please help :)
> >>>
> >>>   Thanks.
> >>>
>
>
>
>
>

Re: Need help with graphing function (MATH)

Posted by Walter Underwood <wu...@wunderwood.org>.
In practice, I expect a linear piecewise function (with sharp corners) would be indistinguishable from the smoothed function. It is also much easier to read, test, and debug. It might even be faster.

Try the sharp corners one first.

wunder

On Feb 14, 2012, at 10:56 AM, Ted Dunning wrote:

> In general this kind of function is very easy to construct using sums of basic sigmoidal functions. The logistic and probit functions are commonly used for this. 
> 
> Sent from my iPhone
> 
> On Feb 14, 2012, at 10:05, Mark <st...@gmail.com> wrote:
> 
>> Thanks I'll have a look at this. I should have mentioned that the actual values on the graph aren't important rather I was showing an example of how the function should behave.
>> 
>> On 2/13/12 6:25 PM, Kent Fitch wrote:
>>> Hi, assuming you have x and want to generate y, then maybe
>>> 
>>> - if x < 50, y = 150
>>> 
>>> - if x > 175, y = 60
>>> 
>>> - otherwise :
>>> 
>>> either y = (100/(e^((x -50)/75)^2)) + 50
>>> http://www.wolframalpha.com/input/?i=plot++%28100%2F%28e^%28%28x+-50%29%2F75%29^2%29%29+%2B+50%2C+x%3D50..175
>>> 
>>> 
>>> - or maybe y =sin((x+5)/38)*42+105
>>> 
>>> http://www.wolframalpha.com/input/?i=plot++sin%28%28x%2B5%29%2F38%29*42%2B105%2C+x%3D50..175
>>> 
>>> Regards,
>>> 
>>> Kent Fitch
>>> 
>>> On Tue, Feb 14, 2012 at 12:29 PM, Mark <static.void.dev@gmail.com <ma...@gmail.com>> wrote:
>>> 
>>>   I need some help with one of my boost functions. I would like the
>>>   function to look something like the following mockup below. Starts
>>>   off flat then there is a gradual decline, steep decline then
>>>   gradual decline and then back to flat.
>>> 
>>>   Can some of you math guys please help :)
>>> 
>>>   Thanks.
>>> 





Re: Need help with graphing function (MATH)

Posted by Ted Dunning <te...@gmail.com>.
In general this kind of function is very easy to construct using sums of basic sigmoidal functions. The logistic and probit functions are commonly used for this. 

Sent from my iPhone

On Feb 14, 2012, at 10:05, Mark <st...@gmail.com> wrote:

> Thanks I'll have a look at this. I should have mentioned that the actual values on the graph aren't important rather I was showing an example of how the function should behave.
> 
> On 2/13/12 6:25 PM, Kent Fitch wrote:
>> Hi, assuming you have x and want to generate y, then maybe
>> 
>> - if x < 50, y = 150
>> 
>> - if x > 175, y = 60
>> 
>> - otherwise :
>> 
>> either y = (100/(e^((x -50)/75)^2)) + 50
>> http://www.wolframalpha.com/input/?i=plot++%28100%2F%28e^%28%28x+-50%29%2F75%29^2%29%29+%2B+50%2C+x%3D50..175
>> 
>> 
>> - or maybe y =sin((x+5)/38)*42+105
>> 
>> http://www.wolframalpha.com/input/?i=plot++sin%28%28x%2B5%29%2F38%29*42%2B105%2C+x%3D50..175
>> 
>> Regards,
>> 
>> Kent Fitch
>> 
>> On Tue, Feb 14, 2012 at 12:29 PM, Mark <static.void.dev@gmail.com <ma...@gmail.com>> wrote:
>> 
>>    I need some help with one of my boost functions. I would like the
>>    function to look something like the following mockup below. Starts
>>    off flat then there is a gradual decline, steep decline then
>>    gradual decline and then back to flat.
>> 
>>    Can some of you math guys please help :)
>> 
>>    Thanks.
>> 
>> 
>> 
>> 

Re: Need help with graphing function (MATH)

Posted by Mark <st...@gmail.com>.
Thanks I'll have a look at this. I should have mentioned that the actual 
values on the graph aren't important rather I was showing an example of 
how the function should behave.

On 2/13/12 6:25 PM, Kent Fitch wrote:
> Hi, assuming you have x and want to generate y, then maybe
>
> - if x < 50, y = 150
>
> - if x > 175, y = 60
>
> - otherwise :
>
> either y = (100/(e^((x -50)/75)^2)) + 50
> http://www.wolframalpha.com/input/?i=plot++%28100%2F%28e^%28%28x+-50%29%2F75%29^2%29%29+%2B+50%2C+x%3D50..175
>
>
> - or maybe y =sin((x+5)/38)*42+105
>
> http://www.wolframalpha.com/input/?i=plot++sin%28%28x%2B5%29%2F38%29*42%2B105%2C+x%3D50..175
>
> Regards,
>
> Kent Fitch
>
> On Tue, Feb 14, 2012 at 12:29 PM, Mark <static.void.dev@gmail.com 
> <ma...@gmail.com>> wrote:
>
>     I need some help with one of my boost functions. I would like the
>     function to look something like the following mockup below. Starts
>     off flat then there is a gradual decline, steep decline then
>     gradual decline and then back to flat.
>
>     Can some of you math guys please help :)
>
>     Thanks.
>
>
>
>

Re: Need help with graphing function (MATH)

Posted by Kent Fitch <ke...@gmail.com>.
Hi, assuming you have x and want to generate y, then maybe

- if x < 50, y = 150

- if x > 175, y = 60

- otherwise :

either y = (100/(e^((x -50)/75)^2)) + 50
http://www.wolframalpha.com/input/?i=plot++%28100%2F%28e
^%28%28x+-50%29%2F75%29^2%29%29+%2B+50%2C+x%3D50..175


- or maybe y =sin((x+5)/38)*42+105

http://www.wolframalpha.com/input/?i=plot++sin%28%28x%2B5%29%2F38%29*42%2B105%2C+x%3D50..175

Regards,

Kent Fitch

On Tue, Feb 14, 2012 at 12:29 PM, Mark <st...@gmail.com> wrote:

>  I need some help with one of my boost functions. I would like the
> function to look something like the following mockup below. Starts off flat
> then there is a gradual decline, steep decline then gradual decline and
> then back to flat.
>
> Can some of you math guys please help :)
>
> Thanks.
>
>
>
>