Wikipedysta:Adam majewski

Z Wikibooks, biblioteki wolnych podręczników.
Skocz do: nawigacja, szukaj
8 Ten wikipedysta edytuje polskojęzyczną Wikibooks od 8 lat, 0 miesięcy i 23 dni.
Obliczono 23 września 2017.
pl Polski jest językiem ojczystym tego użytkownika.
en-2 This user can read and write intermediate English.




Witam.

Moja strona domowa ( angielska).

Wikipedia-logo.png Wikipedia - Adam majewski

Commons-logo.svg Commons - Adam majewski

Przydatne linki

admin - import

spr. - NPA

Przydatne strony[edytuj]

(Skopiowałem ze strony Karola Dąbrowskiego)



  • <source lang="c">...</source>

http://www.theiterators.com/technologies/

zunzun

git add[edytuj]

git add is a multipurpose command – you use it to begin tracking new files, to stage files, and to do other things like marking merge-conflicted files as resolved. I

git patch[edytuj]

How to contribute your changes (bug fixes, new features, ...):

git checkout master git pull git checkout -b my-new-stuff

  1. edit files, make changes

git add your-changed-files git commit

  1. write a short description, the first line is the most important

git format-patch master

  1. then email the patches as attachments

Try to split each distinct set of changes into different commits (eg: a bug fix in one file and a new feature in another file should be two commits). On the other hand, changes in multiple files for the same bug-fix or feature should be in one commit. Make sure it compiles before you commit, and preferably make sure it runs and does the right things without breaking other stuff.

Alternatively to git format-patch and emailing, make your repository available online. https://gitorious.org has tools for forking repositories and submitting merge requests, though I've not used them much so can't offer any tips.

c[edytuj]

c= 1/4
zf= z = 0.499999996905453  +0.000000000000000 i
z = 0.503446319355695  +0.000195822466591 i
z = 0.501859335396733  +0.000051833858094 i
z = 0.504519704479711  +0.000098150630449 i

funkcje[edytuj]

  • aint(x) returns the integral value between x and 0, nearest x.
  • anint(x) returns the nearest integral value to x, except halfway cases are rounded to the integral value larger in magnitude.
  • Nearest Integer Function = nint(x) converts x into int format rounding to the nearest int value, except halfway cases are rounded to the int value larger in magnitude.


analiza programu w języku Haskell[edytuj]

-- Haskell code by Claude Heiland-Allen
-- http://mathr.co.uk/blog/

import Control.Monad (forM_)
import Data.List (genericTake, genericDrop, intercalate)
import Data.Fixed (mod')
import Data.Ratio ((%), numerator, denominator)
import Numeric (readInt)
import System.Environment (getArgs)

type InternalAngle = Rational

type ExternalAngle = ([Bool], [Bool])

pretty :: ExternalAngle -> String
pretty (pre, per) =  bits pre ++ "(" ++ bits per ++")"

bits :: [Bool] -> String
bits = map bit

bit :: Bool -> Char
bit False = '0'
bit True = '1'

binary :: [Bool] -> Integer
binary [] = 0
binary s = case readInt 2 (`elem`"01") (\c -> case c of '0' -> 0 ; '1' -> 1) (bits s) of
  [(b, "")] -> b

rational :: ExternalAngle -> Rational
rational (pre, per) = (binary pre % 2^p) + (binary per % (2^p * (2^q - 1)))
  where
    p = length pre
    q = length per

bulb :: InternalAngle -> (ExternalAngle, ExternalAngle)
bulb pq = (([], bs ++ [False, True]), ([], bs ++ [True, False]))
  where
    q = denominator pq
    bs
      = genericTake (q - 2)
      . map (\x -> 1 - pq < x && x < 1)
      . iterate (\x -> (x + pq) `mod'` 1)
      $ pq

hub :: InternalAngle -> [ExternalAngle]
hub pq =
  [ (sm, shift k sp) | k <- [0, b .. (q - p - 1) * b] ] ++
  [ (sp, shift k sp) | k <- [(q - p) * b, (q - p + 1) * b .. (q - 1) * b] ]
  where
    p = numerator pq
    q = denominator pq
    (([], sm), ([], sp)) = bulb pq
    (ab, cd) = parents pq
    b = denominator ab
    shift k = genericTake q . genericDrop k . cycle -- 

parents :: InternalAngle -> (InternalAngle, InternalAngle)
parents pq = go q 1 0 p 0 1
  where
    p = numerator pq
    q = denominator pq
    go r1 s1 t1 r0 s0 t0
      | r0 == 0 =
          let ab = - s1 % t1
              a = numerator ab
              b = denominator ab
              c = p - a
              d = q - b
              cd = c % d
          in  (min ab cd, max ab cd)
      | otherwise =
          let (o, r) = divMod r1 r0
              s = s1 - o * s0
              t = t1 - o * t0
          in  go r0 s0 t0 r s t

main :: IO ()
main = do
  [sp, sq] <- getArgs
  p <- readIO sp
  q <- readIO sq
  let pq = p % q
      (lo, hi) = bulb pq
      hs = hub pq
  putStrLn $ "internal angle p/q = " ++ sp ++ " / " ++ sq 
  putStrLn $ "internal angle in lowest terms = "
  print pq
  putStrLn $ "rays of the bulb:"
  putStrLn $ pretty lo ++ " = " ++ show (rational lo)
  putStrLn $ pretty hi ++ " = " ++ show (rational hi)
  putStrLn $ ""
  putStrLn $ "rays of the hub:"
  forM_ hs $ \h -> putStrLn $ pretty h  --- ++ " = " ++ show (rational h)