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 ... 61 62 [63] 64 65 ... 317
931
Grammer / Re: Grammer 3-Concepts, ideas, requests
« on: May 22, 2013, 07:24:29 am »
Why not adding a way to contol the registers, it would be incredibly faster I think! But it shouldn't be an obligation for the user(maybe a specific Token?)
It wouldn't be faster since it is an interpreted language. If you wanted to have that, the app would have to manage virtual registers since the app already uses them. Like the Calcsys' console does int fact.
This is precisely the reason ^ I made Jade for that ;)

932
Other Calculators / Re: TI-Concours - last days to subscribe !
« on: May 21, 2013, 11:55:49 am »
You didn't double post :P But those look awesome!

933
Other Calculators / Re: TI-Concours - last days to subscribe !
« on: May 21, 2013, 11:03:53 am »
Yes, congrats to both Deep Thought and tictactoc, that was really close!

934
Miscellaneous / Re: Religion Discussion
« on: May 21, 2013, 10:13:53 am »
Xeda, the Bible says that we are not justified by doing good, but by having faith.
Okay, that clarifies it for me more, thanks!

935
Miscellaneous / Re: Religion Discussion
« on: May 21, 2013, 10:11:29 am »
Just to clarify, it is possible to prove God exists, but it is not possible to explain how He exists.

So, St. Thomas Aquinas gave five proofs for why God exists. Just because our human minds cannot understand the existence of God does not mean he does not exist.

A rock does not comprehend the existence of living creatures, but that does not make living creatures non-existent.
The 'proofs' by St. Thomas Aquinas (the ones you linked to in the other topic) each make unjustified claims. While that does not mean God does not exist, it does not prove that God exists.

If God created everything, then who created God?

This thought challenges the "someone created you" part of religion, because God would then have to have been created by someone higher and mightier, and then it chains on.
Well that is only assuming that God needs to be created ;)
No it does not challenge anything. There cannot be an infinite chain of "makers", so at some point there needs to be a supreme "maker". Now, just because you cannot explain how He can exist does not mean He does not exist.
Well, why couldn't there be an infinte chain? Is it because humans cannot grasp that?
Your "bribe" and "fear" are only the secondary reasons to be good. The primary reason is to please God, because you owe everything to Him.
My primary reason lies more in devotion to others and the future :/

936
Miscellaneous / Re: My Existential Philosophy
« on: May 21, 2013, 09:36:57 am »
I created a topic here for those that wish to continue the discussion of religion.

@pimathbrainiac: I like how you liken existence that way-- it is an interesting way to look at it and I wonder if we can derive anything further from that.

937
Miscellaneous / Religion Discussion
« on: May 21, 2013, 09:32:56 am »
It seems that some topics get easily derailed by religion and religion is a topic that people seem to like to respond to. My idea was that  we can use this topic as a way to respond to things dealing with religion if that response would otherwise be off topic. For example, to this topic, pimathbrainiac has requested several times to get the topic back on track. So i will instead post my response here, since it is completely about religion and not focused on the topic. Feel free to comment, respond, or bring in your own conversations from other topics :)

As always, try to remain civil. Since this is about religion, there will likely be offensive things said, but let's try to keep as much of that out of here as possible. We have done it before, so I know it is possible.



With the argument about their being a first cause, the argument is not invalid if you look at it mathematically. In fact, it is another example of mathematical induction (which, I would like to point out is completely logically sound, unlike philosophical induction). Take the natural numbers. Every number can be represented as the number before it added to 1. For example, 924576235238 is 1+924576235237. You can keep following this chain backwards until you hit 1. 1 is the smallest natural number-- the one where all natural numbers start. It does not come from anything else. You can think of this as the first cause, where 2 comes from that, and 3 comes from that, and so on.

The actual flaw in the argument does not come from assuming an initial cause is uncaused, even though all causes cause causes. The flaw is more in assuming there even was a 'first' cause. I can believe that if there was a first cause, then you could attribute that to a God (but even then, I would not be convinced that this being is anything that would impose directly upon anything other than the most base compositions of existence). However, if there was no first cause, that is where things get more interesting. What if you could simply keep going back and there never was a first cause? The God that is presented by the first cause argument is really powerful, but not sentient, moral, or any number of things like that-- it just is and that is the extent of it. There is no pleasing or displeasing such a thing. The God presented by the no-first-causes argument is one that I might call a Being, but since I have not thought fully on this branch of the topic, I have not yet convinced myself of this.

I am more inclined to believe that there was no 'first cause.' I think this is where many people fall into a trap because most people don't have to face the concept of infinity and so they choose to interpret 'first' as something finite-- which it is. I think that the argument may have been made, keeping with the idea of numbers, as one where the events could keep extending back through 0, -1, -2,... and that the chain of events never ended. The whole chain was envisioned and employed all at once by a Being outside of the system. Even then, it is a simple matter for us to see that, if we try. Draw a line segment. There are infinitely many measures along that line segment, yet you can see the whole thing at once.

If you think, you have a mind, because that is what makes you capable of thinking.

