Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F120573886
Intro_1_1.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Jul 5, 08:18
Size
1 KB
Mime Type
text/x-python
Expires
Mon, Jul 7, 08:18 (2 d)
Engine
blob
Format
Raw Data
Handle
27208632
Attached To
rJNAL Jupyter notebooks for Linear Algebra
Intro_1_1.py
View Options
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 11 10:13:39 2019
@author: jecker
"""
import
AL_Fct
as
al
import
math
print
(
"Entrez le nombre de variables n="
)
#function EnterInt but we might need to specify what int we want: variable, nbr equation,..
n
=
input
()
n
=
al
.
EnterInt
(
n
)
print
(
"Votre équation est de la forme"
)
al
.
printEq
(
n
,
''
)
def
EnterListReal
(
n
):
#function enter list of real numbers.
coeff
=
input
()
while
type
(
coeff
)
!=
list
:
try
:
coeff
=
[
float
(
eval
(
x
))
for
x
in
coeff
.
split
(
','
)]
if
len
(
coeff
)
!=
n
+
1
:
print
(
"Vous n'avez pas entré le bon nombre de réels!"
)
print
(
"Entrez à nouveau : "
)
coeff
=
input
()
except
:
print
(
"Ce n'est pas le bon format!"
)
print
(
"Entrez à nouveau"
)
coeff
=
input
()
#coeff[abs(coeff)<1e-15]=0 #ensures that 0 is 0.
return
coeff
print
(
"Entrez les "
,
n
+
1
,
" coefficients de l'équations sous le format a1, a2, ..., b"
)
coeff
=
al
.
EnterListReal
(
n
)
print
(
"Votre equation est"
)
al
.
printEq
(
n
,
coeff
)
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
print
(
"Entrez la solution sous la forme d'une suite de "
,
n
,
" nombres réels"
)
entry
=
input
()
sol
=
al
.
EnterListReal
(
n
-
1
,
entry
)
sol
=
np
.
asarray
(
sol
[
0
:
len
(
sol
)])
al
.
SolOfEq
(
sol
,
coeff
,
1
)
#%%%%%%%%%%
#OK works with fractions as well.
Event Timeline
Log In to Comment