Post Reply 
[VA] Short & Sweet Math Challenge #24: "2019 Spring Special 5-tier"
03-22-2019, 08:04 AM
Post: #4
RE: [VA] Short & Sweet Math Challenge #24: "2019 Spring Special 5-tier"
(I noticed that the SSMC24 was Valentin's post #314 at the time of writing :-)

Tier 5: Guru
In summary : Write a program or function cin(x) which has the defining property that cin(cin(cin(x))) = sin(x).
Once written, use it to tabulate cin(x) for x = 0.0, 0.2, 0.4, ..., 1.0


From the properties of sin we can restrict the search of cin(x) in the interval [0,pi/2].

The problem implicitly assumes that the cin(x) function is unique, otherwise it would make no sense to discuss the cin(x) values.
If we understand 'function' in the mathematic sense of an analytical, non-pathologic function, this may be true.

But if we understand 'function' in the computer science sense of a procedure that takes one argument and returns one result, there are very likely many cin 'functions' such as cin(cin(cin(x)))=sin(x)
One such solution for the HP71 is below:

10 ! SSMC24A
20 DEF FNC(X)
30 IF X=0 THEN Y=0 @ GOTO 70
40 X=ABS(X)
50 Y=LN(X)
60 IF Y<2 THEN Y=1+EXP(X) ELSE Y=SIN(LN(LN(X-1)-1))
70 FNC=Y
80 END DEF
85 !
90 FOR X=0 TO 1 STEP .1
100 PRINT FNC(FNC(FNC(X)));SIN(X)
110 NEXT X

>RUN
0 0
9.98334166508E-2 9.98334166468E-2
.198669330795 .198669330795
.295520206664 .295520206661
.389418342308 .389418342309
.479425538604 .479425538604
.564642473395 .564642473395
.644217687238 .644217687238
.717356090899 .7173560909
.783326909628 .783326909627
.841470984808 .841470984808

I don't take this solution too seriously :-)
Still searching for a better one...

J-F
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [VA] Short & Sweet Math Challenge #24: "2019 Spring Special 5-tier" - J-F Garnier - 03-22-2019 08:04 AM



User(s) browsing this thread: 1 Guest(s)