Author Topic: How to write that in Axe?  (Read 5028 times)

0 Members and 1 Guest are viewing this topic.

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
How to write that in Axe?
« on: June 26, 2011, 01:47:53 pm »
How to write the following Code in Axe?
I have no idea because there are only decimals.
{⌊A(1),⌊A(2)} is Point 1
{⌊A(3),⌊A(4)} is Point 2
Point 1 will follow Point 2 (always with steps of 1Pxl)
Code: [Select]
√((⌊A(1)-⌊A(3))²+(⌊A(2)-⌊A(4))²)→⌊A(5)
For(X,0,1,1
⌊A(1+X)-(((⌊A(1+X)>⌊A(3+X))-1)/2)abs(⌊A(1+X)-⌊A(3+X))/⌊A(5)→⌊A(1+X)
End
I hope everyone will understand this Code.
*insert supercool signature*

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: How to write that in Axe?
« Reply #1 on: June 26, 2011, 02:24:18 pm »
Hmm any particular reason you need this in Axe? Remember that if you need to make something math-intensive and speed isn't too much of an issue, BASIC is definitely the way to go. Especially since it seems like you're using LA, which is a BASIC variable.
« Last Edit: June 26, 2011, 02:24:50 pm by Deep Thought »




Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: How to write that in Axe?
« Reply #2 on: June 27, 2011, 07:12:12 am »
Then think of:
⌊A(1)=A
⌊A(2)=B
⌊A(3)=C
⌊A(4)=D
⌊A(5)=E

But then The code will be longer.
I've saved all in lists to make the program smaller.

It's a point whitch follows another point.
*insert supercool signature*

Ashbad

  • Guest
Re: How to write that in Axe?
« Reply #3 on: June 27, 2011, 08:13:10 am »
Ported as close as possible and decently optimized.  Uses A, B, C, D, E:

Code: [Select]
√(A-B)²+(C-D)²→E
For(X,0,1)
-((({2*X+°A->Q}rr>{Q+4}rr)-1)/2)*abs({Q}rr-{Q+4}rr)/E→{Q}rr
End

But I agree with DeepThought -- writing code in BASIC first is NOT the way to go.  It's like writing a game in C and trying to port it line by line to JavaScript.  Not two flavors that go together well.  The only thing that Axe and BASIC have in common is that they both use TIOS tokens -- past there, you pretty much have to start learning it as if it's a whole new language -- which it is.

« Last Edit: June 27, 2011, 08:18:12 am by Ashbad »

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: How to write that in Axe?
« Reply #4 on: June 27, 2011, 01:27:35 pm »
Ported as close as possible and decently optimized.  Uses A, B, C, D, E:

Code: [Select]
√(A-B)²+(C-D)²→E
For(X,0,1)
-((({2*X+°A->Q}rr>{Q+4}rr)-1)/2)*abs({Q}rr-{Q+4}rr)/E→{Q}rr
End

But I agree with DeepThought -- writing code in BASIC first is NOT the way to go.  It's like writing a game in C and trying to port it line by line to JavaScript.  Not two flavors that go together well.  The only thing that Axe and BASIC have in common is that they both use TIOS tokens -- past there, you pretty much have to start learning it as if it's a whole new language -- which it is.



^ That. Don't get me wrong; it's totally possible, but everything's just easier in some languages than others. Imagine a 3D platformer in BASIC.




Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: How to write that in Axe?
« Reply #5 on: June 27, 2011, 02:34:21 pm »
The general rule of thumb that I follow is this: If it requires floating point math or more than four non-trivial math functions in the entire program, write it in BASIC or ASM. Otherwise, use Axe.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