Post Reply 
Sourcebook for Prog Calcs (TI)
11-23-2023, 01:17 PM
Post: #21
RE: Sourcebook for Prog Calcs (TI)
Excellent source, thanks. Pedro
Find all posts by this user
Quote this message in a reply
11-24-2023, 10:08 AM
Post: #22
RE: Sourcebook for Prog Calcs (TI)
Hello,

Does anyone have a link to the book "La calculatrice scientifique" (VANGELUWE / GLORIEUX) (Hachette, Collection Faire le point, 1979) ?

It seems I've lost it, it was a very fascinating book with programming examples

Thanks
Find all posts by this user
Quote this message in a reply
11-24-2023, 12:27 PM
Post: #23
RE: Sourcebook for Prog Calcs (TI)
Not a PDF free, but a possible way to get a copy here:
https://books.google.com.ar/books/about/...edir_esc=y

https://fr.shopping.rakuten.com/offer/bu...rieux.html

Pedro
Find all posts by this user
Quote this message in a reply
11-24-2023, 12:51 PM
Post: #24
RE: Sourcebook for Prog Calcs (TI)
(11-24-2023 10:08 AM)Pekis Wrote:  Hello,

Does anyone have a link to the book "La calculatrice scientifique" (VANGELUWE / GLORIEUX) (Hachette, Collection Faire le point, 1979) ?

It seems I've lost it, it was a very fascinating book with programming examples

Thanks

I have had a copy since its release in 1979 but it is in a "pocket" format and it is impossible to scan it without breaking it.

http://ti58c.phweb.me
http://clones.phweb.me
http://www.instagram.com/ti58c
"No! Do or Do not. There is no try!" [Master Yoda]
Visit this user's website Find all posts by this user
Quote this message in a reply
11-24-2023, 01:19 PM
Post: #25
RE: Sourcebook for Prog Calcs (TI)
Just to make you want... the table of contents


Attached File(s) Thumbnail(s)
       

http://ti58c.phweb.me
http://clones.phweb.me
http://www.instagram.com/ti58c
"No! Do or Do not. There is no try!" [Master Yoda]
Visit this user's website Find all posts by this user
Quote this message in a reply
11-25-2023, 07:51 AM (This post was last modified: 11-25-2023 07:59 AM by Pekis.)
Post: #26
RE: Sourcebook for Prog Calcs (TI)
Merci, Pierre and Gracias, Pedro !
Find all posts by this user
Quote this message in a reply
11-27-2023, 12:11 AM
Post: #27
RE: Sourcebook for Prog Calcs (TI)
(11-04-2023 04:44 AM)Matt Agajanian Wrote:  Has anyone ported programs from TI’s book to an HP programmable?

Equation of Time

This program is a translation for the HP-42S:
Code:
00 { 126-Byte Prgm }
01▸LBL "EOT"
# Calculates α.
02▸LBL E  # Θ
03 1
04 →REC  # cos Θ
05 X<>Y  # sin Θ
06 X↑2
07 RCL 09  # sin^2 ε
08 ×
09 1
10 X<>Y
11 -
12 SQRT
13 ÷
14 ACOS
15 RTN
# Calculates φ if Θ < 360.
16▸LBL C  # Θ
17 180
18 -
19 XEQ E
20 180
21 +
22 GTO a
# Calculates φ if Θ < 540.
23▸LBL D  # Θ
24 360
25 -
26 XEQ E
27 360
28 +
29 GTO a
# Begins calculation of φ.
30▸LBL B  # t
31 RCL 06  # ω_0
32 ×
33 STO 14  # λ = ω_0 * t
34 SIN
35 2
36 ×
37 RCL 08  # e
38 ×
39 RCL 14  # λ
40 +
41 RCL 07  # Θ_0
42 +  # Θ = Θ_0 + λ + 2 * e * sin(λ)
43 360
44 X<>Y
45 X<Y?
46 GTO C  # Θ < 360
47 540
48 X<>Y
49 X<Y?
50 GTO D  # Θ < 540
51 X<>Y
52 -
53 XEQ E
54 540
55 +
# Computes E(t).
56▸LBL a  # α
57 RCL 14  # λ
58 RCL 07  # Θ_0
59 +
60 X<>Y  # α
61 -
62 4
63 ×
64 RTN  # 4 * (λ + Θ_0 - α) 
# Stores ω_0, Θ_0, deg(e) and sin^2 ε
65▸LBL A
66 STO 06  # ω_0
67 STOP
68 STO 07  # Θ_0
69 STOP
70 →DEG
71 STO 08  # deg(e)
72 STOP
73 SIN
74 X↑2
75 STO 09  # sin^2 ε
76 END

