Post Reply 
[HP41] Lambda Modular function; question
12-31-2022, 12:17 PM
Post: #1
[HP41] Lambda Modular function; question
Hello,
is anywhere a program to calculate the points of lambda with an HP41? RPN or RPN in MOD or Microcode in MOD? with complex numbers.
In Wiki, there is a curve https://en.wikipedia.org/wiki/Modular_la...nction.svg
First I would like to calculate several points of
a) lambda(i*x) then
b) (e^(1/e))*(1-lambda(i*x)) then..
x between 0 and 10.
Any advise is welcome.
(if none exists in HP41 - or HP71 -, I will look at other calculator or PC-computing)

HP71B 4TH/ASM/Multimod, HP41CV/X/Y & Nov64d, PILBOX, HP-IL 821.62A & 64A & 66A, Deb11 64b-PC & PI2 3 4 w/ ILPER, VIDEO80, V41 & EMU71, DM41X
Find all posts by this user
Quote this message in a reply
01-07-2023, 11:15 AM
Post: #2
RE: [HP41] Lambda Modular function; question
Here's a quick & dirty routine using 12 terms of the q-expansion and the 41Z.
More terms would be needed for better accuracy near the origin in the imaginary axis.

Input: Im(z) in Y, Re(z) in X

Code:

 01*LBL "ZML"
 02 ZENTER^
 03 PI
 04 0
 05 Z*
 06 ZEXP
 07 ENTER^
 08 ENTER^
 09 ENTER^
 10 13504512
 11 CHS
 12 *
 13 5702208
 14 +
 15 *
 16 2320128
 17 -
 18 *
 19 904784
 20 +
 21 *
 22 335872
 23 -
 24 *
 25 117632
 26 +
 27 *
 28 38400
 29 -
 30 *
 31 11488
 32 +
 33 *
 34 3072
 35 -
 36 *
 37 704
 38 +
 39 *
 40 128
 41 -
 42 *
 43 16
 44 +
 45 *
 46 END

"To live or die by your own sword one must first learn to wield it aptly."
Find all posts by this user
Quote this message in a reply
01-07-2023, 05:38 PM
Post: #3
RE: [HP41] Lambda Modular function; question
Thanks. For comparison in python.

Code:
import math as math
from mpmath import *
import matplotlib.pyplot as plt
import numpy as np
#
mp.dps = 25
mp.pretty = True
#
# Knowledge
# https://mpmath.org/doc/current/functions/elliptic.html
# https://mpmath.org/doc/current/functions/hypergeometric.html
# green curve = https://en.wikipedia.org/wiki/Modular_lambda_function#/media/File:Lambda_function.svg
# https://en.wikipedia.org/wiki/Modular_lambda_function
#
def func_fromk(p_in): 
# because p_in must be a number and not an array from np..
    return kfrom(tau=p_in*j)
#
N = 50
Wide = 3.
X = np.arange(0.,Wide,Wide/N)
Y1 = np.zeros(N)
Y2 = np.zeros(N)
#
# Y1 equal this? https://www.desmos.com/calculator/00bdl5omnf?lang=de
#
for i in range(N):
    Y1[i]=(1-((np.abs(func_fromk((Wide/N)*i)))**2))*((np.exp(1))**(1/(np.exp(1))))
    Y2[i]=(np.abs(func_fromk((Wide/N)*i)))**2
#
plt.plot(X,Y1,'r-')
plt.plot(X,Y2,'g-')
#
plt.xlabel('X')
plt.ylabel('.. of X*j (green) and (1-(..of (X*j)))*(e**(1/e)))')
plt.title('lambda of ..')
plt.grid()

# https://matplotlib.org/stable/gallery/lines_bars_and_markers/psd_demo.html#sphx-glr-gallery-lines-bars-and-markers-psd-demo-py
Steps=0.2
Xticks = np.arange(0, Wide, Steps)
plt.xticks(Xticks)
Yticks = np.arange(0, 1.8, Steps)
plt.yticks(Yticks)
plt.show()

HP71B 4TH/ASM/Multimod, HP41CV/X/Y & Nov64d, PILBOX, HP-IL 821.62A & 64A & 66A, Deb11 64b-PC & PI2 3 4 w/ ILPER, VIDEO80, V41 & EMU71, DM41X
Find all posts by this user
Quote this message in a reply
Post Reply 




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