Some trig help, please



#2

Hello all,

I am trying to develop a sine function such that the negative part of the phase is shorter than the positive part of it.

It's a biorhythm curve. But, what makes this curve so different is that as the 23-day cycle has 11-1/2 days in positive and 11-1/2 in negative area, my variation only has three days below zero line. Now, one of the algorithms I've fiddled with is the trigonometric formation:

a * sin [b * (x + c)] + d

Where a will adjust the amplitude of the wave,
d will affect the horizontal position of the wave.

Although coefficients a and d do not affect the variance in periodicity, I am wondering if adjusting coefficients b and c will produce the variance of periodicity I need.

If so, how should I adjust coefficients b & c so that of the 23-day cycle, 20 days are spent on the positive part of the graph while the remaining three are in negative range?

Thank you


#3

The coefficient c has no effect on the period, only on the phase. To get a period of 23 days, set b to pi/11.5 . To get 20 days above and only three below, set d to 0.9172a. This will give you a sine wave with a period of 23 days, an amplitude of 2a, a minimum of .0828a, a maximum of 1.9172a, and positive everywhere except from day 15.75 to day 18.75 .


#4

So that I understand the trigonometry a bit better, please tell me how you arrived at these numbers.

Thanks

#5

I suppose I'm eventually going to have to explain how I arrived at my results, so here goes...

I want to shift the basic sine wave up so that only 3/23 of the period is negative. To do this I found two points 3/23 of a period apart that have the same sine by using this 15C+ program:

01 LBL 9
02 SIN
03 LASTx
04 RCL - 0
05 SIN
06 -
Where Register 0 contains (3/23)*(2pi) and then simply SOLVEd it between pi and 2pi (yes, yes, it might have been a bit quicker to solve between pi and 1.5pi). This gave me 4.3026, and the sine of that is -0.9172 .

Edit: Yep, Matt's request for an explanation came while I was composing this.

Edit 2: Now that I've had a night's sleep, I realize I've done this the hard way. The simple way is -sin[3pi/2 - (1/2)*(3/23)*(2pi)]

Edited: 13 Apr 2013, 1:45 p.m. after one or more responses were posted


#6

Okay, got it!

#7

Okay! Now that we solved that, I noticed that the amplitude reaches past +1, the negative period is so short, the negative amplitude is not an issue. So, how can I restrict the maximum positive amplitude to +1?

Next, how can I adjust the function so that 0 occurs at x= 16 1/2 and continues decreasing, followed by an upturn which reaches 0 at x=19?


Edited: 13 Apr 2013, 1:16 a.m. after one or more responses were posted


#8

Since the maximum is 1.9172a, simply set a to 1/1.9172 .


#9

Now I'm completely confused. When I put in the new value for a, 1/0.917211302 so that f(0)=1, I still get f(0)=0.917211302.

After putting the original coefficients you gave me in, 0.917211302 comes as the first value where x=0, so, starting from scratch, how can I adjust the function so that positive maximum is 1, f(15 1/2)=0 decreasing towards an upturn where f(19)=0.

Now, with all this restated, what should the coefficients be.

And, please accept my apologies for any confusion or frustration this project has caused.


Edited: 13 Apr 2013, 2:22 a.m.


#10

Quote:
..., so, starting from scratch, how can I adjust the function so that positive maximum is 1, f(15 1/2)=0 decreasing towards an upturn where f(19)=0.

Now, with all this restated, what should the coefficients be.


Well, now you're indeed a bit confusing: first you wanted a negative interval of 3 days, and now you want 3.5 days (from 15.5 to 19). Or is it 2.5 days (from 16.5 to 19 as in your last post?).

Ok, I take these conditions (with 15.5, i.e. a negative interval of 3.5), and I still assume the whole period should be 23 and the maximum value 1.

With these conditions your function looks like this:

y = a*sin((2*pi/23)*x) + a*sin(8*pi/23) with a=1/(1+sin(8*pi/23))


So for your initial function a * sin [b * (x + c)] + d that means:

a = 1/(1+sin(8*pi/23)) = 0.529693219

b = 2*pi/23 = 0.273181969

c = 0

d = sin(8*pi/23)/(1+sin(8*pi/23)) = 0.47030678

i.e. y = 0.529693219*sin(0.273181969*x) + 0.47030678

Franz


#11

Good grieve, all that hassle and nine decimals for a biorhythm. Employ RAN# instead ;-/


#12

Quote:
Good grieve, all that hassle and nine decimals for a biorhythm. Employ RAN# instead ;-/

Aaah, once again a great comment from our math expert ... ;-)

Franz

Edited: 13 Apr 2013, 10:47 a.m.

#13

My focus was on f(16.5)=0 downward to f(19)=0, proceeding upward. So, what would the equation look like with this setup?

