screen 19
dim as longint n1 , v1 , v2 , ans
for a as longint = 0 to 255
n1 = a
v1 = n1 mod 8
v2 = n1 \ 16
ans = v1 + ( 16 * v2 )
print n1 , v1 , v2 , ans
if a mod 16 = 0 then sleep
if inkey = chr(27) then exit for
next
sleep
end
screen 19
dim as longint n1 , v1 , v2 , ans
for a as longint = 0 to 255
n1 = a
v1 = n1 mod 16 ' <--- !!! bit 3 was missing !!!
v2 = n1 \ 16
ans = v1 + ( 16 * v2 )
print n1 , v1 , v2 , ans
if a mod 16 = 0 then sleep
if inkey = chr(27) then exit for
next
sleep
@Albert.
It is now long past the time that you should have stopped expecting to stumble upon a herd of Unicorns, while looking at patterns in numbers and formulas.
Most 12 year old school students understand that there is a field of mathematics called algebra. They know that algebra makes it possible to manipulate symbols, and to prove if something is actually true, or even possible. Your denial, or refusal to accept the very existence of algebra, is wasting our time and yours.
Learning algebra is easier than computer programming.
Algebra is an essential skill for computer programmers.
I find your claim that you have an engineering qualification quite surprising. An engineering qualification should be impossible without the most trivial beginners algebra, none of which you ever display. The only sensible explanation is that you received a physical or chemical brain injury that wiped out your original school algebra. But, you have learned to write FB programs since then, so you should be able to re-learn your algebra.
I think you should go away for a while to study beginners math of algebra.
Come back when you can explain symbolically, without numbers, why; a = b * a / b.
Electronics uses very little math ..
I only took "General Math" in high school , i didn't take algebra or geometry or calculus..
In electronics the most difficult formula just uses a square root.
For repairing electronics , they have testers for just about every component on a circuit board.
you have:
voltage in volts
current in amps
resistance in ohms
inductance in henries
capacitance in farads
inductors hardly ever go bad..
So there's no need for inductance formulas , unless your designing an inductor...Then you look in the book for the formula.
If your designing circuits , then you just look in the books for the formulas, they are all fairly simple formulas..
I went to college back in the 80's , so tubes are all obsolete , except for microwave ovens and TV / Radio transmitters..
I don't have an FCC license , you have to be proficient in Morse code , and i had difficulty learning Morse code...So i didn't get the license..
You have to have an FCC license to repair Radar equipment..
I can repair radar equipment , but I'm not licensed to do it.
Albert wrote:I don't have an FCC license , you have to be proficient in Morse code , and i had difficulty learning Morse code...So i didn't get the license..
All Morse code was dumped from the Ham licence in the USA back in early 2007.
Albert wrote:I only took "General Math" in high school , i didn't take algebra or geometry or calculus..
In electronics the most difficult formula just uses a square root.
That explains why you do not understand algebra, but it does not excuse you from learning algebra now.
screen 19
dim as longint v1 , v2 , v3
dim as longint n1 = 256
do
n1-=1
v1 = n1 mod 8
v2 = n1 \ 16
v3 = (n1 and 8) shr 3
print
print n1 , v1 , v2 , v3
for b as longint = 0 to 255 step 1
if (b mod 8) = v1 and ( (b \ 16) ) = v2 and ( (b and 8) shr 3 ) = v3 then print b : exit for
next
if n1 mod 10 = 0 then print "press key for next 10 press esc to exit " : sleep
if inkey = chr(27) then end
loop until n1 = 0
sleep
end
screen 19
dim as longint n1 , v1 , v2 , ans
dim as single v3
do
n1 = int( rnd*65536 )
v1 = int( sqr(sqr(n1)) )
v2 = frac( sqr(sqr(n1)) ) *1000
ans = ( v1 + (v2/1000) ) ^ 4
'outs+=right(string(04,"0")+bin(v1),04)
'outs+=right(string(10,"0")+bin(v2),10)
print
print n1 , v1 , v2 , ans : sleep
if inkey = chr(27) then exit do
loop
sleep
end
screen 19
dim as longint n1 , v1 , fract , ans
dim as single v2
dim as longint hi1=0 , hi2=0
n1=-1
do
n1+=1
v1 = int( sqr(sqr(n1)) ) : if v1 > hi1 then hi1 = v1
v2 = int(frac( sqr(sqr(n1)) ) * 1000) : if v2 > hi2 then hi2 = v2
ans = ( v1 + (v2/1000 ) ) ^ 4
print n1 , v1 , v2 , ans
if ans - n1 <> 0 then exit do
if inkey = chr(27) then exit do
loop
print "len bin hi v1 = " ; len(bin(hi1)) ; " bits" , hi1
print "len bin hi v2 = " ; len(bin(hi2)) ; " bits" , hi2
print "len n1 = " ; len(bin(n1)) ; " bits" , ans
sleep
end
Albert wrote:@Richard
It requires 5 decimal places of precision to get to 65,535... 17 bits + 4 bits comes out to 21 bits..
5 places goes to 291,465..
@Albert.
That is not a question.
You are having a psychotic episode. Take your medication.
You have insufficient algebra skills to write software without asking for help from others.
Get your ARRL ham licence now, and study algebra ... before you come back to FB.
screen 19
dim as longint size = 16 ' adjust to desired value of bits.
dim as string array(0 to size)
dim as string bins
for a as longint = 0 to (2^size)-1
bins = right(string(size,"0")+bin(a),size)
dim as byte count=0
for b as longint = 0 to len(bins)-1 step 1
if bins[b] = 49 then count+=1
next
array(count)+=chr(a)
next
for a as longint = lbound(array) to ubound(array)
print a , len(array(a)) ', array(a)
next
sleep
end