Post by jarychk on Jul 13, 2024 9:58:31 GMT
(Intended title, "Subject", would not all fit in the field!)
(Can moderator adjust?)
------------------------------------------------------------------------------------------------------------------------------------------
Very common academic algebra mixture, concentration exercise: Drain And Replace.
A container or tank of known volume capacity is filled with a liquid of given concentration; how much of this liquid should be drained and then replaced with a liquid with same carrier and same dissolved matter at a different concentration, so that the resulting concentration is a specified concentration.
Usually the concentrations are given as percents. When description is to use just the carrier alone, this is 0% liquid. If the description uses the pure matter alone, this is 100% material. Commonly the Drain and Replace describes a situation for a coolant system with some concentration of antifreeze; but the situation could be instead one of sugar solutions or alcohol solutions.
The type of exercise is so common that so many of them are much alike, really often being the same problem but with just different given values, and some rearrangements of wording. So very common that the desciptions and question can be turned into a program in BASIC.
This program although not perfect works well. A beginning BASIC programmer could create something like this:
(Can moderator adjust?)
------------------------------------------------------------------------------------------------------------------------------------------
Very common academic algebra mixture, concentration exercise: Drain And Replace.
A container or tank of known volume capacity is filled with a liquid of given concentration; how much of this liquid should be drained and then replaced with a liquid with same carrier and same dissolved matter at a different concentration, so that the resulting concentration is a specified concentration.
Usually the concentrations are given as percents. When description is to use just the carrier alone, this is 0% liquid. If the description uses the pure matter alone, this is 100% material. Commonly the Drain and Replace describes a situation for a coolant system with some concentration of antifreeze; but the situation could be instead one of sugar solutions or alcohol solutions.
The type of exercise is so common that so many of them are much alike, really often being the same problem but with just different given values, and some rearrangements of wording. So very common that the desciptions and question can be turned into a program in BASIC.
This program although not perfect works well. A beginning BASIC programmer could create something like this:
'INPUT VARB
'Vc volume capac of container whatever units
'begcon beginning conc. in container, percent
'stkcon concentration to add, after draining x
'rcon result concenctration percent wanted
'OUTPUT VARB
'x the unknow volume to drain and replace, unknown
'nomainwin
WindowWidth = 550
WindowHeight = 410
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
statictext #main.statictext1, "A container with volume capacity", 22, 56, 208, 20
textbox #main.vcap, 246, 51, 100, 25
statictext #main.statictext3, "units is filled", 358, 56, 144, 20
statictext #main.statictext4, "with a solution concentration of", 22, 86, 192, 20
textbox #main.conbegin, 230, 81, 100, 25
statictext #main.statictext7, "%. How much should be", 350, 86, 160, 20
statictext #main.statictext8, "drained, and replaced with a", 22, 121, 176, 20
textbox #main.stock, 222, 116, 100, 25
statictext #main.statictext10, "% solution in order for", 334, 121, 144, 20
statictext #main.statictext11, "the container be full with resulting", 22, 156, 200, 20
textbox #main.result, 230, 151, 100, 25
statictext #main.statictext13, "% solution?", 344, 156, 88, 25
button #main.solvex, "Volume Drain&Replace", [solve], UL, 22, 231, 168, 35
button #main.info, "INFO", [information], UL, 390, 236, 110, 21
statictext #main.solved, "solved here", 22, 301, 300, 20
open "common drain & replace academic exercise" for window as #main
print #main, "trapclose [quit.main]"
print #main, "font ms_sans_serif 10"
print #main.vcap,"!setfocus"
print #main.solved,"!font ms_sans_serif 14"
wait
[quit.main]
Close #main
END
[solve] 'Perform action for the button named 'solvex'
'worry about finding user mistakes later.
'what are in the textboxes??
print #main.vcap,"!contents? Vc"
print #main.conbegin,"!contents? begcon"
print #main.stock,"!contents? stkcon"
print #main.result,"!contents? rcon"
print Vc
print begcon
print stkcon
print rcon
'
'Algebra steps carried symbolically outside for solution formula
let numer=rcon-begcon
let denom=stkcon-begcon
let x=Vc*(numer)/denom
LET x$=using("####.###",x)
PRINT x
PRINT x$
print #main.solved,"drain,replace with ";x$;" vol. units"
wait
[information] 'Perform action for the button named 'info'
notice "nothing here yet."
wait