Edited: 13 Apr 2013, 11:51 a.m.


#14

Like Franz, I'm getting confused. You now want it negative for 2.5 days instead of the original 3?

#15

Quote:
My focus was on f(16.5)=0 downward to f(19)=0, proceeding upward. So, what would the equation look like with this setup?

Well, then the function is:

y = a*sin((2*pi/23)*(x-1/2)) + a*sin(9*pi/23) with a=1/(1+sin(9*pi/23))

So for your initial function a * sin [b * (x + c)] + d that means:

a = 1/(1+sin(9*pi/23))

b = 2*pi/23

c = -1/2

d = sin(9*pi/23)/(1+sin(9*pi/23))


I hope this is the last change in your conditions! ;-)

Franz


#16

To Franz and all the group.

Thank you very much. Like I said, I am grateful for all your help on this and, as I'd said before, I apologise for any confusion and frustration my inquiry has caused.

#17

So that I can learn more about how this trig algorithm works, how were these values derived?

Thank you.


#18

Quote:
So that I can learn more about how this trig algorithm works, how were these values derived?

Oh, that's complicated to describe only with words without showing it on a graph, but I'll try it:

I did it in 4 steps:

1) make the period 23 (i.e. b=?) ==> y = f(x) = a*sin(2*pi/23*x)

2) shift the function upwards, so that y is negative only in an interval of 2.5 (i.e. d=?):

this 2.5 interval is symmetric around the minimum at x=23/4*3 (or the maximum at x=23/4), so this shift-value d is f(23/4-2.5/2) (I took it at the maximum for getting smaller numbers) which leads to d = a*sin(2*pi/23*(23/4-2.5/2)) = a*sin(9*pi/23)

Now we have y = f(x) = a*sin(2*pi/23*x) + a*sin(9*pi/23)

3) now scale the function to get a max. y-value of 1 (i.e. a=?):

you get this max. y-value of 1 for x=23/4:

f(23/4) = a*sin(2*pi/23*23/4) + a*sin(9*pi/23) = a*sin(pi/2) + a*sin(9*pi/23) =

a + a*sin(9*pi/23) = a*(1+sin(9*pi/23)) = 1 ==>

a = 1/(1+sin(9*pi/23))

4) and finally shift the function in x-direction, so that the first zero should be at x=16.5 (i.e. c=?):

as I explained in point 2) the zero of the up-shifted function is currently at 16 (that is 23/4*3-2.5/2), so the function must be shifted to the right by a value of 0.5, and thus x has to be replaced by x-1/2

These 4 steps together lead to the following solution:

y = f(x) = 1/(1+sin(9*pi/23))*[sin(2*pi/23*(x-1/2)) + sin(9*pi/23)]

Franz

Edited: 13 Apr 2013, 4:23 p.m.


#19

Franz, your explanation is just what I needed to understand this precisely. You are very good at putting the graph into words. With your step-by-step explanation, I am able to understand more clearly how the equation works because you have explained how each step affects the graph's appearance and function's periodicity. That helps me understand precisely how and why the function works the way it does.

Thanks.


#20

You're welcome, Matt!

Quote:
You are very good at putting the graph into words.

Well, after teaching mathematics for about 30 years I guess I have a bit ;-) experience in explaining, but of course in German (and with a diagram at hand) I could have done it much better.

Franz

#21

Quote:

Oh, that's complicated to describe only with words without showing it on a graph, but I'll try it:

I did it in 4 steps:

1) make the period 23 (i.e. b=?) ==> y = f(x) = a*sin(2*pi/23*x)



2) shift the function upwards, so that y is negative only in an interval of 2.5 (i.e. d=?):

this 2.5 interval is symmetric around the minimum at x=23/4*3 (or the maximum at x=23/4), so this shift-value d is f(23/4-2.5/2) (I took it at the maximum for getting smaller numbers) which leads to d = a*sin(2*pi/23*(23/4-2.5/2)) = a*sin(9*pi/23)



Now we have y = f(x) = a*sin(2*pi/23*x) + a*sin(9*pi/23)

3) now scale the function to get a max. y-value of 1 (i.e. a=?):

you get this max. y-value of 1 for x=23/4:

f(23/4) = a*sin(2*pi/23*23/4) + a*sin(9*pi/23) = a*sin(pi/2) + a*sin(9*pi/23) =

a + a*sin(9*pi/23) = a*(1+sin(9*pi/23)) = 1 ==>

a = 1/(1+sin(9*pi/23))



4) and finally shift the function in x-direction, so that the first zero should be at x=16.5 (i.e. c=?):

as I explained in point 2) the zero of the up-shifted function is currently at 16 (that is 23/4*3-2.5/2), so the function must be shifted to the right by a value of 0.5, and thus x has to be replaced by x-1/2



