kill(all)$

Maxima : intro computation ,base and acid, 'appendix 7,version 1.0'
peter.vlasschaert@gmail.com, 02/01/2019

load packages
=============

load(lrats)$
load(facexp)$

Menu : Numeric :Set displayed  Precision
===================================

fpprintprec : 6;

data : 
=====

---------------------------------------------------------------------------------------------------

volume : added with buret to the vessel  => corresponding : ph
=======================================================

---------------------------------------------------------------------------------------------------

spreadsheet : data
================

vol :[A2,A3,A4,A5,A6,A7]
ph :[B2,B3,B4,B5,B6,B7]

maxima :data
============

vol:[20.5,21.00,21.50,22.00,22.50];
ph:[11.59,11.60,11.62,11.68,11.72];

-------------------------------------------------------------------------------------------------

rem : when added volume from buret , measuring :ph automatic 
          reading during the process.
-------------------------------------------------------------------------------------------------
rem : vol => volume
           ph =>  ph = -log([H(+)])

------------------------------------------------------------------------------------------------

computation :  'derivatives'
============

first derivative : d (ph)/dv
=====================

result : length 'data' -1
===================

average volume : v1_avg
==============

v1_avg :[];
for i:1 thru length(vol)-1 step 1 do(
m1: (vol[i]+vol[i+1])/2, 
v1_avg : endcons(m1,v1_avg));

v1_avg;

v1_avg:endcons("",v1_avg);

f'(Δph/Δv)   = fd1
=========

empty list : fd1

fd1:[];

for i:1 thru length(vol)-1 step 1 do(
m2: (ph[i+1]-ph[i])/(vol[i+1]-vol[i]), 
fd1 : endcons(m2,fd1));

fd1;

fd1:endcons("",fd1);

second derivative : d/dv(dph/dv)
===========================

result : length 'data' - 2
===================

average volume : v2_avg
==============

v2_avg :[];
for i:1 thru length(vol)-2 step 1 do(
m3: (v1_avg[i]+v1_avg[i+1])/2, 
v2_avg : endcons(m3,v2_avg));

v2_avg;

for i:1 thru 2 step 1 do(
v2_avg:endcons("",v2_avg)
    );

f ''(Δph^2/Δ^2v)   = fd2
===================

fd2:[];

for i:1 thru length(vol)-2 step 1 do(
m4: (fd1[i+1]-fd1[i])/(v1_avg[i+1]-v1_avg[i]), 
fd2 : endcons(m4,fd2));

fd2;

for i:1 thru 2 step 1 do(
fd2:endcons("",fd2)
    );

spreadsheet : representation
========================

--------------------------------------------------------------------------------------------------------------------------

   
          A         B              C                       D                                E                        F
         
1       vol        ph           v1                     f'(dph/dv)                 v2                 f''(d/dv(dph/dv)) 
         ------------------------------------------------------------------------------------------------------------------
2       A2        B2      =(A2+A3)/2   =(B3-B2)/(A3-A2)     =(C2+C3)/2      =(D3-D2)/(C3-C2)
3       A3        B3      =(A3+A4)/2   =(B4-B3)/(A4-A3)     =(C3+C4)/2      =(D4-D3)/(C4-C3)
4       A4        B4      =(A4+A5)/2   =(B5-B4)/(A5-A4)     =(C4+C5)/2      =(D5-D4)/(C5-C4) 
5       A5        B5      =(A5+A6)/2   =(B6-B5)/(A6-A5)     =(C5+C6)/2      =(D6-D5)/(C6-C5) 
6       A6        B6      =(A6+A7)/2   =(B7-B6)/(A7-A6)            "                               "
7       A7        B7             "                          "                             "                                "                 

---------------------------------------------------------------------------------------------------------------------------

 ====================================================================

---------------------------------------------------------------------------------------------------------------------------
column : C,D  =>  length (data(A or B)) -1
column : E,F  =>   length (data(A or B)) -2
 "                       =>   empty cell representation

---------------------------------------------------------------------------------------------------------------------------

A,B,C,D,E,F : columns
1,2,3,4,5,6,7 : rows

--------------------------------------------------------------------------------------------------------------------------

spreadsheet (column)  => maxima (list)
================================

v1  =>  v1_avg
v2  =>  v2_avg
 f'(dph/dv)               => fd1 ' list construct'
 f''(d/dv(dph/dv))   => fd2 ' list construct'

 ====================

List representation
================

-----------------------------------------------------------------------------------------------------------------------------

collist:["vol","ph","v1_avg","d(ph)/dv","v2_avg","d(dph/dv)/dv"];

---------------------------------------------------------------------------------------------------------------------------  

kl:[transpose(vol),transpose(ph),transpose(v1_avg),transpose(fd1),
        transpose(v2_avg),transpose(fd2)];

----------------------------------------------------------------------------------------------------------------------

Matrix representation :
===================

p1:zeromatrix(length(vol),length(collist));

for i:1 thru length(vol) step 1 do(
p1[i,1] :vol[i],p1[i,2]:ph[i],p1[i,3]:v1_avg[i],
p1[i,4] :fd1[i] ,p1[i,5] :v2_avg[i] ,p1[i,6]:fd2[i]
);

collist;

p1;

p1:addrow(p1,collist);

use 'command ' => table_form (matrix)
================================

p2:table_form(p1)$

----------------------------------------------------------------------------------------------------------------------