Entries Tagged 'Uncategorized' ↓

Calcolo derivata su HP 35s RPN

La calcolatrice HP 35s non possiede una funzione di derivazione integrata, ma possiamo programmare un rudimentale calcolatore di derivate sfruttando circa 60 byte della sua memoria.

Questo è il listato:

D001 LBL D
D002 STO X
D003 1e-5
D004 STO H
D005 +
D006 XEQ F001
D007 STO F
D008 RCL X
D009 RCL H
D010 -
D011 XEQ F001
D012 RCL F
D013 x<>y
D014 -
D015 RCL H
D016 2
D017 ✕ (moltiplicazione)
D018 ÷
D019 RTN

L’algoritmo calcola la seguente formula:

in questo caso H è stato scelto empiricamente e fissato a 0.00001 nella riga D003. Per alcune funzioni, potrebbe essere il caso di modificare il codice per usare una costante diversa, oppure impostare manualmente il registro H con la costante desiderata e cancellare la riga di codice D003 e sostituire la D004 STO H con un RCL H.

La funzione da derivare è definita come programma, alla label F.
La funzione F deve essere costruita in modo da accettare in input un numero dallo stack e restituire un numero in output sempre nello stack.

Un esempio di funzione F potrebbe essere semplicemente questo:

F001 LBL F
F002 3
F003 y^x
F004 √x
F005 LN
F006 RTN

Questo semplice programma calcola la funzione f(x) = ln(sqrt(x^3))

Per eseguire la derivata, basta inserire la funzione in F, come da esempio, uscire dalla modalità programma, inserire nello stack l’argomento x su cui calcolare la derivata, premere [XEQ] D [ENTER] et voilà!

PS: La formula per il calcolo della derivata è presa da Numerical Recipes in C, Second Edition, equazione (5.7.7).

Arduino – Blog[001]

Test syntax highlight

Vediamo un po’ se funzia…

#include <prova>
void ciao()
{
  int a[10], i=0;
  a[i] = i;
  return;
}

Si vede?

Installazione Windows 7 Professional a 64 bit, Android SDK, Windows Phone SDK – ITBlog #1

Prima puntata del video blog Informatica & Tecnologia di Antonio Barba.
In questa puntata Antonio Barba effettua il setup da zero di una macchina di sviluppo Windows 7 a 64 bit, con i devkit di Google Android e Microsoft Windows Phone.

Questo sito è una droga

Vai su www.6502asm.com e copia-incolla questo codice:


lda #<data
sta $10
lda #>data
sta $11
lda #$00
sta $30
lda #$02
sta $31

loop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