These 4 steps together lead to the following solution:

y = f(x) = 1/(1+sin(9*pi/23))*[sin(2*pi/23*(x-1/2)) + sin(9*pi/23)]

Franz




#22

Franz, this is fantastic. Not only do I see what you were developing, with the graph's step by step transformation I can clearly understand it. Thanks again!!


#23

Quote:
Franz, this is fantastic.

Matt, this diagrams were made by C.Ret, not by me. ;-)

BTW, in the last final formula there's a () missing.

Franz


#24

So, how should that last formula read?


#25

Quote:
So, how should that last formula read?

The error is not in the text but in the last formula in the graphic:

Instead of sin(2*pi/23*x-1/2) it must be sin(2*pi/23*(x-1/2)), i.e. the () around x-1/2 is missing.

Franz


#26

Thanks for the clarification. And thanks to you folks here, I'm brushing up on my long forgotten trig properties, axioms and identities.

#27

Really you're do not need the value of these three function. The "critical days" are where these graphs cross out the x-axis. So the simplest biorithm calculator need only delta-days calculation and a fractional part function, like on 12C:

RCL 0
x<>y
deltaDYS
STO 1
33
/
FRAC
RCL 1
28
/
FRAC
RCL 1
23
/
FRAC
RCL1
GTO 00

For running you need to store the birthdate to Reg0 and type in actual date and press R/S. After running you can see the days from the birth, then press RollDown, you can see the Physical cycle fractional part of 23 days, press RollDown, you can see the Emotional cycle fractional part and then press again RollDown, you can see the Intellectual part.

Because one day is approx 0.03...0.05 part of the cycle the critical values where the each function crosses the x-axis: 0.00...0.04 and 0.96...1.00

For example Euler Physical, Emotional and Intellectual state on 18. Sept, 1783. (birthdate: 15. Apr, 1707.):

g D.MY
15.041707 STO 0
18.091783 R/S
(...running...)
27915 (number of days Euler's life)
0.70 Physical (difference from 1.00 = -0.30 it's approx. -7 days from crytical days)
0.96 Emotional (Crytical!!!)
0.91 Intellectual (3 days from crytical!)

Csaba

#28

Make it sin(2*pi/23*(x+3)), i.e. b=2*pi/23 and c=3.

Franz


#29

This still has 11.5 days negative instead of the requested 3.


#30

No, make a plot and you'll see that it's correct.

Ftanz


#31

I did plot it, and half of the graph is negative.


#32

I guess I misunderstood what Matt wanted!?

I thought he meant a period of 23 days, but it shouldn't start at zero but at -3 (or in other words: the curve should be shifted left 3 days).

That's the usual problem with a foreign language ... :-(

Franz


#33

As I interpreted the question (and it's not my native tongue either) he wants a function which is negative 3/23 of the time and positive the other 20/23.


#34

Yup, that's it.

#35

Quote:
I guess I misunderstood what Matt wanted!?

I thought he meant a period of 23 days, but it shouldn't start at zero but at -3 (or in other words: the curve should be shifted left 3 days).

That's the usual problem with a foreign language ... :-(

Franz


No Franz, you were right, the period is 23 days, yes. It's just that the variance in positive/negative duration is very different. It's okay.

Possibly Related Threads…
Thread Author Replies Views Last Post
  Trig vs hyperbolic handling differences in Prime CAS Michael de Estrada 3 1,593 11-08-2013, 06:26 PM
Last Post: Mark Hardman
  Trig Functions Howard Owen 11 3,641 09-16-2013, 02:53 PM
Last Post: Fred Lusk
  trig scales on the Post Versalog slide rule Al 12 3,732 09-15-2013, 06:01 AM
Last Post: John I.
  Trig Identity question Namir 13 3,535 03-04-2013, 07:45 PM
Last Post: Eric Smith
  Question about trig functions approximation Namir 8 2,552 01-10-2013, 06:49 AM
Last Post: Valentin Albillo
  WP 34S Complex trig/hyperbolic bugs? Eamonn 35 8,682 04-26-2012, 07:32 PM
Last Post: Pete Wilson
  Just a thought I had--a 35S Trig fix Matt Agajanian 62 12,706 03-26-2012, 10:40 AM
Last Post: bill platt
  10bii+ Trig Bug Katie Wasserman 5 1,958 07-06-2011, 05:01 PM
Last Post: Thomas Radtke
  HTML glitch in Don Jennings' "Trig questions" thread? Karl Schneider 5 1,621 11-22-2008, 04:14 PM
Last Post: V-PN
  Trig questions Don Jennings 9 2,282 11-22-2008, 08:31 AM
Last Post: Pal G.

Forum Jump: