Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
ShinyGardevoir wrote:
Is there a way to find the gamma function of a complex number on a TI-84 Plus CE?

Yes, the routine for the beta function I used in this post works for complex numbers as well.



If you just want to calculate the gamma function, then you can simplify it to this:

Code:
A→Z
If 0>real(A
1-Z→Z
e^((Z-.5)ln(Z+8.5)-Z-8.5+ln(√(2π)(1+sum({5716.4001882743,-14815.304267684,14291.492776575,-6348.1602176415,1301.6082860583,-108.17670535144,2.6056965056118,-0.0074234525,5.38413610^-8,-4.0235310^-9}/(Z-1+cumSum(binomcdf(9,0
If 0>real(A
2πi/Ans/(2isin(πA

Where the input is in A and Γ(A) is stored to Ans.
Michael2_3B wrote:
Find and Replace Text in String
Replaces all occurrences of a specific search text in a string with desired replacement text.
This has no doubt been attempted before, but here is my take on it.

Inputs:
Str1- main string
Str2- search string
Str3- replacement string


Outputs:
Str1- the string that gets modified


Code:
length(Str2->J
While inString(Str1,Str2
   inString(Str1,Str2->I
   Str3
   If I>1
   sub(Str1,1,I-1)+Ans
   If I+J<1+length(Str1
   Ans+sub(Str1,I+J,1+length(Str1)-(I+J
   Ans->Str1
End

This one doesn't destroy any other variables and may be faster.
You can replace "X" with any character you know won't be in Str2.

Code:
"X"+Str1+"X"
While inString(Ans,Str2
sub(Ans,1,inString(Ans,Str2)-1)+Str3+sub(Ans,inString(Ans,Str2)+length(Str2),length(Ans)-inString(Ans,Str2)-length(Str2)+1
End
sub(Ans,2,length(Str1)-1)->Str1
Sentence to list of words
Converts a sentence in string format into a list of words without spaces.
Only works on 68k/Nspire calcs


Code:
wlist(str)
Func
Local j
{""}→j
While instring(str," ")>0
augment(j,{left(str,instring(str," ")-1)})→j
right(str,dim(str)-instring(str," "))→str
EndWhile
augment(seq(j[n],n,2,dim(j)),{str})→j
Return j
EndFunc

Code:
abs(DeltaList(Anscos(picumSum(not(0Ans

Sums up every pair of elements in Ans, a list. By "Logical Joe" on the Cemetech Discord, golfing the version I wrote last year for a Calc I Riemann-sum solver:

Code:
abs(DeltaList(Ansi^(2cumSum(binomcdf(dim(Ans)-1,0


Golfed-ish but non-radians-dependent version, for what it's worth:

Code:
abs(DeltaList(Ansi^(2cumSum(not(0Ans
String to StRiNg
Highly useful routine used to mock a string.
Will convert "Python is the best language" into "PyThOn iS ThE BeSt lAnGuAgE"


TI-84 BASIC fragment:

Code:
"*
For(i,1,length(Str1),2
Ans+sub(" ABCDEFGHIJKLMNOPQRSTUVWXYZ",remainder(inString(" abdcefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ",sub(Str1,i,1)),27),1
If i!=length(Str1)
Ans+sub(Str1,i+1,1
End
sub(Ans,2,length(Ans)-1


68k BASIC function:

Code:
mock(n)
Func
Local out,i
""->out
For i,1,dim(n),2
out&mid(" ABCDEFGHIJKLMNOPQRSTUVWXYZ",remainder(inString(" abdcefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ",mid(Str1,i,1)),27),1)->out
If i!=dim(n)
out&mid(n,i+1,1)->out
EndFor
out
EndFunc
Split String by Delimiter Character

Displays an input string in Str1, using a delimiter ({) as a newline character

Code:
1→B
inString(Str1,"{→A
While A
If A>1
Disp sub(Str1,B,A-B
A+1→B
inString(Str1,"{",B→A
End
If B<length(Str1
Disp sub(Str1,B,length(Str1)-B+1


Split String by Delimiter Character 2

Displays an input string in Str1, using a delimiter ({) as a newline character if it is known that the input string will not begin or end with a delimiter character

Code:
1→B
inString(Str1,"{→A
While A
Disp sub(Str1,B,A-B
A+1→B
inString(Str1,"{",B→A
End
Disp sub(Str1,B,length(Str1)-B+1

Both of these will work if the input string contains no delimiters.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 14 of 14
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement