### Related

##### first-if-lambda-makelist-map-mod-setify-subset

expr:n;

makelist(''expr, n, 1...

set(a,b);

Calculate

##### first-ifactors-lambda-map-phi-product-rest

phi(n) := map(lambda(...

phi(10) ;

product([2, 2, 2, 2][...

Calculate

##### first-solve

f:(x/a)^2+(y/b)^2;

f1: f,x=4.5,y=2929/3600;

f2: f,x=2.3,y=89/400;

Calculate

first(lsquares_estima...

u@A;

Calculate

##### first-if-lambda-makelist-map-mod-setify-subset

expr:n;

makelist(''expr, n, 1...

set(a,b);

Calculate

##### first-lambda-let

:lisp (defun next (li...

:lisp (next '(a b c d));

:lisp (next '(a b c d));

Calculate

##### first-rest

first(rest([1, 0, 1, ...

Calculate

Calculate

##### first-ratsimp-second-solve

eq_out : i_oa - (in_n...

eq_in_pos : (in_pos -...

eq_in_neg : -(vin1 - ...

Calculate

##### first-ifactors-lambda-map-phi-product-rest

phi(n) := map(lambda(...

phi(10) ;

product([2, 2, 2, 2][...

Calculate

### first

Run Example
```(%i1)makelist (cosh(k*0.01)-(sinh(k*0.01)/((cosh(k*0.01)^2+sinh(k*0.01)^2)^(1/2)))*first(quad_gags((cosh(s)^2+sinh(s)^2)^(1/2),s,0,k*0.01)),k,1,100);
2          2
(%o1) [1.000050000416668 - 0.0099991667674863 sqrt(sinh (s) + cosh (s)),
2          2
1.000200006666756 - 0.019993336558263 sqrt(sinh (s) + cosh (s)),
2          2
1.000450033751013 - 0.029977524472835 sqrt(sinh (s) + cosh (s)),
2          2
1.000800106672356 - 0.039946769697986 sqrt(sinh (s) + cosh (s)),
2          2
1.001250260438369 - 0.049896147380201 sqrt(sinh (s) + cosh (s)),
2          2
1.001800540064804 - 0.059820780297379 sqrt(sinh (s) + cosh (s)),
2          2
1.002451000580082 - 0.069715850264762 sqrt(sinh (s) + cosh (s)),
2          2
1.003201707030797 - 0.079576609213687 sqrt(sinh (s) + cosh (s)),
2          2
1.004052734488219 - 0.089398389885005 sqrt(sinh (s) + cosh (s)),
2          2
1.005004168055804 - 0.099176616082811 sqrt(sinh (s) + cosh (s)),
2          2
1.0060561028777 - 0.10890681243836 sqrt(sinh (s) + cosh (s)),
2          2
1.007208644148267 - 0.11858461363877 sqrt(sinh (s) + cosh (s)),
2          2
1.008461907122592 - 0.12820577308002 sqrt(sinh (s) + cosh (s)),
2          2
1.009816017128017 - 0.13776617090925 sqrt(sinh (s) + cosh (s)),
2          2
1.01127110957667 - 0.14726182142659 sqrt(sinh (s) + cosh (s)),
2          2
1.012827329979011 - 0.15668887982258 sqrt(sinh (s) + cosh (s)),
2          2
1.014484833958375 - 0.16604364823284 sqrt(sinh (s) + cosh (s)),
2          2
1.016243787266541 - 0.17532258109716 sqrt(sinh (s) + cosh (s)),
2          2
1.018104365800307 - 0.18452228981599 sqrt(sinh (s) + cosh (s)),
2          2
1.020066755619076 - 0.19363954670243 sqrt(sinh (s) + cosh (s)),
2          2
1.022131152963465 - 0.20267128823318 sqrt(sinh (s) + cosh (s)),
2          2
1.02429776427493 - 0.21161461760678 sqrt(sinh (s) + cosh (s)),
2          2
1.026566806216406 - 0.22046680662206 sqrt(sinh (s) + cosh (s)),
2          2
1.028938505693979 - 0.22922529689402 sqrt(sinh (s) + cosh (s)),
2          2
1.031413099879573 - 0.23788770042809 sqrt(sinh (s) + cosh (s)),
2          2
1.033990836234669 - 0.24645179957755 sqrt(sinh (s) + cosh (s)),
2          2
1.03667197253505 - 0.25491554641151 sqrt(sinh (s) + cosh (s)),
2          2
1.039456776896581 - 0.26327706152384 sqrt(sinh (s) + cosh (s)),
2          2
1.042345527802019 - 0.27153463231539 sqrt(sinh (s) + cosh (s)),
2          2
1.045338514128861 - 0.27968671078386 sqrt(sinh (s) + cosh (s)),
2          2
1.048436035178234 - 0.28773191085689 sqrt(sinh (s) + cosh (s)),
2          2
1.051638400704824 - 0.29566900530478 sqrt(sinh (s) + cosh (s)),
2          2
1.054945930947853 - 0.30349692227029 sqrt(sinh (s) + cosh (s)),
2          2
1.058358956663102 - 0.31121474145261 sqrt(sinh (s) + cosh (s)),
2          2
1.061877819155985 - 0.31882168998292 sqrt(sinh (s) + cosh (s)),
2          2
1.065502870315686 - 0.32631713802827 sqrt(sinh (s) + cosh (s)),
2          2
1.06923447265034 - 0.3337005941601 sqrt(sinh (s) + cosh (s)),
2          2
1.07307299932329 - 0.34097170052232 sqrt(sinh (s) + cosh (s)),
2          2
1.077018834190404 - 0.34813022783333 sqrt(sinh (s) + cosh (s)),
2          2
1.081072371838455 - 0.3551760702543 sqrt(sinh (s) + cosh (s)),
2          2
1.085234017624587 - 0.36210924015528 sqrt(sinh (s) + cosh (s)),
2          2
1.089504187716845 - 0.36892986280836 sqrt(sinh (s) + cosh (s)),
2          2
1.093883309135799 - 0.37563817103594 sqrt(sinh (s) + cosh (s)),
2          2
1.098371819797239 - 0.38223449984004 sqrt(sinh (s) + cosh (s)),
2          2
1.102970168555971 - 0.38871928103689 sqrt(sinh (s) + cosh (s)),
2          2
1.107678815250704 - 0.39509303791898 sqrt(sinh (s) + cosh (s)),
2          2
1.112498230750031 - 0.4013563799652 sqrt(sinh (s) + cosh (s)),
2          2
1.117428896999517 - 0.40750999761736 sqrt(sinh (s) + cosh (s)),
2          2
1.122471307069898 - 0.41355465714007 sqrt(sinh (s) + cosh (s)),
2          2
1.127625965206381 - 0.41949119557871 sqrt(sinh (s) + cosh (s)),
2          2
1.132893386879076 - 0.42532051582871 sqrt(sinh (s) + cosh (s)),
2          2
1.13827409883454 - 0.43104358182767 sqrt(sinh (s) + cosh (s)),
2          2
1.143768639148453 - 0.43666141388021 sqrt(sinh (s) + cosh (s)),
2          2
1.149377557279424 - 0.44217508412387 sqrt(sinh (s) + cosh (s)),
2          2
1.155101414123941 - 0.44758571214305 sqrt(sinh (s) + cosh (s)),
2          2
1.160940782072458 - 0.45289446073657 sqrt(sinh (s) + cosh (s)),
2          2
1.166896245066636 - 0.45810253184311 sqrt(sinh (s) + cosh (s)),
2          2
1.172968398657738 - 0.46321116262783 sqrt(sinh (s) + cosh (s)),
2          2
1.179157850066182 - 0.46822162173206 sqrt(sinh (s) + cosh (s)),
2          2
1.185465218242268 - 0.47313520568744 sqrt(sinh (s) + cosh (s)),
2          2
1.191891133928069 - 0.47795323549438 sqrt(sinh (s) + cosh (s)),
2          2
1.198436239720508 - 0.48267705336456 sqrt(sinh (s) + cosh (s)),
2          2
1.20510119013562 - 0.48730801962592 sqrt(sinh (s) + cosh (s)),
2          2
1.211886651674 - 0.49184750978832 sqrt(sinh (s) + cosh (s)),
2          2
1.218793302887456 - 0.49629691176724 sqrt(sinh (s) + cosh (s)),
2          2
1.225821834446865 - 0.5006576232625 sqrt(sinh (s) + cosh (s)),
2          2
1.232972949211241 - 0.50493104928861 sqrt(sinh (s) + cosh (s)),
2          2
1.240247362298019 - 0.5091185998528 sqrt(sinh (s) + cosh (s)),
2          2
1.247645801154569 - 0.51322168777675 sqrt(sinh (s) + cosh (s)),
2          2
1.255169005630943 - 0.51724172665738 sqrt(sinh (s) + cosh (s)),
2          2
1.262817728053858 - 0.52118012896249 sqrt(sinh (s) + cosh (s)),
2          2
1.27059273330193 - 0.52503830425606 sqrt(sinh (s) + cosh (s)),
2          2
1.278494798882162 - 0.52881765754876 sqrt(sinh (s) + cosh (s)),
2          2
1.286524715007699 - 0.53251958776843 sqrt(sinh (s) + cosh (s)),
2          2
1.294683284676845 - 0.53614548634569 sqrt(sinh (s) + cosh (s)),
2          2
1.302971323753364 - 0.53969673590974 sqrt(sinh (s) + cosh (s)),
2          2
1.311389661048072 - 0.54317470908921 sqrt(sinh (s) + cosh (s)),
2          2
1.319939138401712 - 0.54658076741329 sqrt(sinh (s) + cosh (s)),
2          2
1.328620610769146 - 0.54991626030819 sqrt(sinh (s) + cosh (s)),
2          2
1.337434946304845 - 0.55318252418416 sqrt(sinh (s) + cosh (s)),
2          2
1.346383026449706 - 0.55638088160831 sqrt(sinh (s) + cosh (s)),
2          2
1.355465746019203 - 0.55951264055881 sqrt(sinh (s) + cosh (s)),
2          2
1.364684013292859 - 0.56257909375572 sqrt(sinh (s) + cosh (s)),
2          2
1.374038750105086 - 0.56558151806447 sqrt(sinh (s) + cosh (s)),
2          2
1.383530891937359 - 0.56852117396742 sqrt(sinh (s) + cosh (s)),
2          2
1.393161388011772 - 0.57139930509971 sqrt(sinh (s) + cosh (s)),
2          2
1.402931201385958 - 0.5742171378453 sqrt(sinh (s) + cosh (s)),
2          2
1.412841309049396 - 0.57697588098962 sqrt(sinh (s) + cosh (s)),
2          2
1.42289270202111 - 0.57967672542497 sqrt(sinh (s) + cosh (s)),
2          2
1.433086385448775 - 0.58232084390541 sqrt(sinh (s) + cosh (s)),
2          2
1.443423378709226 - 0.58490939084772 sqrt(sinh (s) + cosh (s)),
2          2
1.453904715510406 - 0.5874435021753 sqrt(sinh (s) + cosh (s)),
2          2
1.464531443994728 - 0.58992429520193 sqrt(sinh (s) + cosh (s)),
2          2
1.475304626843896 - 0.5923528685526 sqrt(sinh (s) + cosh (s)),
2          2
1.486225341385174 - 0.59473030211863 sqrt(sinh (s) + cosh (s)),
2          2
1.497294679699115 - 0.59705765704449 sqrt(sinh (s) + cosh (s)),
2          2
1.508513748728776 - 0.59933597574382 sqrt(sinh (s) + cosh (s)),
2          2
1.519883670390408 - 0.60156628194249 sqrt(sinh (s) + cosh (s)),
2          2
1.531405581685654 - 0.60374958074623 sqrt(sinh (s) + cosh (s)),
2          2
1.543080634815244 - 0.60588685873103 sqrt(sinh (s) + cosh (s))]
(%i2) ```
Run Example
```intervals(items):=block([result],  result: if (emptyp(items)) then [] else           if(listp(items)) then          if(emptyp(rest(items))) then [] else          cons(cons(first(items),  [second(items)]),          intervals(rest(items))));
(%o1) intervals(items) := block([result],
result : if emptyp(items) then [] else (if listp(items)
then (if emptyp(rest(items)) then [] else cons(cons(first(items),
[second(items)]), intervals(rest(items))))))
(%i2) intervals(makelist(n, n, 1, 10));
(%o2) [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]]
(%i3) intervals(makelist(n, n, 1, 11));
(%o3) [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9],
[9, 10], [10, 11]]
(%i4) ans:errcatch(find_root(sin(x), x, 2, 3));

find_root: function has same sign at endpoints: f(2.0) = 0.90929742682568,
f(3.0) = 0.14112000805987
(%o4)                                 []
(%i5) ans;
(%o5)                                 []
(%i6) seq(start,stop,stepping,[shift]) := block([                                            n, y:[],                                             shift: (if (not(emptyp(shift)))                                                         then float(first(shift))                                                            else (0.0))                                            ],            (n:floor((float(stop-start)/float(stepping)))),            (if (start <
stop)            then            (y:flatten(append([y],                                         makelist(float(start+shift+(stepping*(i-start))),                                         i, start, n+start))))            else            (y:flatten(append([y],                                         makelist(-(float(stop-shift-(stepping*(i-stop)))),                                         i, -(n+stop), stop)))))            (if (n>
1.0)                then return(y)                else return([])));
(%o6) seq(start, stop, stepping, [shift]) :=
block([n, y : [], shift : if not emptyp(shift) then float(first(shift))
float(stop - start)
else 0.0], n : floor(-------------------),
float(stepping)
if start < stop then y : flatten(append([y],
makelist(float(start + shift + stepping (i - start)), i, start, n + start)))
else y : flatten(append([y], makelist(- float(stop - shift
- stepping (i - stop)), i, - (n + stop), stop)))(if n > 1.0 then return(y)
else return([])))
(%i7) intervals(seq(0,7,1));
(%o7) [[0.0, 1.0], [1.0, 2.0], [2.0, 3.0], [3.0, 4.0], [4.0, 5.0], [5.0, 6.0],
[6.0, 7.0]]
(%i8) ans:[];
(%o8)                                 []
(%i9) %pi;
(%o9)                                 %pi
(%i10) %pi, numer;
(%o10)                         3.141592653589793
(%i11) 2*3.14159/%pi;
6.28318
(%o11)                              -------
%pi
(%i12) block([ans:[]], errormsg:false, for i in intervals(seq(0, 7, 1)) do ans:(append(ans, errcatch(find_root(sin(x), x, first(i), second(i))))), errormsg:true, return(ans));
(%o12)            [0.0, 3.141592653589793, 6.283185307179586]
(%i13) ```
Run Example
```kill(all);
(%o0)                                done
(%i1) eq_out : i_oa - (in_neg - vout)/Rf = 0;
in_neg - vout
(%o1)                      i_oa - ------------- = 0
Rf
(%i2) eq_in_pos : (in_pos - 0)/Rg - (vin2 - in_pos)/R2 = 0;
in_pos   vin2 - in_pos
(%o2)                     ------ - ------------- = 0
Rg          R2
(%i3) eq_in_neg : -(vin1 - in_neg)/R1 + (in_neg - vout)/Rf = 0;
in_neg - vin1   in_neg - vout
(%o3)                  ------------- + ------------- = 0
R1              Rf
(%i4) eq_in : in_pos - in_neg = 0;
(%o4)                         in_pos - in_neg = 0
(%i5) a : second(first(solve([eq_out, eq_in_pos, eq_in_neg, eq_in], [vout, in_neg, in_pos, i_oa])[1]));
Rf (vin1 R2 - Rg vin2 + Rg vin1) - Rg vin2 R1
(%o5)           - ---------------------------------------------
R1 R2 + Rg R1
(%i6) ratsimp(a, vin1);
vin1 (Rf R2 + Rf Rg) - Rg vin2 R1 - Rf Rg vin2
(%o6)          - ----------------------------------------------
R1 R2 + Rg R1
(%i7) ratsimp(a, vin2);
- Rf vin1 R2 + vin2 (Rg R1 + Rf Rg) - Rf Rg vin1
(%o7)          ------------------------------------------------
R1 R2 + Rg R1
(%i8) vout = -vin1*(Rf*(R2+Rg))/(R1*(R2+Rg));
Rf vin1
(%o8)                          vout = - -------
R1
(%i9) vout = vin2*(Rg*(R1+Rf))/(R1*(R2+Rg));
Rg vin2 (R1 + Rf)
(%o9)                      vout = -----------------
R1 (R2 + Rg)
(%i10) vout = -vin1*Rf/R1;
Rf vin1
(%o10)                         vout = - -------
R1
(%i11) vout = vin2*(Rg*(R1+Rf))/(R1*(R2+Rg));
Rg vin2 (R1 + Rf)
(%o11)                     vout = -----------------
R1 (R2 + Rg)
(%i12) Rf : 1;
(%o12)                                 1
(%i13) R1 : 0.25;
(%o13)                               0.25
(%i14) R2 : 0.1667;
(%o14)                              0.1667
(%i15) Vneg : -Rf/R1;
(%o15)                               - 4.0
(%i16) Vpos : (Rg*(R1+Rf))/(R1*(R2+Rg));
5.0 Rg
(%o16)                            -----------
Rg + 0.1667
(%i17) ```

Help for First