File tree Expand file tree Collapse file tree 5 files changed +13
-7
lines changed
mathematical_optimization Expand file tree Collapse file tree 5 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -481,7 +481,9 @@ Main point
481481**The answer ** (in Numpy)
482482
483483 - **strides **: the number of bytes to jump to find the next element
484- - 1 stride per dimension::
484+ - 1 stride per dimension
485+
486+ .. code-block :: python
485487
486488 >> > x.strides
487489 (3 , 1 )
Original file line number Diff line number Diff line change @@ -881,13 +881,14 @@ Curve fitting
881881 :target: auto_examples/plot_curve_fit.html
882882 :align: right
883883
884+ .. Comment to make doctest pass
885+ >>> np.random.seed(0)
886+
884887 Least square problems occur often when fitting a non-linear to data.
885888While it is possible to construct our optimization problem ourselves,
886889scipy provides a helper function for this purpose:
887890:func: `scipy.optimize.curve_fit `::
888891
889- .. Comment to make doctest pass
890- >>> np.random.seed(0)
891892
892893 >>> def f(t, omega, phi):
893894 ... return np.cos(omega * t + phi)
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ This is the way to include your image and link it to the code:
9090 You can display the corresponding code using the ``literal-include ``
9191directive.
9292
93- .. literal-include :: examples/plot_simple.py
93+ .. literalinclude :: examples/plot_simple.py
9494
9595.. note ::
9696
Original file line number Diff line number Diff line change @@ -376,7 +376,9 @@ Exercises
376376 .. topic :: Exercise: Quicksort
377377 :class: green
378378
379- Implement the quicksort algorithm, as defined by wikipedia::
379+ Implement the quicksort algorithm, as defined by wikipedia
380+
381+ .. parsed-literal ::
380382
381383 function quicksort(array)
382384 var list less, greater
Original file line number Diff line number Diff line change @@ -446,11 +446,12 @@ our initial guess: ::
446446
447447**Curve fitting **
448448
449- Suppose we have data sampled from ``f `` with some noise: ::
450-
451449.. Comment to make doctest pass
452450 >>> np.random.seed(42)
453451
452+ Suppose we have data sampled from ``f `` with some noise: ::
453+
454+
454455 >>> xdata = np.linspace(-10, 10, num=20)
455456 >>> ydata = f(xdata) + np.random.randn(xdata.size)
456457
You can’t perform that action at this time.
0 commit comments