I made a few adjustments when calculating E end removed some registers that are not needed when using the stack.
Other than that the usage is the same as with the original program.

Here's a Python implementation:
Code:
from math import sqrt, sin, cos, acos, pi, degrees, radians

ω_0 = radians(360 / 365.2421982)
Θ_0 = radians(282.59646)
e = 0.0167175
ε = radians(23.441883)
κ = sin(ε)**2

def RA(Θ):
    return acos(cos(Θ) / sqrt(1 - κ * sin(Θ)**2))

def E(t):
    λ = ω_0 * t
    Θ = Θ_0 + λ + 2 * e * sin(λ)
    if Θ < 2 * pi:
        α = RA(Θ - pi) + pi
    elif Θ < 3 * pi:
        α = RA(Θ - 2 * pi) + 2 * pi
    else:
        α = RA(Θ - 3 * pi) + 3 * pi
    return 4 * degrees(λ + Θ_0 - α)

This prints a table:
Code:
for t in range(0, 361, 20):
    print(f"{t:3} {E(t):12.6f}")

  0    -4.368882
 20   -11.746792
 40   -14.207033
 60   -11.796538
 80    -6.421670
100    -0.675805
120     3.039227
140     3.272447
160     0.262027
180    -3.894666
200    -6.328610
220    -5.151356
240    -0.360710
260     6.456142
280    12.854483
300    16.223871
320    14.591118
340     7.750332
360    -1.889634


Or if you want to plot it:
Code:
import matplotlib.pyplot as plt
import numpy as np

# Data for plotting
ts = np.arange(0.0, 365.0, 1.0)
Es = [E(t) for t in ts]

fig, ax = plt.subplots()
ax.plot(ts, Es)

ax.set(xlabel='time t (day)', ylabel='E(t) (min)',
       title='Equation of Time')
ax.grid()

fig.savefig("equation-of-time.png")
plt.show()

[Image: attachment.php?aid=12949]



However this reminded me of my article in the old forum: Sunrise and Sunset

The following formula is used:

\[
\psi(t) = t + 2 e \sin(t) + \frac{5}{4} e^2 \sin(2t) + \cdots
\]

And then a coordinate transformation is used based on →REC and →POL.
All the constants have to be stored in radians.

Register Contents

\(
\begin{matrix}
R_{00} & \omega_0 \\
R_{01} & e \\
R_{02} & \varepsilon \\
R_{03} & \Theta_0 \\
\end{matrix}
\)

Astronomical Constants

The astronomical constants for the epoch 1980 are given below:

\(
\begin{align}
\omega_0 &= 360^\circ / 365.2421982 \; \text{days} \\
e &= 0.0167175 \\
\varepsilon &= 23.441883^\circ \\
\Theta_0 &= 282.59646^\circ \\
\end{align}
\)

Here's the program for the HP-42S:
Code:
00 { 53-Byte Prgm }
01▸LBL "μ"
02 RCL× 00  # ω_0
03 ENTER
04 ENTER
05 RAD
06 RCL 01  # e
07 →REC
08 5
09 ×
10 2
11 ÷
12 2
13 +
14 ×
15 +
16 RCL+ 03  # Θ_0
17 RCL 02  # ε
18 X<>Y
19 1
20 →REC
21 R↓
22 →REC
23 R↑
24 →POL
25 X<>Y
26 R↓
27 →POL
28 X<>Y
29 R↓
30 R↓
31 RCL+ 03  # Θ_0
32 X<>Y
33 -
34 SIN
35 ASIN
36 →DEG
37 4
38 ×
39 END

You may notice that the results are slightly different.


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
12-28-2023, 07:32 PM
Post: #28
RE: Sourcebook for Prog Calcs (TI)
   
Merci au Père Noël !
Thanks to Santa !
   

http://ti58c.phweb.me
http://clones.phweb.me
http://www.instagram.com/ti58c
"No! Do or Do not. There is no try!" [Master Yoda]
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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