Inscription / Connexion Nouveau Sujet
Niveau première
Partager :

Exercice avec python

Posté par
Ilhhh
03-10-20 à 15:42

Bonjour à tous ,
Alors j'ai un exercice pour mon dm de maths , voici l'énoncé
H est la fonction définie sur R par h(x)=x au carré -1000x

1. Existe-t-il un nombre réel x tel que h(x) supérieur ou égal à 8000

2. On considère la fonction Seuil écrite en langage python
def Seuil (M):
         x=0
         while x**2-1000*x<M:
                     x=x+1
         return x

1. Quel est le rôle de cette fonction?
2. Saisir et exécuter cette fonction avec M=8000 interpréter la valeur renvoyé

J'ai déjà fait la première partie c juste la partie 2 ou je ne comprends pas trop

Je vous remercie à l'avance à tous ceux qui m'aideront

Posté par
alb12
re : Exercice avec python 03-10-20 à 15:56

salut,
son role est de trouver le x de la question 1/

Posté par
Ilhhh
re : Exercice avec python 03-10-20 à 16:00

D'accord merci beaucoup et pour la 2 question vous comprenez ?

Posté par
alb12
re : Exercice avec python 03-10-20 à 16:08

comment fais tu habituellement pour executer un programme ?

Posté par
Ilhhh
re : Exercice avec python 03-10-20 à 16:12

Je sais pas , normalement c'est avec la calculatrice mais cela me mets erreur

Posté par
alb12
re : Exercice avec python 03-10-20 à 16:16

le code est correct donc tu le tapes mal sur ta machine. Quelle est cette machine ?

Posté par
Ilhhh
re : Exercice avec python 03-10-20 à 16:17

C'est une numworks

Posté par
alb12
re : Exercice avec python 03-10-20 à 16:18

il ne devrait pas y avooir de pb
Quel est le message d'erreur ?

Posté par
Ilhhh
re : Exercice avec python 03-10-20 à 16:20

Je vous ai joint une image

Posté par
alb12
re : Exercice avec python 03-10-20 à 16:22

tu peux recopier le message

Posté par
Ilhhh
re : Exercice avec python 03-10-20 à 16:24

>>>from seuil import *
File "seuil.py" , line 1
SyntaxError: invalid syntax
>>>
Voici le message qui s'affiche sur la calculatrice

Posté par
alb12
re : Exercice avec python 03-10-20 à 16:26

quelle est la ligne 1 de ton programme ?

Posté par
Ilhhh
re : Exercice avec python 03-10-20 à 16:32

Def seuil (M):

Tu n'aurais pas un réseaux social si c'est pas indiscret ce sera plus simple pour t'envoyer des images ?

Posté par
alb12
re : Exercice avec python 03-10-20 à 16:42

il est preferable de discuter ici cela peut interesser d'autres personnes
as tu ecrit Def ou def ?

Posté par
Ilhhh
re : Exercice avec python 03-10-20 à 16:43

def

Posté par
alb12
re : Exercice avec python 03-10-20 à 16:43


def seuil(M):
    x=0
    while x**2-1000*x<M:
        x=x+1
    return x

Posté par
Ilhhh
re : Exercice avec python 03-10-20 à 16:43

Oui j'ai écris ça

Posté par
alb12
re : Exercice avec python 03-10-20 à 16:46

ok est-il indispensable d'ecrire:  
>>>from seuil import *

Posté par
Ilhhh
re : Exercice avec python 03-10-20 à 16:47

Ça aussi c'est  fait et ça me mets erreur

Posté par
Ilhhh
re : Exercice avec python 03-10-20 à 16:48

Voici l'image

Exercice avec python

Posté par
alb12
re : Exercice avec python 03-10-20 à 17:01

Que se passe-t-il si tu tapes directement seuil(8000)

Posté par
Ilhhh
re : Exercice avec python 03-10-20 à 17:06

La même chose

Posté par
Ilhhh
re : Exercice avec python 03-10-20 à 17:09

Même si je fais comme ça cela me mets erreur

Exercice avec python

Posté par
alb12
re : Exercice avec python 03-10-20 à 17:11

si quelqu'un a une numworks sous la main, il pourrait tester

Posté par
alb12
re : Exercice avec python 03-10-20 à 17:13

ton script est juste, je ne vois pas où est le pb

Posté par
alb12
re : Exercice avec python 03-10-20 à 17:15

Quel idiot je suis
ta premiere ligne est incorrecte, regarde bien

Posté par
Ilhhh
re : Exercice avec python 03-10-20 à 17:19

Je ne vois pas l'erreur , tu peux me dire stp?

Posté par
alb12
re : Exercice avec python 03-10-20 à 17:20

ok tu as change M en 8000 dans le script
ne fais pas ça
la premiere ligne doit etre
def seuil(M):
ton pb n'est donc pas resolu, je seche

Posté par
Ilhhh
re : Exercice avec python 03-10-20 à 17:23

Même avec m cela me m'est erreur

Exercice avec python

Exercice avec python

Posté par
alb12
re : Exercice avec python 03-10-20 à 17:24

tu es sur d'avoir tape


def seuil(M):
    x=0
    while x**2-1000*x<M:
        x=x+1
    return x


puis ensuite dans la console
seuil(8000)

Posté par
alb12
re : Exercice avec python 03-10-20 à 17:25

1000*x en ligne 4

Posté par
alb12
re : Exercice avec python 03-10-20 à 17:26

Fichu de torticolis ! Mets les images à l'horizontal

Posté par
Ilhhh
re : Exercice avec python 03-10-20 à 17:28

Oh c'est bon j'ai réussi merci bcp

Posté par
Ilhhh
re : Exercice avec python 03-10-20 à 17:29

Du coup la valeur affiché représente quoi ?

Posté par
alb12
re : Exercice avec python 03-10-20 à 17:31

A ton avis ?

Posté par
Ilhhh
re : Exercice avec python 03-10-20 à 17:35

La valeur de x  pour que M soit supérieur à 8000?

Posté par
alb12
re : Exercice avec python 03-10-20 à 17:36

non la plus petite valeur de x telle que f(x) depasse 8000

Posté par
Ilhhh
re : Exercice avec python 03-10-20 à 17:38

D'accord merci bcp est ce que ça vous dérangerait de m'aider pour un autre exercice?
sinon  je vous remercie infiniment

Posté par
alb12
re : Exercice avec python 03-10-20 à 18:42

ouvre un autre sujet. Bonne continuation.

Posté par
Ilhhh
re : Exercice avec python 03-10-20 à 19:08

Merci à toi aussi

Posté par
alb12
re : Exercice avec python 03-10-20 à 19:13

oups la plus petite valeur entiere de x telle que h(x) depasse 8000

Posté par
Ilhhh
re : Exercice avec python 03-10-20 à 19:15

Merci beaucoup pour votre aide



Vous devez être membre accéder à ce service...

Pas encore inscrit ?

1 compte par personne, multi-compte interdit !

Ou identifiez-vous :


Rester sur la page

Inscription gratuite

Fiches en rapport

parmi 1724 fiches de maths

Désolé, votre version d'Internet Explorer est plus que périmée ! Merci de le mettre à jour ou de télécharger Firefox ou Google Chrome pour utiliser le site. Votre ordinateur vous remerciera !