Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Xeda112358

Pages: 1 ... 23 24 [25] 26 27 ... 317
361
TI Z80 / Re: [2012 Apocalypse Contest] Battle 4000
« on: October 24, 2016, 10:16:49 am »
I never posted my program download :( Of course it isn't finished, but in case people wanted to take it apart, here is the code I submitted for the contest.

362
TI-BASIC / Re: Convert decimal to fraction as a string (TI-84)
« on: October 23, 2016, 02:36:52 pm »
The algorithm described here might be useful as a BASIC solution, too :) It's even a bit more accurate than the built in one, oddly enough.
edit: The code from that link:
Code: [Select]
:Ans→X:{1,abs(Ans
:Repeat E‾9>Ans(2
:abs(Ans(2){1,fPart(Ans(1)/Ans(2
:End
:round({X,1}/Ans(1),0
:Ans/gcd(Ans(1),Ans(2

363
Math and Science / Re: Quadratic and Faster Convergence for Division
« on: October 23, 2016, 09:11:30 am »
Necro-addition:
Let's look at ##\frac{x}{1-y}, 0<|y|<1##. Then we know that since ##0<|y|<1##, then ##0<y^{k>1}<|y|<1##. Then if we multiply the numerator and denominator by ##1+y+y^{2}+...+y^{k-1}##, the numerator is now ##x(1+y+y^{2}+...+y^{k-1})## and the denominator is now ##1-y^{k}##.
Spoiler For "Why its 1-y^k":
##=(1-y)(1+y+y^{2}+...+y^{k-1})##
##=(1+y+y^{2}+...+y^{k-1})-y(1+y+y^{2}+...+y^{k-1})##
##=1+y+y^{2}+...+y^{k-1}-y-y^{2}-...-y^{k-1}-y^{k})##
##=1-y^{k}##

So now since ##y^{k}## is smaller than ##y##, this means the denominator is closer to 1 so the numerator is closer to the original ##\frac{x}{1-y}##. Even better, this multiplies the digits of accuracy by k each time.

Converting this to an algorithm, we get:
##x_{0}=x, y_{0}=y##
##x_{n+1}=x_{n}(1+y_{n}+y_{n}^{2}+...+y_{n}^{k-1}), y_{n+1}=y_{n}^{k}##
There are optimizations for this, too. For example, if ##k=2^{n}##, then ##1+y+y^{2}+...+y^{k-1}=(1+y)(1+y^{2})(1+y^{4})...(1+y^{2^{n-1}})## and the code becomes something like:
Code: [Select]
x*=(1+y)
y*=y
x*=(1+y)
y*=y
...
x*=(1+y)
y*=y
For example, take k=8, then ##1+y+y^{2}+y^{3}+y^{4}+y^{5}+y^{6}+y^{7}=(1+y)(1+y^{2})(1+y^{4})##
But then, this is identical to n iterations where k=2. In fact, k=2 or any higher power of two by extension, provides the most optimal trade-off of multiplications for digits of accuracy.


For a real world application, suppose I want to get 9 digits (~30 bits) accuracy for ##\frac{x}{10}=\frac{x}{1.25}\frac{1}{8}##. Then ##y=-.25##, and because y is constant, we can precompute all of the powers of ##y##. Further, since ##y=-2^{-2}##, this will amount to simple bit-shifts. So the code is:
Code: [Select]
            #x=379          integer only
x-=x>>2     #x=284.25       285
x+=x>>4     #302.015625     302
x+=x>>8     #303.195374     303
x+=x>>16    #303.2          303
x>>=3       #37.9           37      the final /8.


364
TI Z80 / Re: Menu hooks for the 83/84 plus
« on: September 24, 2016, 06:45:28 pm »
Have you checked out this page? It's been a long time since I've used a menu hook.

365
TI Z80 / Re: Standard RPG Game
« on: September 20, 2016, 09:56:02 am »
Oh, this is turning out quite well, nice job! I've been spending the last few days cleaning up an old RPG engine of mine, so it's cool to see someone working on making one, too!

I'm not sure how you process tile animation, but I have my tiles set up as something like:
Code: [Select]
tilesprite_ptr,tiletime,tilenextAll of the tiles are accessed as an indexed array, so tile0 is the first 4 bytes, tile1 is the next, etc. During initialization, I make a buffer of "tiletime,tile#" for each kind of tile. In an interrupt, I decrement the first byte (time counter), and if it hits zero, I use tile# to access the tile data and figure out "tilenext" and load that data into the slot, essentially evolving the tile into its next form. Further, when this happens, I set a flag indicating that the tilemap has to be rerendered, which is also processed in the interrupt.

Using an interrupt for the evolving the tile animations and rendering allows for consistent animation speed regardless of how bogged down the engine gets, and regardless of using 6MHz or 15MHz. When I toggle 15MHz mode, my sprite zips around the screen without causing the tile animation to change in speed, so it looks like my sprite is Flash :P

366
General Calculator Help / Re: A calculator to transfer to all calculators?
« on: September 10, 2016, 03:17:38 pm »
I'm surprised nobody has made a tool for the nspire to transfer files to older models. I know there is a program for the TI-89 that lets you send and receive files from all of the older models.

367
ASM / Re: Running ASM programs with wabbitemu
« on: September 05, 2016, 06:00:06 pm »
I'm glad you got it fixed! To be honest, I've struggled with these kinds of things, too. Now you can get to all that programming, have fun!

368
ASM / Re: Running ASM programs with wabbitemu
« on: September 03, 2016, 06:00:52 pm »
Have you tried that, then sending the resulting file to the emulator? No need for binpac8x.

369
ASM / Re: Running ASM programs with wabbitemu
« on: September 03, 2016, 04:38:05 pm »
Try spasm BACKGRND.txt BACKGRND.8xp all on the same line.

370
hi Xeda112358
have you already implemented this algorithm in C/Matlab ?
here I have already implemented CORDIC.sin-cos in VHDL
and tested on RTL simulator and fpga

let me know  :w00t:
I have not. Are you the person who emailed me? I was about to point you here since I'm too exhausted to work on this at the moment (worked 16+ hours in a 24 hour span of time).

371
Grammer / Re: Grammer 2-The APP
« on: June 04, 2016, 02:40:12 pm »
From the looks of it, I think they disassembled the app and used older source code as a reference to piece it all together.

372
Grammer / Re: Grammer 2-The APP
« on: June 03, 2016, 08:48:33 pm »
Good news, everyone!

Two days ago, somebody who I will name only as Mx. Burch until I have permission otherwise, emailed me with a modified source for a newer version of Grammer than what I had. I had lost mnths of sourcecode for those who were not aware, and that basically killed the project.

They altered some code,  and I have not extensively tested the code, but hopefully there are no new bugs. Please be advised that this is an experimental version. If I work on this more, some of the additions will almost certainly change.

What was added? The >DMS token (in the Angle menu) is renamed "module" and tells the parser to search for a command in an experimental module. The availabe functions are TEXT( and DISP (with a space after it). These do precisely what the tokenized versions do (Text( and Disp, respectively). The appver Grampkg must be in RAM for now.

What was removed? The jump table is currently removed, so assembly programs using Grammer routines will likely crash. The 32-bit multiplication routine which is entirely unused in the app was removed, apparently the font was compressed, and I scrapped the custom VAT searching routine and I'm now just using the OS routines.

This leaves 927 bytes free! I plan to remove the menu and input commands to an external module since those aren't speed-critical.

373
TI Z80 / Re: ICE - an interpreter/compiler of CE-BASIC
« on: May 28, 2016, 03:30:24 pm »
Wow, fantastic!

374
Math and Science / Re: Gamma!
« on: May 22, 2016, 12:49:16 pm »
This time I bring a much better approximation to the Gamma function!
##\Gamma(x+1) \approx f(x)=C\sqrt{x}x^{x}e^{-x+\frac{1}{12x}-\frac{1}{360x^{3}}+\frac{1}{1260x^{5}}}, C\approx2.5066282745692##

The approximation gets better as x gets bigger, too! For example, ##\Gamma(1.5)=\frac{\sqrt{\pi}}{2}\approx.8862269255##.
However, ##f(.5)\approx.9008942683## which is terrible accuracy :( Instead we do ##\frac{f(9.5)}{9.5*8.5*7.5*...*1.5}\approx.8862269255## !

How did I derive this?

First I observed that ##ln(n!)=\sum_{k=1}^{n}{ln(k)}=\sum_{k=2}^{n}{ln(k)}##, and then I applied the Euler-Maclaurin formula to get:
##\sum_{k=2}^{n}{log(k)}=\int_{1}^{n}{log(x)dx}+\frac{log(n)-log(1)}{2}+\sum_{k=1}^{\infty}{\frac{B_{2k}(2k-2)!}{(2k)!}\left(n^{1-2k}-1\right)}##
##\sum_{k=2}^{n}{log(k)}=xlog(x)-x+1+\frac{log(n)}{2}+C+\sum_{k=1}^{\infty}{\frac{B_{2k}}{2k(2k-1)}n^{1-2k}}##
From there I tested a few values to approximate C, then I truncated the sum to three terms!


Also, the function ##f(1)=1, f(x)=x^{x}f(x-1)## can be approximated by:
##Cx^{x(x+1)/2}e^{ln(x)/12-x^{2}/4+\frac{1}{720x^{2}}-\frac{1}{5040x^{4}}+\frac{1}{10080x^{6}}}, C\approx1.282427129442##

375
TI Z80 / Re: ICE - an interpreter/compiler of CE-BASIC
« on: May 19, 2016, 11:32:08 am »
The processors are actually the same. All that would need to be changed are graphics and maybe some memory management.

Pages: 1 ... 23 24 [25] 26 27 ... 317