SimoneWiegand

10 Reputation

One Badge

2 years, 117 days

MaplePrimes Activity


These are questions asked by SimoneWiegand

# Below you find a small example about the function diffdiameter(conc,number), which has the unit length as long as the second argument number is not zero. Using the convert function it is possible to remove the units entirely, but this does not help, if I want to plot the functions. Is there a possibilty to plot diffdiameter(conc,number-not-zero) and diffdiameter(conc,0) in one diagramm? with(Units[Simple]); with(plots); diffdiameter := (conc, number) -> -number*diameter*exp(-conc/Unit(mol/kg)); diffdiameter := proc (conc, number) options operator, arrow; Units:-Simple:-`-`(Units:-Simple:-`*`(Units:-Simple:-`*`(numb\ er, diameter), Units:-Simple:-exp(Units:-Simple:-`-`(Units:-Si\ mple:-`*`(conc, Units:-Simple:-`/`(Unit(Units:-Simple:-`*`(mol\ , Units:-Simple:-`/`(kg))))))))) end proc diameter := 2*Unit(m); diameter := 2 Unit(m) evalf(diffdiameter(Unit(mol/kg), 6)); evalf(diffdiameter(Unit(mol/kg), 0)); -4.414553294 Unit(m) 0. convert(evalf(diffdiameter(Unit(mol/kg), 6)), unit_free); convert(evalf(diffdiameter(Unit(mol/kg), 0)), unit_free); -4.414553294 0. plot([convert(evalf(diffdiameter(conc, 0.001)), unit_free), convert(evalf(diffdiameter(conc, 6)), unit_free)], conc = 0 .. 4*Unit(mol/kg), title = "derivative Diameter with conc", labels = ["concentration / mol/kg", "deriv diameter / m"], color = ["blue", "red"], legend = ["bare diameter", "PLUS diameter"], labeldirections = ["horizontal", "vertical"], titlefont = [Helvetica, bold, 16], axesfont = [Helvetica, 14], labelfont = [Helvetica, 14], axes = boxed); plot([convert(evalf(diffdiameter(conc, 0)), unit_free), convert(evalf(diffdiameter(conc, 6)), unit_free)], conc = 0 .. 4*Unit(mol/kg)); Error, (in plot) invalid subscript selector
Page 1 of 1