Tan(x) curves

Started by
2 comments, last by IADaveMark 22 years, 3 months ago
Question... I am creating some decision curves based on the tan(x) function. The target being that as the condition changes (x axis) I want the middle of the curve to be relatively flat i.e. not changing the satisfaction (y axis). However, as the condition increases (increase x), the satisfaction decreases at an accelerated rate (decrease y) to the ultimate end of there being a 0 satisfaction. The same would be true for the X condition decreasing, thereby increasing the satisfaction at an increasing rate. I want to be able to define the outer bounds of X where I can be assured that the curve will not intersect (i.e. never be acceptable or always be acceptable) as well as defining what my upper and lower boundaries are where I want the satisifaction to peak or bottom out. An example scenario is this: X axis is ticket price Y axis is satisfaction Ticket prices average $200 (avgTix) At an average of $200, the satisfaction level is 50% (200,50) As the prices increase the satisfaction level decreases, slowly at first but the quicker as they depart further from the average. e.g. $200 to $210 is no big deal whereas $300 to $310 matters far more. The same is true for the reverse... with satisfaction increasing as prices decrease... slowly at first but then with increasing fervor. Rule #1, a person will never pay more than 2x the average ticket price (x < 2*avgTix) Rule #2, the tickets will never be free (x>0) Rule #3, the satisfaction (y) will reach 0% approximately just short of the right bound (x = 2*avgTix) Rule #4, the satisfaction will reach 100% just short of the left bound (x = 0) Rule #5, I need to be able to control the slope of the curve with a coefficient to change how "flat" the center part of the curve is. That way I can adjust how much of a difference those small changes in the middle make. I want to be able to input the average ticket price (thereby calculating the rightmost boundary automatically) and the proposed ticket price to the person (x) and have it spit back the satisfaction level (y). Assume I build in the validation ahead of time to check if the proposed ticket price is too high (x >= 2*avgTix) or too low (x<=0) and therefore all numbers entered into the formula are valid. Can anyone help? Dave Mark Intrinsic Algorithm Development

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

Advertisement
Why a tangent function instead of exponential? I think you are looking at the problem wrong. You are comparing the change in satisfaction to the differance from the average price. That is the slope of a secant line and not the slope of the curve. Instead you have to look at how the satisfaction changes for a fixed change in price at a given point on the curve. That is an approximation of the slope and gives you some idea what happens with the slope. Making matters a bit harder is that you are setting limits on satisfaction. That would make it an arc tangent scale, i.e. as you vary from negative to positive infinite you move from one limit to the other. That is just scaling an axis and is not your curve representing satisfaction.
Keys to success: Ability, ambition and opportunity.
Thanks for your concern. I had also looked at using an exponential curve - and I know how to do that... which is why I only posted the question regarding tangent functions and nothing regarding exponential. I didn't want to clutter the matter... suppose it doesn't matter now, does it?

The curve I am looking at on the exponential side is as follows:

n = average ticket price
x = proposed ticket price
y = satisfaction rating

y=(((n-x)/(n/4))^3)+50

If you graph this, you will see that it accomplishes much of what I discussed in the original post in that the sat. dives for 0 upon nearing the 2x mark and hits 100% where the tix are approaching free. (x=0) The actual intercepts are about 8% of the average ticket price yields 100% satisfaction. and 192% of the average ticket yields 0% satisfaction. I know I could actually tweak my coefficients to make it exact, but that's fine...

The big problem with this is that it is too flat in the middle section (i.e. slope ~ 0) so that minor deviations in the ticket price have little effect on the satisfaction rating. I need there to be SOME effect on the sat. when there are minor changes in price (i.e. a negative slope) but still having the effect of that change increasing as you move farther from the average.

The tangent curve does indeed provide me with that slope across the middle and much the same curve shape.

If you can improve the above formula, great. If not, did you perhaps have an answer for the original question?


Dave Mark
Intrinsic Algorithm Development

Edited by - InnocuousFox on January 3, 2002 4:25:01 PM

Edited by - InnocuousFox on January 3, 2002 4:28:19 PM

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

As for your question I''m not sure exactly what it is. If y=f(x) then you shift the curve up by y=f(x)+c and down by y=f(x)-c. You shift it right by y=f(x-c) and left by y=f(x+c). You scale it in the y direction by y=c*f(x) and in the x direction by y=f(x/c). In all of these c is some constant. It is generally easiest to control it if you scale and then translate. So first you scale g(x)=c1*f(x) and then you translate y(x)=g(x)+c2 or y(x)=c1*f(x)+c2. So using scaling factors (sx,sy) and translation (cx,cy) you get y(x)=sy*tan(x/sy-cx)+cy. The combination of sx and sy controls your slope. Your translation is (avgprc,50). Now to get your scale it is easies to do that before translation. If you want it to go through (0,0) and (2*avgprc,100) then that is the same as (0,0)-(avgprc,50) and (2*avgprc,100)-(avgprc,50) or (-avgprc,-50) and (avgprc,50) before translation. So 50=sy*tan(avgprc/sx) or sx=avgprc/atan(50/sy). You can pick any value you want for sy except zero, but you can''t use any value you please for sx. atan has a domain from negative to positive infinity, but tan has a domain only from -pi/2 to pi/2.
Keys to success: Ability, ambition and opportunity.

This topic is closed to new replies.

Advertisement