lehrkraefte:blc:notnagel17:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
lehrkraefte:blc:notnagel17:start [2017/11/23 13:29]
Ivo Blöchliger [Unterlagen]
lehrkraefte:blc:notnagel17:start [2017/12/04 20:42]
Ivo Blöchliger [Diverses]
Line 12: Line 12:
   *    * 
  
 +===== Diverses =====
 +TigerJython-Code zu $e^{i\pi}+1=0$:
 +<code python eipi.py>
 +from gpanel import *
 +
 +import cmath
 +
 +def cross(a,b,e=0.04):
 +    line(0,0,a,b)
 +    line(a-e,b,a+e,b)
 +    line(a,b-e,a,b+e)
 +    
 +
 +def show(n):
 +    enableRepaint(False)
 +    clear()
 +    # Koordinatensystem
 +    line(-2,0,2,0)
 +    line(0,-2,0,2)
 +    circle(0,0,1)
 +    # Basis
 +    z = complex(1.0, math.pi/n)
 +    x = 1
 +    # Alle Potenzen davon
 +    for i in range(1,n):
 +        x*=z
 +        cross(x.real, x.imag)
 +    # Anzeigen
 +    repaint()   
 +    
 +@onMouseMoved
 +def mouseMoved(x,y):
 +    show(int((x+2)*(x+2)*20+2));
 +
 +makeGPanel(-2, 2, -1, 3)
 +
 +
 +</code>
 +
 +Komplexe Funktionen visualisieren:
 +<code python complexfuncs.py>
 +from gpanel import *
 +
 +import cmath
 +
 +def cross(z,e=0.01):
 +    a = z.real
 +    b = z.imag
 +    line(a-e,b,a+e,b)
 +    line(a,b-e,a,b+e)
 +    
 +@onMouseClicked
 +def init(x,y):
 +    clear()
 +    # Koordinatensystem
 +    setColor("black");
 +    line(-4,0,4,0)
 +    line(0,-4,0,4)
 +    circle(0,0,1)
 +
 +def myfunc(z):     
 +    return z*z*z
 +
 +def show(z):
 +    setColor("black")
 +    cross(z)
 +    setColor("red")
 +    cross(myfunc(z))
 +    
 +@onMouseMoved
 +def mouseMoved(x,y):
 +    show(complex(x,y));
 +
 +makeGPanel(-4, 4, -4, 4)
 +init(0,0)
 +
 +</code>
 +
 +Kurven abbilden:
 +<code python shapeimage.py>
 +from gpanel import *
 +
 +import cmath
 +
 +def cross(z,e=0.01):
 +    a = z.real
 +    b = z.imag
 +    line(a-e,b,a+e,b)
 +    line(a,b-e,a,b+e)
 +    
 +@onMouseClicked
 +def init(x,y):
 +    clear()
 +    # Koordinatensystem
 +    setColor("black");
 +    line(-4,0,4,0)
 +    line(0,-4,0,4)
 +    circle(0,0,1)
 +
 +def myfunc(z):     
 +    return z*z
 +def mycircle(c,r=1.0, f=myfunc):
 +    for i in range(0,360):
 +        a = i/180.0*math.pi
 +        z = c+complex(math.cos(a),math.sin(a))*r
 + #       z = c+complex(math.cos(a),math.sin(a))*r*(1+math.cos(a*20)*0.1)
 +#        b = (i % 90 - 45)/180.0*math.pi ;  z = c+complex(math.cos(a),math.sin(a))*r*math.sqrt(math.tan(b)**2+1)
 +        setColor("blue")
 +        cross(z)
 +        setColor("red")
 +        cross(f(z))
 +    
 +
 +def show(z):
 +    init(0,0)
 +    setColor("black")
 +    cross(z)
 +    setColor("red")
 +    cross(myfunc(z))
 +    mycircle(z,1.0, myfunc)
 +    
 +@onMouseMoved
 +def mouseMoved(x,y):
 +    show(complex(x,y));
 +
 +makeGPanel(-6, 6, -6, 6)
 +init(0,0)
 +
 +</code>
  • lehrkraefte/blc/notnagel17/start.txt
  • Last modified: 2017/12/05 14:06
  • by Ivo Blöchliger