Skip to content

Commit b857363

Browse files
committed
Updating tutorial+Updation version to 0.8.4
1 parent fbd8fe9 commit b857363

File tree

3 files changed

+136
-32
lines changed

3 files changed

+136
-32
lines changed

cmpx tutorial.ipynb

Lines changed: 134 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
{
2727
"data": {
2828
"text/plain": [
29-
"'0.8.3'"
29+
"'0.8.4'"
3030
]
3131
},
3232
"execution_count": 2,
@@ -187,6 +187,36 @@
187187
"number"
188188
]
189189
},
190+
{
191+
"cell_type": "markdown",
192+
"metadata": {},
193+
"source": [
194+
"## To avoid the long wrtinig you can import directly the Complex class"
195+
]
196+
},
197+
{
198+
"cell_type": "code",
199+
"execution_count": 9,
200+
"metadata": {},
201+
"outputs": [
202+
{
203+
"data": {
204+
"text/plain": [
205+
"1 + 3j"
206+
]
207+
},
208+
"execution_count": 9,
209+
"metadata": {},
210+
"output_type": "execute_result"
211+
}
212+
],
213+
"source": [
214+
"from cmpx import Complex\n",
215+
"\n",
216+
"number = Complex(1,3)\n",
217+
"number"
218+
]
219+
},
190220
{
191221
"cell_type": "markdown",
192222
"metadata": {},
@@ -197,7 +227,7 @@
197227
},
198228
{
199229
"cell_type": "code",
200-
"execution_count": 9,
230+
"execution_count": 10,
201231
"metadata": {
202232
"collapsed": true
203233
},
@@ -216,7 +246,7 @@
216246
},
217247
{
218248
"cell_type": "code",
219-
"execution_count": 10,
249+
"execution_count": 11,
220250
"metadata": {},
221251
"outputs": [
222252
{
@@ -225,7 +255,7 @@
225255
"-1.0 - j"
226256
]
227257
},
228-
"execution_count": 10,
258+
"execution_count": 11,
229259
"metadata": {},
230260
"output_type": "execute_result"
231261
}
@@ -244,7 +274,7 @@
244274
},
245275
{
246276
"cell_type": "code",
247-
"execution_count": 11,
277+
"execution_count": 12,
248278
"metadata": {},
249279
"outputs": [
250280
{
@@ -253,7 +283,7 @@
253283
"3.0 - 3.0j"
254284
]
255285
},
256-
"execution_count": 11,
286+
"execution_count": 12,
257287
"metadata": {},
258288
"output_type": "execute_result"
259289
}
@@ -272,7 +302,7 @@
272302
},
273303
{
274304
"cell_type": "code",
275-
"execution_count": 12,
305+
"execution_count": 13,
276306
"metadata": {},
277307
"outputs": [
278308
{
@@ -281,7 +311,7 @@
281311
"5.0j"
282312
]
283313
},
284-
"execution_count": 12,
314+
"execution_count": 13,
285315
"metadata": {},
286316
"output_type": "execute_result"
287317
}
@@ -300,7 +330,7 @@
300330
},
301331
{
302332
"cell_type": "code",
303-
"execution_count": 13,
333+
"execution_count": 14,
304334
"metadata": {},
305335
"outputs": [
306336
{
@@ -309,7 +339,7 @@
309339
"-0.8 + 0.6j"
310340
]
311341
},
312-
"execution_count": 13,
342+
"execution_count": 14,
313343
"metadata": {},
314344
"output_type": "execute_result"
315345
}
@@ -321,7 +351,7 @@
321351
},
322352
{
323353
"cell_type": "code",
324-
"execution_count": 14,
354+
"execution_count": 15,
325355
"metadata": {},
326356
"outputs": [
327357
{
@@ -330,7 +360,7 @@
330360
"-1.0"
331361
]
332362
},
333-
"execution_count": 14,
363+
"execution_count": 15,
334364
"metadata": {},
335365
"output_type": "execute_result"
336366
}
@@ -350,7 +380,7 @@
350380
},
351381
{
352382
"cell_type": "code",
353-
"execution_count": 15,
383+
"execution_count": 16,
354384
"metadata": {},
355385
"outputs": [
356386
{
@@ -359,7 +389,7 @@
359389
"2.0 - 2.0j"
360390
]
361391
},
362-
"execution_count": 15,
392+
"execution_count": 16,
363393
"metadata": {},
364394
"output_type": "execute_result"
365395
}
@@ -371,7 +401,7 @@
371401
},
372402
{
373403
"cell_type": "code",
374-
"execution_count": 16,
404+
"execution_count": 17,
375405
"metadata": {},
376406
"outputs": [
377407
{
@@ -380,7 +410,7 @@
380410
"-4.0 + 10.0j"
381411
]
382412
},
383-
"execution_count": 16,
413+
"execution_count": 17,
384414
"metadata": {},
385415
"output_type": "execute_result"
386416
}
@@ -392,7 +422,7 @@
392422
},
393423
{
394424
"cell_type": "code",
395-
"execution_count": 17,
425+
"execution_count": 18,
396426
"metadata": {},
397427
"outputs": [
398428
{
@@ -409,7 +439,7 @@
409439
"-4.0 + 10.0j"
410440
]
411441
},
412-
"execution_count": 17,
442+
"execution_count": 18,
413443
"metadata": {},
414444
"output_type": "execute_result"
415445
}
@@ -436,7 +466,7 @@
436466
},
437467
{
438468
"cell_type": "code",
439-
"execution_count": 18,
469+
"execution_count": 19,
440470
"metadata": {},
441471
"outputs": [
442472
{
@@ -445,7 +475,7 @@
445475
"2.23606797749979"
446476
]
447477
},
448-
"execution_count": 18,
478+
"execution_count": 19,
449479
"metadata": {},
450480
"output_type": "execute_result"
451481
}
@@ -463,7 +493,7 @@
463493
},
464494
{
465495
"cell_type": "code",
466-
"execution_count": 19,
496+
"execution_count": 20,
467497
"metadata": {},
468498
"outputs": [
469499
{
@@ -472,7 +502,7 @@
472502
"-2.0 - j"
473503
]
474504
},
475-
"execution_count": 19,
505+
"execution_count": 20,
476506
"metadata": {},
477507
"output_type": "execute_result"
478508
}
@@ -491,7 +521,7 @@
491521
},
492522
{
493523
"cell_type": "code",
494-
"execution_count": 20,
524+
"execution_count": 21,
495525
"metadata": {
496526
"collapsed": true
497527
},
@@ -503,7 +533,7 @@
503533
},
504534
{
505535
"cell_type": "code",
506-
"execution_count": 21,
536+
"execution_count": 22,
507537
"metadata": {
508538
"collapsed": true
509539
},
@@ -515,7 +545,7 @@
515545
},
516546
{
517547
"cell_type": "code",
518-
"execution_count": 22,
548+
"execution_count": 23,
519549
"metadata": {
520550
"collapsed": true
521551
},
@@ -527,7 +557,7 @@
527557
},
528558
{
529559
"cell_type": "code",
530-
"execution_count": 23,
560+
"execution_count": 24,
531561
"metadata": {},
532562
"outputs": [
533563
{
@@ -545,7 +575,7 @@
545575
},
546576
{
547577
"cell_type": "code",
548-
"execution_count": 24,
578+
"execution_count": 25,
549579
"metadata": {},
550580
"outputs": [
551581
{
@@ -563,7 +593,7 @@
563593
},
564594
{
565595
"cell_type": "code",
566-
"execution_count": 25,
596+
"execution_count": 26,
567597
"metadata": {
568598
"collapsed": true
569599
},
@@ -575,7 +605,7 @@
575605
},
576606
{
577607
"cell_type": "code",
578-
"execution_count": 26,
608+
"execution_count": 27,
579609
"metadata": {},
580610
"outputs": [
581611
{
@@ -600,7 +630,7 @@
600630
},
601631
{
602632
"cell_type": "code",
603-
"execution_count": 27,
633+
"execution_count": 28,
604634
"metadata": {},
605635
"outputs": [
606636
{
@@ -615,6 +645,80 @@
615645
"if num1 > (1 - 0.5j):\n",
616646
" print('({}) > ({})'.format(num1, (1-0.5j)))"
617647
]
648+
},
649+
{
650+
"cell_type": "markdown",
651+
"metadata": {},
652+
"source": [
653+
"# 5 - Solving linear and second degree equations\n",
654+
"- You can solve first or second degree equation using solve function, it takes three arguments and those are the coefficients (a, b and c) :\n",
655+
"\\begin{equation}\n",
656+
"ax^2 + bx + c = 0\n",
657+
"\\end{equation}\n",
658+
"- solve function returns a tuple of solutions which they are Complex objects."
659+
]
660+
},
661+
{
662+
"cell_type": "code",
663+
"execution_count": 29,
664+
"metadata": {
665+
"collapsed": true
666+
},
667+
"outputs": [],
668+
"source": [
669+
"from cmpx.equations import solve"
670+
]
671+
},
672+
{
673+
"cell_type": "code",
674+
"execution_count": 30,
675+
"metadata": {
676+
"collapsed": true
677+
},
678+
"outputs": [],
679+
"source": [
680+
"solutions = solve(-1, 2.5, -4)"
681+
]
682+
},
683+
{
684+
"cell_type": "code",
685+
"execution_count": 31,
686+
"metadata": {},
687+
"outputs": [
688+
{
689+
"data": {
690+
"text/plain": [
691+
"(1.25 + 1.5612494995995996j, 1.25 - 1.5612494995995996j)"
692+
]
693+
},
694+
"execution_count": 31,
695+
"metadata": {},
696+
"output_type": "execute_result"
697+
}
698+
],
699+
"source": [
700+
"solutions"
701+
]
702+
},
703+
{
704+
"cell_type": "code",
705+
"execution_count": 32,
706+
"metadata": {},
707+
"outputs": [
708+
{
709+
"data": {
710+
"text/plain": [
711+
"cmpx.number.Complex"
712+
]
713+
},
714+
"execution_count": 32,
715+
"metadata": {},
716+
"output_type": "execute_result"
717+
}
718+
],
719+
"source": [
720+
"type(solutions[0])"
721+
]
618722
}
619723
],
620724
"metadata": {

cmpx/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
__author__ = 'Omar Belghaouti'
66
__maintainer__ = 'Omar Belghaouti'
77
__email__ = 'bel_omar18@yahoo.com'
8-
__version__ = '0.8.3'
8+
__version__ = '0.8.4'
99
__license__ = 'MIT'
1010
__all__ = [
1111
'Complex'

0 commit comments

Comments
 (0)