<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://www.lptms.universite-paris-saclay.fr//wiki-cours/index.php?action=history&amp;feed=atom&amp;title=Python%3A_Exemple_de_classe_Complexe</id>
	<title>Python: Exemple de classe Complexe - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://www.lptms.universite-paris-saclay.fr//wiki-cours/index.php?action=history&amp;feed=atom&amp;title=Python%3A_Exemple_de_classe_Complexe"/>
	<link rel="alternate" type="text/html" href="http://www.lptms.universite-paris-saclay.fr//wiki-cours/index.php?title=Python:_Exemple_de_classe_Complexe&amp;action=history"/>
	<updated>2026-04-07T10:36:24Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>http://www.lptms.universite-paris-saclay.fr//wiki-cours/index.php?title=Python:_Exemple_de_classe_Complexe&amp;diff=632&amp;oldid=prev</id>
		<title>Wiki-cours at 12:03, 6 September 2016</title>
		<link rel="alternate" type="text/html" href="http://www.lptms.universite-paris-saclay.fr//wiki-cours/index.php?title=Python:_Exemple_de_classe_Complexe&amp;diff=632&amp;oldid=prev"/>
		<updated>2016-09-06T12:03:44Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 14:03, 6 September 2016&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l64&quot;&gt;Line 64:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 64:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;from math import pi&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;from math import pi&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;print Complexe(1,0),Complexe(0,1),Complexe(0,0),Complexe(1,1)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;print&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;(&lt;/ins&gt;Complexe(1,0),Complexe(0,1),Complexe(0,0),Complexe(1,1&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;)&lt;/ins&gt;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;print Complexe(module=1.0,phase=pi/2)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;print&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;(&lt;/ins&gt;Complexe(module=1.0,phase=pi/2&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;)&lt;/ins&gt;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;a = Complexe(1,-1.432)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;a = Complexe(1,-1.432)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;print a, conj(a), a.module2(), abs(a)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;print&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;(&lt;/ins&gt;a, conj(a), a.module2(), abs(a&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;)&lt;/ins&gt;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;print a + a, a - a&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;print&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;(&lt;/ins&gt;a + a, a - a&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;)&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;print a*3  # attention le second argument doit être à droite&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;print&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;(&lt;/ins&gt;a*3&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;) &lt;/ins&gt; # attention le second argument doit être à droite&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;print Complexe(3.0)*a&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;print&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;(&lt;/ins&gt;Complexe(3.0)*a&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;)&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Wiki-cours</name></author>
	</entry>
	<entry>
		<id>http://www.lptms.universite-paris-saclay.fr//wiki-cours/index.php?title=Python:_Exemple_de_classe_Complexe&amp;diff=553&amp;oldid=prev</id>
		<title>Wiki-cours at 21:31, 19 November 2015</title>
		<link rel="alternate" type="text/html" href="http://www.lptms.universite-paris-saclay.fr//wiki-cours/index.php?title=Python:_Exemple_de_classe_Complexe&amp;diff=553&amp;oldid=prev"/>
		<updated>2015-11-19T21:31:20Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 23:31, 19 November 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l6&quot;&gt;Line 6:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 6:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     Une classe toute simple de nombres complexes&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     Une classe toute simple de nombres complexes&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     &amp;quot;&amp;quot;&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     &amp;quot;&amp;quot;&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    real = 0.0&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    imag = 0.0&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     def __init__(self,r=0.0,i=0.0,module=0.0,phase=0.0):&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     def __init__(self,r=0.0,i=0.0,module=0.0,phase=0.0):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         &amp;quot;Constructeur avec paramètres optionnels nommés&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         &amp;quot;Constructeur avec paramètres optionnels nommés&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Wiki-cours</name></author>
	</entry>
	<entry>
		<id>http://www.lptms.universite-paris-saclay.fr//wiki-cours/index.php?title=Python:_Exemple_de_classe_Complexe&amp;diff=500&amp;oldid=prev</id>
		<title>Wiki-cours: Wiki-cours moved page Python: Exemple de classe complexe to Python: Exemple de classe Complexe</title>
		<link rel="alternate" type="text/html" href="http://www.lptms.universite-paris-saclay.fr//wiki-cours/index.php?title=Python:_Exemple_de_classe_Complexe&amp;diff=500&amp;oldid=prev"/>
		<updated>2015-09-15T21:28:08Z</updated>

		<summary type="html">&lt;p&gt;Wiki-cours moved page &lt;a href=&quot;/wiki-cours/index.php/Python:_Exemple_de_classe_complexe&quot; class=&quot;mw-redirect&quot; title=&quot;Python: Exemple de classe complexe&quot;&gt;Python: Exemple de classe complexe&lt;/a&gt; to &lt;a href=&quot;/wiki-cours/index.php/Python:_Exemple_de_classe_Complexe&quot; title=&quot;Python: Exemple de classe Complexe&quot;&gt;Python: Exemple de classe Complexe&lt;/a&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 23:28, 15 September 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Wiki-cours</name></author>
	</entry>
	<entry>
		<id>http://www.lptms.universite-paris-saclay.fr//wiki-cours/index.php?title=Python:_Exemple_de_classe_Complexe&amp;diff=496&amp;oldid=prev</id>
		<title>Wiki-cours: Created page with &quot;__NOTOC__ &lt;--Sommaire &lt;source lang=&quot;py&quot;&gt; class Complexe:     &quot;&quot;&quot;     Une classe toute simple de nombres complexes     &quot;&quot;&quot;     real = 0.0     imag = 0.0...&quot;</title>
		<link rel="alternate" type="text/html" href="http://www.lptms.universite-paris-saclay.fr//wiki-cours/index.php?title=Python:_Exemple_de_classe_Complexe&amp;diff=496&amp;oldid=prev"/>
		<updated>2015-09-14T21:38:25Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;__NOTOC__ &lt;a href=&quot;/wiki-cours/index.php/Memento_Python&quot; title=&quot;Memento Python&quot;&gt;&amp;lt;--Sommaire&lt;/a&gt; &amp;lt;source lang=&amp;quot;py&amp;quot;&amp;gt; class Complexe:     &amp;quot;&amp;quot;&amp;quot;     Une classe toute simple de nombres complexes     &amp;quot;&amp;quot;&amp;quot;     real = 0.0     imag = 0.0...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__NOTOC__&lt;br /&gt;
[[Memento_Python|&amp;lt;--Sommaire]]&lt;br /&gt;
&amp;lt;source lang=&amp;quot;py&amp;quot;&amp;gt;&lt;br /&gt;
class Complexe:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    Une classe toute simple de nombres complexes&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    real = 0.0&lt;br /&gt;
    imag = 0.0&lt;br /&gt;
    def __init__(self,r=0.0,i=0.0,module=0.0,phase=0.0):&lt;br /&gt;
        &amp;quot;Constructeur avec paramètres optionnels nommés&amp;quot;&lt;br /&gt;
        #tentative de conversion en réel&lt;br /&gt;
        self.real = float(r)&lt;br /&gt;
        self.imag = float(i)&lt;br /&gt;
        module = float(module)&lt;br /&gt;
        phase = float(phase)&lt;br /&gt;
        if module:&lt;br /&gt;
            from math import cos,sin&lt;br /&gt;
            self.real = module*cos(phase)&lt;br /&gt;
            self.imag = module*sin(phase)&lt;br /&gt;
        &lt;br /&gt;
    def __str__(self):&lt;br /&gt;
        &amp;quot;affichage de l&amp;#039;objet avec le mot-cle print&amp;quot;&lt;br /&gt;
        return str(self.real)+(&amp;#039;+&amp;#039; if self.imag &amp;gt;=0.0 else &amp;#039;&amp;#039;) \&lt;br /&gt;
                        + str(self.imag)+&amp;#039;i&amp;#039;&lt;br /&gt;
    &lt;br /&gt;
    def __add__(self,other):&lt;br /&gt;
        &amp;quot;additionne deux complexes&amp;quot;&lt;br /&gt;
        if not other.__class__ is Complexe:&lt;br /&gt;
            print &amp;quot;Erreur: l&amp;#039;argument n&amp;#039;est pas un complexe&amp;quot;&lt;br /&gt;
            return NotImplemented&lt;br /&gt;
        return Complexe(self.real+other.real,self.imag+other.imag)&lt;br /&gt;
&lt;br /&gt;
    def __sub__(self,other):&lt;br /&gt;
        &amp;quot;soustrait deux complexes&amp;quot;&lt;br /&gt;
        if not other.__class__ is Complexe:&lt;br /&gt;
            print &amp;quot;Erreur: l&amp;#039;argument n&amp;#039;est pas un complexe&amp;quot;&lt;br /&gt;
            return NotImplemented&lt;br /&gt;
        return Complexe(self.real-other.real,self.imag-other.imag)&lt;br /&gt;
    &lt;br /&gt;
    def __mul__(self,other):&lt;br /&gt;
        &amp;quot;multiplie deux complexes&amp;quot;&lt;br /&gt;
        if other.__class__ is Complexe:&lt;br /&gt;
            return Complexe(self.real*other.real - self.imag*other.imag, \&lt;br /&gt;
                            self.imag*other.real + self.real*other.imag)&lt;br /&gt;
        elif other.__class__ is float or other.__class__ is int:&lt;br /&gt;
            return Complexe(self.real*other,self.imag*other)            &lt;br /&gt;
        else:&lt;br /&gt;
            print &amp;quot;Erreur: l&amp;#039;argument n&amp;#039;est pas du bon type&amp;quot;&lt;br /&gt;
            return NotImplemented&lt;br /&gt;
    &lt;br /&gt;
    def module2(self):&lt;br /&gt;
        &amp;quot;retourne le module au carré&amp;quot;&lt;br /&gt;
        return (self*self.conj()).real&lt;br /&gt;
    &lt;br /&gt;
    def conj(self):&lt;br /&gt;
        &amp;quot;renvoie le conjugué&amp;quot;&lt;br /&gt;
        return Complexe(self.real,-self.imag)&lt;br /&gt;
    &lt;br /&gt;
def conj(c):&lt;br /&gt;
    return c.conj()&lt;br /&gt;
&lt;br /&gt;
def abs(c):  # surcharge de la fonction abs&lt;br /&gt;
    from math import sqrt&lt;br /&gt;
    return sqrt(c.module2())&lt;br /&gt;
&lt;br /&gt;
from math import pi&lt;br /&gt;
print Complexe(1,0),Complexe(0,1),Complexe(0,0),Complexe(1,1)&lt;br /&gt;
print Complexe(module=1.0,phase=pi/2)&lt;br /&gt;
a = Complexe(1,-1.432)&lt;br /&gt;
print a, conj(a), a.module2(), abs(a)&lt;br /&gt;
print a + a, a - a&lt;br /&gt;
print a*3  # attention le second argument doit être à droite&lt;br /&gt;
print Complexe(3.0)*a&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Wiki-cours</name></author>
	</entry>
</feed>