ahoj vsem
zkousim naprogramovat funkci:
h=(64*x**8)-(128*x**6)+(16*y**6)+(80*x**4)-(24*y**4)-(16*x**2)+(9*y**2)
kde x je z intervalu <-1,1> a y=<-1,1>. Jde o to ze vypisem programu by mel byt obrazek ktery bude obsahovat 37 radku a v kazdem radku bude 73 znaku. Ty znaky jsou + a -. Kdyz vyjde funkce h dosazeni za x a y z daneho intervalu zaporna vytiskne se - a kdyz vyjde 0 nebo kladna tak plus...
tady je kdyz tak ten vystup-obrazek
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+-------+++++++----------------+++++++++++----------------+++++++-------+
+---------++-----------------------+++-----------------------++---------+
+---------++-----------------------+++-----------------------++---------+
+-------++++++------------------+++++++++------------------++++++-------+
+------+++++++++--------------+++++++++++++--------------+++++++++------+
++----++++++++++++----------+++++++++++++++++----------++++++++++++----++
++---++++++++++++++-------+++++++++++++++++++++-------++++++++++++++---++
+++-+++++++++++++++++---+++++++++++++++++++++++++---+++++++++++++++++-+++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++-+++++++++++++++++---+++++++++++++++++++++++++---+++++++++++++++++-+++
++---+++++++++++++++------+++++++++++++++++++++------+++++++++++++++---++
++---+++++++++++++---------+++++++++++++++++++---------+++++++++++++---++
+-----+++++++++++------------+++++++++++++++------------+++++++++++-----+
+------+++++++++--------------+++++++++++++--------------+++++++++------+
+-------++++++------------------+++++++++------------------++++++-------+
+--------++++--------------------+++++++--------------------++++--------+
+---------++-----------------------+++-----------------------++---------+
+-----------------------------------+-----------------------------------+
+---------++-----------------------+++-----------------------++---------+
+--------++++--------------------+++++++--------------------++++--------+
+-------++++++------------------+++++++++------------------++++++-------+
+------+++++++++--------------+++++++++++++--------------+++++++++------+
+-----+++++++++++------------+++++++++++++++------------+++++++++++-----+
++---+++++++++++++---------+++++++++++++++++++---------+++++++++++++---++
++---+++++++++++++++------+++++++++++++++++++++------+++++++++++++++---++
+++-+++++++++++++++++---+++++++++++++++++++++++++---+++++++++++++++++-+++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++-+++++++++++++++++---+++++++++++++++++++++++++---+++++++++++++++++-+++
++---++++++++++++++-------+++++++++++++++++++++-------++++++++++++++---++
++----++++++++++++----------+++++++++++++++++----------++++++++++++----++
+------+++++++++--------------+++++++++++++--------------+++++++++------+
+-------++++++------------------+++++++++------------------++++++-------+
+---------++-----------------------+++-----------------------++---------+
+---------++-----------------------+++-----------------------++---------+
+-------+++++++----------------+++++++++++----------------+++++++-------+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
muj navrh je tento:
import os
import math
import sys
import numpy as np
for x in np.arange (-1,1,2.0/37.0):
for y in np.arange (-1,1,2.0/73.0):
h=(64*x**8)-(128*x**6)+(16*y**6)+(80*x**4)-(24*y**4)-(16*x**2)+(9*y**2)
if h<0:
sys.stdout.write('-')
elif h>=0:
sys.stdout.write('+')
ten modul np.arange umoznuje rodelit interval tedy muj <-1,1> pomoci desetinneho cisla 2.0/37.0
kdyz ten skrip spustim tak se mi zacnou vypisovat + a - ....ale problem je v tom ze po 73 znacich v radku to pokracuje dal coz nechci...chtel bych aby po 73 znacich to preskocilo na dalsi radku...
ma nekdo nejake reseni? dekuji za odpovedi