Python Forum
Solving Equations with Python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solving Equations with Python
#4
Hi again!

I have modified once again the program to show that interacting the way you want with such big matrices produce an even more humongous matrix of almost 1 million and a half elements, because matrix 'x' has 800 elements, and matrix 'y' has 1800 elements, so your equation interacting with both of them gives a number of elements equal to the product of 800*1800, that is to say, 1440000 elements!!!
import numpy as np

x = np.arange(4,12,.01)
bigx = len(x)
print("\nThe matrix 'x' has", bigx, "elements.")
y = np.arange(0,18,.01)
bigy = len(y)
print("The matrix 'y' has", bigy, "elements.")
mother_of_matrices = bigx*bigy
print("Therefore, the interaction of matrices 'x' and 'y' produces a huge matrix of:", mother_of_matrices, "elements.")
k = 10/(6+x)

print('\n\nThese are the values for "x":\n\n', x)
print('\n\nThese are the values for "y":\n\n', y)
print('\n\nThese are the values for "k":\n\n', k)
and that produces the following huge output:
Output:
The matrix 'x' has 800 elements. The matrix 'y' has 1800 elements. Therefore, the interaction of matrices 'x' and 'y' produces a huge matrix of: 1440000 elements. These are the values for "x": [ 4. 4.01 4.02 4.03 4.04 4.05 4.06 4.07 4.08 4.09 4.1 4.11 4.12 4.13 4.14 4.15 4.16 4.17 4.18 4.19 4.2 4.21 4.22 4.23 4.24 4.25 4.26 4.27 4.28 4.29 4.3 4.31 4.32 4.33 4.34 4.35 4.36 4.37 4.38 4.39 4.4 4.41 4.42 4.43 4.44 4.45 4.46 4.47 4.48 4.49 4.5 4.51 4.52 4.53 4.54 4.55 4.56 4.57 4.58 4.59 4.6 4.61 4.62 4.63 4.64 4.65 4.66 4.67 4.68 4.69 4.7 4.71 4.72 4.73 4.74 4.75 4.76 4.77 4.78 4.79 4.8 4.81 4.82 4.83 4.84 4.85 4.86 4.87 4.88 4.89 4.9 4.91 4.92 4.93 4.94 4.95 4.96 4.97 4.98 4.99 5. 5.01 5.02 5.03 5.04 5.05 5.06 5.07 5.08 5.09 5.1 5.11 5.12 5.13 5.14 5.15 5.16 5.17 5.18 5.19 5.2 5.21 5.22 5.23 5.24 5.25 5.26 5.27 5.28 5.29 5.3 5.31 5.32 5.33 5.34 5.35 5.36 5.37 5.38 5.39 5.4 5.41 5.42 5.43 5.44 5.45 5.46 5.47 5.48 5.49 5.5 5.51 5.52 5.53 5.54 5.55 5.56 5.57 5.58 5.59 5.6 5.61 5.62 5.63 5.64 5.65 5.66 5.67 5.68 5.69 5.7 5.71 5.72 5.73 5.74 5.75 5.76 5.77 5.78 5.79 5.8 5.81 5.82 5.83 5.84 5.85 5.86 5.87 5.88 5.89 5.9 5.91 5.92 5.93 5.94 5.95 5.96 5.97 5.98 5.99 6. 6.01 6.02 6.03 6.04 6.05 6.06 6.07 6.08 6.09 6.1 6.11 6.12 6.13 6.14 6.15 6.16 6.17 6.18 6.19 6.2 6.21 6.22 6.23 6.24 6.25 6.26 6.27 6.28 6.29 6.3 6.31 6.32 6.33 6.34 6.35 6.36 6.37 6.38 6.39 6.4 6.41 6.42 6.43 6.44 6.45 6.46 6.47 6.48 6.49 6.5 6.51 6.52 6.53 6.54 6.55 6.56 6.57 6.58 6.59 6.6 6.61 6.62 6.63 6.64 6.65 6.66 6.67 6.68 6.69 6.7 6.71 6.72 6.73 6.74 6.75 6.76 6.77 6.78 6.79 6.8 6.81 6.82 6.83 6.84 6.85 6.86 6.87 6.88 6.89 6.9 6.91 6.92 6.93 6.94 6.95 6.96 6.97 6.98 6.99 7. 7.01 7.02 7.03 7.04 7.05 7.06 7.07 7.08 7.09 7.1 7.11 7.12 7.13 7.14 7.15 7.16 7.17 7.18 7.19 7.2 7.21 7.22 7.23 7.24 7.25 7.26 7.27 7.28 7.29 7.3 7.31 7.32 7.33 7.34 7.35 7.36 7.37 7.38 7.39 7.4 7.41 7.42 7.43 7.44 7.45 7.46 7.47 7.48 7.49 7.5 7.51 7.52 7.53 7.54 7.55 7.56 7.57 7.58 7.59 7.6 7.61 7.62 7.63 7.64 7.65 7.66 7.67 7.68 7.69 7.7 7.71 7.72 7.73 7.74 7.75 7.76 7.77 7.78 7.79 7.8 7.81 7.82 7.83 7.84 7.85 7.86 7.87 7.88 7.89 7.9 7.91 7.92 7.93 7.94 7.95 7.96 7.97 7.98 7.99 8. 8.01 8.02 8.03 8.04 8.05 8.06 8.07 8.08 8.09 8.1 8.11 8.12 8.13 8.14 8.15 8.16 8.17 8.18 8.19 8.2 8.21 8.22 8.23 8.24 8.25 8.26 8.27 8.28 8.29 8.3 8.31 8.32 8.33 8.34 8.35 8.36 8.37 8.38 8.39 8.4 8.41 8.42 8.43 8.44 8.45 8.46 8.47 8.48 8.49 8.5 8.51 8.52 8.53 8.54 8.55 8.56 8.57 8.58 8.59 8.6 8.61 8.62 8.63 8.64 8.65 8.66 8.67 8.68 8.69 8.7 8.71 8.72 8.73 8.74 8.75 8.76 8.77 8.78 8.79 8.8 8.81 8.82 8.83 8.84 8.85 8.86 8.87 8.88 8.89 8.9 8.91 8.92 8.93 8.94 8.95 8.96 8.97 8.98 8.99 9. 9.01 9.02 9.03 9.04 9.05 9.06 9.07 9.08 9.09 9.1 9.11 9.12 9.13 9.14 9.15 9.16 9.17 9.18 9.19 9.2 9.21 9.22 9.23 9.24 9.25 9.26 9.27 9.28 9.29 9.3 9.31 9.32 9.33 9.34 9.35 9.36 9.37 9.38 9.39 9.4 9.41 9.42 9.43 9.44 9.45 9.46 9.47 9.48 9.49 9.5 9.51 9.52 9.53 9.54 9.55 9.56 9.57 9.58 9.59 9.6 9.61 9.62 9.63 9.64 9.65 9.66 9.67 9.68 9.69 9.7 9.71 9.72 9.73 9.74 9.75 9.76 9.77 9.78 9.79 9.8 9.81 9.82 9.83 9.84 9.85 9.86 9.87 9.88 9.89 9.9 9.91 9.92 9.93 9.94 9.95 9.96 9.97 9.98 9.99 10. 10.01 10.02 10.03 10.04 10.05 10.06 10.07 10.08 10.09 10.1 10.11 10.12 10.13 10.14 10.15 10.16 10.17 10.18 10.19 10.2 10.21 10.22 10.23 10.24 10.25 10.26 10.27 10.28 10.29 10.3 10.31 10.32 10.33 10.34 10.35 10.36 10.37 10.38 10.39 10.4 10.41 10.42 10.43 10.44 10.45 10.46 10.47 10.48 10.49 10.5 10.51 10.52 10.53 10.54 10.55 10.56 10.57 10.58 10.59 10.6 10.61 10.62 10.63 10.64 10.65 10.66 10.67 10.68 10.69 10.7 10.71 10.72 10.73 10.74 10.75 10.76 10.77 10.78 10.79 10.8 10.81 10.82 10.83 10.84 10.85 10.86 10.87 10.88 10.89 10.9 10.91 10.92 10.93 10.94 10.95 10.96 10.97 10.98 10.99 11. 11.01 11.02 11.03 11.04 11.05 11.06 11.07 11.08 11.09 11.1 11.11 11.12 11.13 11.14 11.15 11.16 11.17 11.18 11.19 11.2 11.21 11.22 11.23 11.24 11.25 11.26 11.27 11.28 11.29 11.3 11.31 11.32 11.33 11.34 11.35 11.36 11.37 11.38 11.39 11.4 11.41 11.42 11.43 11.44 11.45 11.46 11.47 11.48 11.49 11.5 11.51 11.52 11.53 11.54 11.55 11.56 11.57 11.58 11.59 11.6 11.61 11.62 11.63 11.64 11.65 11.66 11.67 11.68 11.69 11.7 11.71 11.72 11.73 11.74 11.75 11.76 11.77 11.78 11.79 11.8 11.81 11.82 11.83 11.84 11.85 11.86 11.87 11.88 11.89 11.9 11.91 11.92 11.93 11.94 11.95 11.96 11.97 11.98 11.99] These are the values for "y": [0.000e+00 1.000e-02 2.000e-02 ... 1.797e+01 1.798e+01 1.799e+01] These are the values for "k": [1. 0.999001 0.99800399 0.99700897 0.99601594 0.99502488 0.99403579 0.99304866 0.99206349 0.99108028 0.99009901 0.98911968 0.98814229 0.98716683 0.98619329 0.98522167 0.98425197 0.98328417 0.98231827 0.98135427 0.98039216 0.97943193 0.97847358 0.97751711 0.9765625 0.97560976 0.97465887 0.97370983 0.97276265 0.9718173 0.97087379 0.9699321 0.96899225 0.96805421 0.96711799 0.96618357 0.96525097 0.96432015 0.96339114 0.96246391 0.96153846 0.96061479 0.9596929 0.95877277 0.95785441 0.9569378 0.95602294 0.95510984 0.95419847 0.95328885 0.95238095 0.95147479 0.95057034 0.94966762 0.9487666 0.9478673 0.9469697 0.94607379 0.94517958 0.94428706 0.94339623 0.94250707 0.94161959 0.94073377 0.93984962 0.93896714 0.9380863 0.93720712 0.93632959 0.9354537 0.93457944 0.93370682 0.93283582 0.93196645 0.9310987 0.93023256 0.92936803 0.92850511 0.92764378 0.92678406 0.92592593 0.92506938 0.92421442 0.92336103 0.92250923 0.92165899 0.92081031 0.9199632 0.91911765 0.91827365 0.91743119 0.91659028 0.91575092 0.91491308 0.91407678 0.91324201 0.91240876 0.91157703 0.91074681 0.90991811 0.90909091 0.90826521 0.90744102 0.90661831 0.9057971 0.90497738 0.90415913 0.90334237 0.90252708 0.90171326 0.9009009 0.90009001 0.89928058 0.8984726 0.89766607 0.89686099 0.89605735 0.89525515 0.89445438 0.89365505 0.89285714 0.89206066 0.8912656 0.89047195 0.88967972 0.88888889 0.88809947 0.88731145 0.88652482 0.88573959 0.88495575 0.8841733 0.88339223 0.88261253 0.88183422 0.88105727 0.88028169 0.87950748 0.87873462 0.87796313 0.87719298 0.87642419 0.87565674 0.87489064 0.87412587 0.87336245 0.87260035 0.87183958 0.87108014 0.87032202 0.86956522 0.86880973 0.86805556 0.86730269 0.86655113 0.86580087 0.8650519 0.86430424 0.86355786 0.86281277 0.86206897 0.86132644 0.8605852 0.85984523 0.85910653 0.8583691 0.85763293 0.85689803 0.85616438 0.85543199 0.85470085 0.85397096 0.85324232 0.85251492 0.85178876 0.85106383 0.85034014 0.84961767 0.84889643 0.84817642 0.84745763 0.84674005 0.84602369 0.84530854 0.84459459 0.84388186 0.84317032 0.84245998 0.84175084 0.84104289 0.84033613 0.83963056 0.83892617 0.83822297 0.83752094 0.83682008 0.8361204 0.83542189 0.83472454 0.83402836 0.83333333 0.83263947 0.83194676 0.8312552 0.83056478 0.82987552 0.8291874 0.82850041 0.82781457 0.82712986 0.82644628 0.82576383 0.82508251 0.82440231 0.82372323 0.82304527 0.82236842 0.82169269 0.82101806 0.82034454 0.81967213 0.81900082 0.81833061 0.81766149 0.81699346 0.81632653 0.81566069 0.81499593 0.81433225 0.81366965 0.81300813 0.81234768 0.81168831 0.81103001 0.81037277 0.8097166 0.80906149 0.80840744 0.80775444 0.8071025 0.80645161 0.80580177 0.80515298 0.80450523 0.80385852 0.80321285 0.80256822 0.80192462 0.80128205 0.80064051 0.8 0.79936051 0.79872204 0.7980846 0.79744817 0.79681275 0.79617834 0.79554495 0.79491256 0.79428118 0.79365079 0.79302141 0.79239303 0.79176564 0.79113924 0.79051383 0.78988942 0.78926598 0.78864353 0.78802206 0.78740157 0.78678206 0.78616352 0.78554595 0.78492936 0.78431373 0.78369906 0.78308536 0.78247261 0.78186083 0.78125 0.78064012 0.7800312 0.77942323 0.7788162 0.77821012 0.77760498 0.77700078 0.77639752 0.77579519 0.7751938 0.77459334 0.77399381 0.7733952 0.77279753 0.77220077 0.77160494 0.77101002 0.77041602 0.76982294 0.76923077 0.76863951 0.76804916 0.76745971 0.76687117 0.76628352 0.76569678 0.76511094 0.76452599 0.76394194 0.76335878 0.76277651 0.76219512 0.76161462 0.76103501 0.76045627 0.75987842 0.75930144 0.75872534 0.75815011 0.75757576 0.75700227 0.75642965 0.7558579 0.75528701 0.75471698 0.75414781 0.7535795 0.75301205 0.75244545 0.7518797 0.7513148 0.75075075 0.75018755 0.74962519 0.74906367 0.74850299 0.74794316 0.74738416 0.74682599 0.74626866 0.74571216 0.74515648 0.74460164 0.74404762 0.74349442 0.74294205 0.7423905 0.74183976 0.74128984 0.74074074 0.74019245 0.73964497 0.7390983 0.73855244 0.73800738 0.73746313 0.73691968 0.73637703 0.73583517 0.73529412 0.73475386 0.73421439 0.73367572 0.73313783 0.73260073 0.73206442 0.7315289 0.73099415 0.73046019 0.72992701 0.7293946 0.72886297 0.72833212 0.72780204 0.72727273 0.72674419 0.72621641 0.7256894 0.72516316 0.72463768 0.72411296 0.723589 0.7230658 0.72254335 0.72202166 0.72150072 0.72098053 0.7204611 0.7199424 0.71942446 0.71890726 0.7183908 0.71787509 0.71736011 0.71684588 0.71633238 0.71581961 0.71530758 0.71479628 0.71428571 0.71377587 0.71326676 0.71275837 0.71225071 0.71174377 0.71123755 0.71073205 0.71022727 0.70972321 0.70921986 0.70871722 0.7082153 0.70771408 0.70721358 0.70671378 0.70621469 0.7057163 0.70521862 0.70472163 0.70422535 0.70372977 0.70323488 0.70274069 0.70224719 0.70175439 0.70126227 0.70077085 0.70028011 0.69979006 0.6993007 0.69881202 0.69832402 0.69783671 0.69735007 0.69686411 0.69637883 0.69589422 0.69541029 0.69492703 0.69444444 0.69396253 0.69348128 0.69300069 0.69252078 0.69204152 0.69156293 0.691085 0.69060773 0.69013112 0.68965517 0.68917988 0.68870523 0.68823125 0.68775791 0.68728522 0.68681319 0.6863418 0.68587106 0.68540096 0.68493151 0.6844627 0.68399453 0.683527 0.68306011 0.68259386 0.68212824 0.68166326 0.68119891 0.68073519 0.68027211 0.67980965 0.67934783 0.67888663 0.67842605 0.6779661 0.67750678 0.67704807 0.67658999 0.67613252 0.67567568 0.67521945 0.67476383 0.67430883 0.67385445 0.67340067 0.67294751 0.67249496 0.67204301 0.67159167 0.67114094 0.67069081 0.67024129 0.66979236 0.66934404 0.66889632 0.6684492 0.66800267 0.66755674 0.66711141 0.66666667 0.66622252 0.66577896 0.66533599 0.66489362 0.66445183 0.66401062 0.66357001 0.66312997 0.66269052 0.66225166 0.66181337 0.66137566 0.66093853 0.66050198 0.66006601 0.65963061 0.65919578 0.65876153 0.65832785 0.65789474 0.6574622 0.65703022 0.65659882 0.65616798 0.6557377 0.65530799 0.65487885 0.65445026 0.65402224 0.65359477 0.65316786 0.65274151 0.65231572 0.65189048 0.6514658 0.65104167 0.65061809 0.65019506 0.64977258 0.64935065 0.64892927 0.64850843 0.64808814 0.64766839 0.64724919 0.64683053 0.64641241 0.64599483 0.64557779 0.64516129 0.64474533 0.6443299 0.643915 0.64350064 0.64308682 0.64267352 0.64226076 0.64184852 0.64143682 0.64102564 0.64061499 0.64020487 0.63979527 0.63938619 0.63897764 0.6385696 0.63816209 0.6377551 0.63734863 0.63694268 0.63653724 0.63613232 0.63572791 0.63532402 0.63492063 0.63451777 0.63411541 0.63371356 0.63331222 0.63291139 0.63251107 0.63211125 0.63171194 0.63131313 0.63091483 0.63051702 0.63011972 0.62972292 0.62932662 0.62893082 0.62853551 0.6281407 0.62774639 0.62735257 0.62695925 0.62656642 0.62617408 0.62578223 0.62539087 0.625 0.62460962 0.62421973 0.62383032 0.6234414 0.62305296 0.62266501 0.62227754 0.62189055 0.62150404 0.62111801 0.62073246 0.62034739 0.6199628 0.61957869 0.61919505 0.61881188 0.61842919 0.61804697 0.61766523 0.61728395 0.61690315 0.61652281 0.61614295 0.61576355 0.61538462 0.61500615 0.61462815 0.61425061 0.61387354 0.61349693 0.61312078 0.6127451 0.61236987 0.6119951 0.6116208 0.61124694 0.61087355 0.61050061 0.61012813 0.6097561 0.60938452 0.6090134 0.60864273 0.60827251 0.60790274 0.60753341 0.60716454 0.60679612 0.60642814 0.60606061 0.60569352 0.60532688 0.60496068 0.60459492 0.60422961 0.60386473 0.6035003 0.60313631 0.60277275 0.60240964 0.60204696 0.60168472 0.60132291 0.60096154 0.6006006 0.6002401 0.59988002 0.59952038 0.59916117 0.5988024 0.59844405 0.59808612 0.59772863 0.59737157 0.59701493 0.59665871 0.59630292 0.59594756 0.59559261 0.5952381 0.594884 0.59453032 0.59417706 0.59382423 0.59347181 0.59311981 0.59276823 0.59241706 0.59206631 0.59171598 0.59136606 0.59101655 0.59066745 0.59031877 0.5899705 0.58962264 0.58927519 0.58892815 0.58858152 0.58823529 0.58788948 0.58754407 0.58719906 0.58685446 0.58651026 0.58616647 0.58582308 0.58548009 0.58513751 0.58479532 0.58445354 0.58411215 0.58377116 0.58343057 0.58309038 0.58275058 0.58241118 0.58207218 0.58173357 0.58139535 0.58105752 0.58072009 0.58038305 0.5800464 0.57971014 0.57937428 0.5790388 0.5787037 0.578369 0.57803468 0.57770075 0.57736721 0.57703405 0.57670127 0.57636888 0.57603687 0.57570524 0.57537399 0.57504313 0.57471264 0.57438254 0.57405281 0.57372347 0.5733945 0.5730659 0.57273769 0.57240985 0.57208238 0.57175529 0.57142857 0.57110223 0.57077626 0.57045066 0.57012543 0.56980057 0.56947608 0.56915196 0.56882821 0.56850483 0.56818182 0.56785917 0.56753689 0.56721497 0.56689342 0.56657224 0.56625142 0.56593096 0.56561086 0.56529112 0.56497175 0.56465274 0.56433409 0.56401579 0.56369786 0.56338028 0.56306306 0.5627462 0.5624297 0.56211355 0.56179775 0.56148231 0.56116723 0.5608525 0.56053812 0.56022409 0.55991041 0.55959709 0.55928412 0.55897149 0.55865922 0.55834729 0.55803571 0.55772448 0.5574136 0.55710306 0.55679287 0.55648303 0.55617353 0.55586437]
All the best,
newbieAuggie2019