The mind is the soul and the brain working together.

If you have a soul, your soul must have been created.

Some being made your soul, and it would have to exist in its own existence, which would make it eternal, changeless, timeless.

This being is God.

("I am who am")
Points 1 and 3 are valid, but points 2 and 5 make a definition, so if we accept that definition, it is not debatable. Point 4 is where your argument falls through. There is no support for "Some being made your soul," or that "it would have to exist in its own existence" and this does not imply that it must be "eternal, changeless, timeless."

Also, even if you don't think that argument makes sense, how would you feel if you died and found out you were wrong about yourself being in a dream? This philosophy could make facing God at your judgement rather uncomfortable...
Personally, if this happens to me, then it is as simple as that-- I would be wrong and that is the extent of it. If God is a being that requires my devotion and belief more than being a 'good' person, then I cannot respect such a god. If that god values goodness, then I can respect such a god and I would see God as a friend. Regardless of the existence of God, I try to be a good person because that matters more to me than the belief in a god. I would rather do something purely out of my own desire to be good than with the bribe of eternal contentedness or the fear of eternal damnation.

938
ASM / Fixed Point Logarithm
« on: May 20, 2013, 08:49:55 am »
Hey everyone, I wrote a routine for computing fixed point 8.8 natural logs. The issue is that it is huge and slow, taking about 11000 t-states and being 188 bytes for the routine plus the 8.8 FP division routine.

I am sure there are optimisations to make-- I know a few that will increase the size, but speed it up a tiny bit. But I also wonder if there is an even faster algorithm? Here is a breakdown of what my code does:

  • First, I use part of a continued fraction. I tried three methods-- a Maclaurin Series (the most computationally expensive), a series I derived yesterday (slightly less computationally expensive), and continued fractions. The continued fractions converges faster than the other two and requires less than half the number of Multiplication/Division calls.
  • The very first step, is testing if the input is zero, in which case it returns $FFFF
  • Next, it puts the number in the range of [1,2] by multiplying it by a power of 2 (that power is either negative or positive or zero). It stores the power for later use.
  • Next it performs the following computations in BASIC-ish pseudocode (for the continued fraction)
Code: [Select]
    X-1→X
     push X
     4*X→X    ;in code, X is in HL, so I just use add hl,hl \ add hl,hl. This doesn't really count as a multiplication routine, then.
     Ans+4     ;In code, this is just inc h \ inc h \ inc h \ inc h
     X/Ans
     pop X
     Ans+3
     X/Ans
     Ans+2
     X/Ans
     Ans+1
     X/Ans
  • The next step is to take the power of two that the original value was multiplied by, multiply that power by ln(2) and add it to the result. If the power was negative (so it was divided by a power of two), I store ln(2) in 8.16 FP format and add it a number of times to an accumulator , then add it to the result. If the power is positive, I simply subtract the 8.8 approximation of ln(2) from the result the number of times needed.


Now for the actual code:
Code: [Select]
FPLog88:
;Input:
;     HL is the 8.8 Fixed Point input. H is the integer part, L is the fractional part.
;Output:
;     HL is the natural log of the input, in 8.8 Fixed Point format.
     ld a,h
     or l
     dec hl
     ret z
     inc hl
     push hl
     ld b,15
     add hl,hl
     jr c,$+4
     djnz $-3
     ld a,b
     sub 8
     jr nc,$+4
     neg
     ld b,a
     pop hl
     push af
     jr nz,lnx
     jr nc,$+7
     add hl,hl
     djnz $-1
     jr lnx
     sra h
     rr l
     djnz $-4
lnx:
     dec h        ;subtract 1 so that we are doing ln((x-1)+1) = ln(x)
     ld d,h
     ld e,l
     inc h
     call FPDE_Div_HL  ;preserves DE, returns AHL as the 16.8 result
     inc h        ;now we are doing x/(3+Ans)
     inc h
     inc h
     call FPDE_Div_HL
     inc h        ;now we are doing x/(2+Ans)
     inc h
     call FPDE_Div_HL
     inc h        ;now we are doing x/(1+Ans)
     call FPDE_Div_HL  ;now it is computed to pretty decent accuracy
     pop af       ;the power of 2 that we divided the initial input by
     ret z        ;if it was 0, we don't need to add/subtract anything else
     ld b,a
     jr c,SubtLn2
     push hl
     xor a
     ld de,$B172  ;this is approximately ln(2) in 0.16 FP format
     ld h,a
     ld l,a
     add hl,de
     jr nc,$+3
     inc a
     djnz $-4
     pop de
     rl l         ;returns c flag if we need to round up
     ld l,h
     ld h,a
     jr nc,$+3
     inc hl
     add hl,de
     ret
SubtLn2:
     ld de,$00B1
       or a
       sbc hl,de
       djnz $-3
     ret


FPDE_Div_HL:
;Inputs:
;     DE,HL are 8.8 Fixed Point numbers
;Outputs:
;     DE is preserved
;     AHL is the 16.8 Fixed Point result (rounded to the least significant bit)
     di
     push de
     ld b,h
     ld c,l
     ld a,16
     ld hl,0
