Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Trabajo

# quadratic.py
# Analisis Numerico
# Primer cuatrimestre 2018
# Trabajo Practico de Introduccion a Python
# Alumno: Matias N. Navarro
# Numero de Registro: 875.553

# Tarea realizada: El presente trabajo consiste en preparar un Sistema tal que permita calcular raices compleja de una cuadratica. A continuacion se realizara la misma paso a paso, junto con una breve descripcion de cada uno para una mejor comprension.

# El primer paso consiste en importar el paquete cmath, mediante el cual me va a permitir calcular raices complejas, puesto que dicha funcion no viene por defecto en Python:

import cmath 

# Una vez importado el paquete que contiene la funcion, se le solicitara al sistema que en su ejecucion exponga una breve descripcion del sistema:

print("Este sistema calcula raices complejas de una cuadratica")

# A continuacion, se definen los numeros a utilizar:

a=8
b=7
c=5

# Una vez definidos los numeros, solicitamos al sistema que calcule las raices complejas de la cuadratica, ya previamente mecionada:

discRoot = cmath.sqrt(complex(b * b - 4 * a * c))
root1 = (-b + discRoot) / (2 * a) #Raiz 1 como solucion del sistema
root2 = (-b - discRoot) / (2 * a) #Raiz 2 como solucion del sistema
" \n"
print("Las soluciones de este sistema son", root1, root2 )

Execute Python Online

a=1,b=a+1,num=0,f==100
 while num==0:
    c=a+b
    b+=1
    c=c+b
    if b<f:
    print num
    if b==f:
    num==1
    print c

....

print"its easy"

Procesos

# Hello World program in Python
    
print "Hello World!\n"

Execute Python Online

import calendar;
cal = calendar.month(2019, 4)
print "Here is the calendar:"
print cal

tamrin1

# Hello World program in Pyth
a=[1,2,3,4,5,6]
b=[1,2,3]
z=0
for i in range(len(b)):
    if b[i] in a :
       z+=1;
if(len(b)==z):
    print("b zirmajmoa a")
       

Execute Python Online

# Prosecna duzina skoka
print "Prosecna duzina skoka u dalj"
prvi_skok=8.12
drugi_skok=8.23
treci_skok=8.17
prosecna_duzina=(prvi_skok+drugi_skok+treci_skok)/3
print "Prosecna duzina skoka je"
print prosecna_duzina
print "KRAJ\n"

Execute Python Online

import re

strList = ['31231aB', 'meaningful', '#@!$Sdas1', 'asda', '^asdasd' , '@dawa' , '15/9-16']
testStr = 'dadasadsae23sad2'
dList = ['\d', '\$', '\@', '\^']

for i in range(0,len(strList)):
    for j in range(0,len(dList)):
        if (re.search(dList[j],strList[i])):
            strList[i] = ''
            
print(strList)

Paragraph assembler

aList =[
  'Exploration  well  15/9-19  SR,  drilled  to  the  Theta  Vest\n',
  'structure  in  the  Sleipner  area,  encountered  oil  in  the\n',
  'Jurassic  Hugin Formation. The drill stem test showed  very\n',
  'good production capacities through time, with low water cut\n',
  'and low GOR. A comprehensive study of the structure and the\n',
  'discovery has been performed and is reported. This includes\n',
  'seismic  and  structural  interpretations,  biostratigraphy,\n',
  'sedimentology, petrography, geochemistry, petrophysics, test\n',
  'analysis  and  resource  estimation.  The  resources  are\n',
  'calculated to 10.3 million Sm3 oil in place and 4.55 million\n',
  'Sm3 oil  recoverable.\n'
]

rList = [""] # Rectified List
cI = 0 # Current index of the list

for i in range(0,len(aList)): # Loop through all elements in the list
    if aList[i] != '\n':
        aList[i] = aList[i].replace('\n',' ') 
    if (aList[i][0].isupper()) and (". " not in aList[i]):
        cI += 1
        rList.append(aList[i])
    elif not (aList[i][0].isupper()) or (". " in aList[i]):
        rList[cI] += aList[i]
# Print out the rectified output
for rStr in rList:
	print(rStr)

Actividad Numerico

#Registro 890.670
#Mauro, Aldana


print("Este programa permitira encontrar las raices reales y complejas de una cuadratica")

import cmath #habilita el uso de numeros complejos

print("raices de una compleja")
#defino los valores de a b y c 
a=1
b=3
c=0


#raiz del numero tenga o no parte imaginaria cero
discRoot = cmath.sqrt(b * b - 4 * a * c)

#defino el valor de las raices componiendo la raiz cuadrada segun la formula resolvente

raiz1 = (-b + discRoot) / (2 * a)
raiz2 = (-b - discRoot) / (2 * a)

#finalmente pido que me devuelva las raices
print("las soluciones son:", raiz1, raiz2)

#Ejemplo 1: x^2 +1=0
a=1
b=0
c=1

discRoot = cmath.sqrt(b * b - 4 * a * c)

raiz1 = (-b + discRoot) / (2 * a)
raiz2 = (-b - discRoot) / (2 * a)

print("las soluciones del ejemplo 1 son:", raiz1, raiz2)

#Ejemplo 2: x^2 + 3x -10
a=1
b=3
c=-10

discRoot = cmath.sqrt(b * b - 4 * a * c)

raiz1 = (-b + discRoot) / (2 * a)
raiz2 = (-b - discRoot) / (2 * a)

print("las soluciones del ejemplo 2 son:", raiz1, raiz2)

Previous 1 ... 5 6 7 8 9 10 11 ... 866 Next
Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.