"That's been one of my mantras - focus and simplicity. Simple can be harder than complex: You have to work hard to get your thinking clean to make it simple. But it's worth it in the end because once you get there, you can move mountains."
Steve Jobs
Reply


Messages In This Thread
Solving Equations with Python - by japrap - Sep-09-2019, 04:22 PM
RE: Solving Equations with Python - by japrap - Sep-09-2019, 07:31 PM
RE: Solving Equations with Python - by newbieAuggie2019 - Sep-09-2019, 07:41 PM
RE: Solving Equations with Python - by japrap - Sep-09-2019, 07:54 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  SOlving LInear Equations in Python(Symoy, NUmpy) - Coefficient Problem quest 3 1,729 Jan-30-2022, 10:53 PM
Last Post: quest
Heart how to solve complex equations in python HoangF 3 2,778 Dec-26-2021, 07:04 PM
Last Post: HoangF
  Python scipy odeint: solving with solution-dependent functions etienne 0 2,735 Jun-05-2020, 01:29 PM
Last Post: etienne
  Differential equations with initial condition in Python (change a working code) Euler2 1 1,825 May-29-2020, 04:06 PM
Last Post: Euler2
Star résolution numérique pour les équations de Lockta-Volterra en python Mohamed19 2 2,227 Jul-07-2019, 01:26 PM
Last Post: SheeppOSU
  Getting a desired vector from lsqr in python when solving a linear system SJ001 0 2,418 Feb-21-2019, 04:19 PM
Last Post: SJ001
  Asking for help in solving a single variable nonlinear equation using Python ! NDP 0 1,979 Feb-15-2019, 12:03 PM
Last Post: NDP

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020