elmo
Montreal, Quebec, Canada
 
 
it's elmo but earl
Currently Offline
calculations of an integral
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 29 14:09:43 2023

@author: your mom
"""

# step 1 import necessary librairies

import numpy as np
import matplotlib.pyplot as plt

# step 2 define starting variables

xi = 0
xf = 2
npts = 21
x = np.linspace(xi,xf,npts)
f = np.zeros(npts)
g = np.zeros(npts)

# step 3 define functions that will be later plotted

for i in range(len(x)):
f = x **3
if x <=-1:
g = 3 * x + 2
elif x < 1:
g = f
else:
g = 3 * x - 2

# step 4 graph the functions previously defined

plt.plot(x,f, label = 'f(x)')
plt.plot(x,g, label = 'g(x)')
plt.legend()
plt.title("There is no title idiot")
plt.grid(True, "both", 'both')

# step 5 calculate the integral of the function g(x) between x = 0 and x = 2

A1=0
dx = x[1] - x[0]
for j in range(0,npts-1):
A1= A1 + ( g[j]+g[j+1] )/2*dx
print(f"L'intégrale de la fonction g(x) entre x=0 et x=2 est {A1:.4f}")
Item Showcase
Rarest Achievement Showcase
Recent Activity
67 hrs on record
last played on 4 Jul, 2023
40 hrs on record
last played on 4 Jul, 2023
5.2 hrs on record
last played on 23 May, 2023
Adolace 31 Aug, 2024 @ 11:46am 
cool game
76561199260463324 24 Jul, 2023 @ 10:02am 
lets go party in csgo
76561199041963229 Trade Banned 22 Nov, 2021 @ 1:50pm 
Im interested to buy your item on steam market, but i need to talk about prices, add me if u can.
76561198109744297 Trade Banned 25 Jul, 2021 @ 8:40pm 
hello man. add me if you want to sell your knife.
director 16 Jul, 2021 @ 12:05am 
send me a friend request, I need to talk to you
Jotus 4 Jun, 2021 @ 4:54am 
hi mate, can you add me? just for a quick chat