How do I get CAS to evaluate a Python-in-CAS function? (Solved)
|
12-12-2019, 11:33 PM
(This post was last modified: 12-13-2019 09:21 PM by StephenG1CMZ.)
Post: #1
|
|||
|
|||
How do I get CAS to evaluate a Python-in-CAS function? (Solved)
How do I get this function to evaluate...
All I get is the name of the function returned (The Python string syntax may need correcting too Code:
Stephen Lewkowicz (G1CMZ) https://my.numworks.com/python/steveg1cmz |
|||
12-13-2019, 06:18 AM
Post: #2
|
|||
|
|||
RE: How do I get CAS to evaluate a Python-in-CAS function?
Remove
HAMMINGCAS():= BEGIN and END; Then check your function from the shell. Your loop is incorrect, it should be for ii in range(size(s1)): and you should write s1[ii] and s2[ii] (with 0 starting index, run index:=0 if required) BTW, this is called hamdist in Xcas. |
|||
12-13-2019, 03:48 PM
(This post was last modified: 12-13-2019 04:06 PM by StephenG1CMZ.)
Post: #3
|
|||
|
|||
RE: How do I get CAS to evaluate a Python-in-CAS function?
The function works fine in CAS and PPL shell, and now from PPL
My error was naming the function hamming distance but calling hammingdist. Fixing that it evaluates as expected. Code:
Stephen Lewkowicz (G1CMZ) https://my.numworks.com/python/steveg1cmz |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)