Loop1:
     sla e
     rl d
     adc hl,hl
     jr nc,$+8
     or a
     sbc hl,bc
     jp incE
     sbc hl,bc
     jr c,$+5
incE:
     inc e
     jr $+3
     add hl,bc
     dec a
     jr nz,Loop1
     ex af,af'
     ld a,8
Loop2:
     ex af,af'
     sla e
     rl d
     rla
     ex af,af'
     add hl,hl
     jr nc,$+8
     or a
     sbc hl,bc
     jp incE_2
     sbc hl,bc
     jr c,$+5
incE_2:
     inc e
     jr $+3
     add hl,bc
     dec a
     jr nz,Loop2
;round
     ex af,af'
     add hl,hl
     jr c,$+6
     sbc hl,de
     jr c,$+9
     inc e
     jr nz,$+6
     inc d
     jr nz,$+3
     inc a
     ex de,hl
     pop de
     ret
On average this is off from the actual value by about 1/400. Since this is smaller than the smallest 8.8 value, it is pretty accurate. The worst case scenario that I have found so far was trying to find ln(1/256) which was off by about 7/512 from the actual value.

Later I will hopefully be working on sin() and cos() among others, but I thought I would share this and see if anybody had better methods.

EDIT: Thought of a fairly simple optimisation. I am going to test another optimisation that may speed it up by as much as 40%
EDIT2: Here is a much smaller and more efficient log2 routine. It is 71 bytes (so 117 bytes smaller) and takes <4000 t-states:
EDIT3: I found a handful of bugs (errors in translating from hex to assembly) so I went through the code and fixed it. I also optimised a few areas, saving a total of 1 byte and some clock cycles. Also, a legitimate use of 'rr a' instead of 'rra'. I only added that for ambiguity since I only needed to check if A>1. In a later post, I have a size optimised version that averages about 39 t-states slower which is about 1% slower.
Code: [Select]
Log_2_88:
;Inputs:
;     HL is an unsigned 8.8 fixed point number.
;Outputs:
;     HL is the signed 8.8 fixed point value of log base 2 of the input.
;Example:
;     pass HL = 3.0, returns 1.58203125 (actual is ~1.584962501...)
;70 bytes
     ex de,hl
     ld hl,0
     ld a,d
     ld c,8
     or a
     jr z,DE_lessthan_1
     srl d
     jr z,logloop-1
     inc l
     rr e
     jp $-7
DE_lessthan_1:
     ld a,e
     dec hl
     or a
     ret z
     inc l
     dec l
     add a,a
     jr nc,$-2
     ld e,a

     inc d
logloop:
     add hl,hl
     push hl
     ld h,d
     ld l,e
     ld a,e
     ld b,7

     add hl,hl
     rla
     jr nc,$+3
       add hl,de
     djnz $-5

     adc a,0
     add hl,hl
     rla
     jr nc,$+5
       add hl,de
       adc a,0
     ld e,h
     ld d,a
     pop hl
     rr a
     jr z,$+7
       srl d
       rr e
       inc l
     dec c
     jr nz,logloop
     ret

939
Other Calculators / Re: TI-Concours - last days to subscribe !
« on: May 20, 2013, 08:47:24 am »
Oh dear o.o That is very close.

940
Grammer / Re: Grammer 3-Concepts, ideas, requests
« on: May 19, 2013, 08:23:38 am »
If I can figure out a way to convert a formula in order-of-operastions to a more optimised syntax (and back again), then  I would prefer to do that. I think I will have to look into RPN for ideas. For example, in Grammer 2 it is possible to mentally convert a formula to OOP, but I have to think of a way to program it. As an example:

3*4+A:/6-B
is equivalent to:
3(4+A)/(6-B)

941
Other Calculators / Re: TI-Concours - last days to subscribe !
« on: May 18, 2013, 07:20:13 pm »
I received them on time, sorry for not telling you earlier.

I spent >45 minutes on the first question, then the next three I finished in about a half hour (about 10 minutes each), then I worked on the fifth question for the rest of the time.

942
News / Re: TI-Planet arithmetic contest !
« on: May 18, 2013, 05:39:10 pm »
Oh my gosh, that is awesome o.o I want to check out Weregoose's program because that probably has some really hacky code o.o

943
Other Calculators / Re: TI-Concours - last days to subscribe !
« on: May 18, 2013, 03:56:32 pm »
I thought the first four questions were okay, 5 and 6 were a little more challenging, 7 and 8 were pretty difficult o.o

944
Other Calculators / Re: TI-Concours - last days to subscribe !
« on: May 18, 2013, 08:30:11 am »
Oh, okay, I will be ready, hopefully !

945
Other Calculators / Re: TI-Concours - last days to subscribe !
« on: May 18, 2013, 08:16:02 am »
How will we find out about the topic? I think my first one is in 45 minutes :D

Pages: 1 ... 61 62 [63] 64 65 ... 317