Any languages able to program (0,1] mathematical interval - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: Not HP Calculators (/forum-7.html) +--- Forum: Not remotely HP Calculators (/forum-9.html) +--- Thread: Any languages able to program (0,1] mathematical interval (/thread-8263.html) |
Any languages able to program (0,1] mathematical interval - StephenG1CMZ - 04-28-2017 01:56 PM Mathematicians often use brackets to indicate whether or not a limit value is included or excluded, e.g. (0,9] might be programmed as 0<=x<9... I don't use that syntax often so wouldn't be sure which bracket is which without checking. Update: It seems I have the brackets the wrong way round. Are there any programming languages that recognise that syntax directly, thereby avoiding the need to check and code it differently? I am mainly interested in mainstream languages (Basic, C, Lua, Python ... And of course HP PPL) rather than Mathematica and the like. Alternatively, is there a different way of writing such an interval concisely, yet making which is included/excluded clearer. RE: Any languages able to program (0,1] mathematical interval - Gerson W. Barbosa - 04-28-2017 03:48 PM (04-28-2017 01:56 PM)StephenG1CMZ Wrote: Alternatively, is there a different way of writing such an interval concisely, yet making which is included/excluded clearer. [0, 9[ ? RE: Any languages able to program (0,1] mathematical interval - Gerson W. Barbosa - 04-28-2017 04:54 PM (04-28-2017 01:56 PM)StephenG1CMZ Wrote: Mathematicians often use brackets to indicate whether or not a limit value is included or excluded, e.g. (0,9] might be programmed as 0<=x<9... I don't use that syntax often so wouldn't be sure which bracket is which without checking. It appears the correct syntax is [0, 9). W|A understands the notation I was taught in middle school: Plot [0, 9[ RE: Any languages able to program (0,1] mathematical interval - StephenG1CMZ - 04-28-2017 08:16 PM (04-28-2017 03:48 PM)Gerson W. Barbosa Wrote:(04-28-2017 01:56 PM)StephenG1CMZ Wrote: Alternatively, is there a different way of writing such an interval concisely, yet making which is included/excluded clearer. ? I don't find that any clearer... The only notation I recall clearly from my maths class is < or <= RE: Any languages able to program (0,1] mathematical interval - Gerson W. Barbosa - 04-28-2017 08:28 PM (04-28-2017 08:16 PM)StephenG1CMZ Wrote:(04-28-2017 03:48 PM)Gerson W. Barbosa Wrote: [0, 9[ ? [0 clearly encloses 0 while in 9[ 9 is definitely out. This doesn't seem to be a standard notation, though. RE: Any languages able to program (0,1] mathematical interval - pier4r - 04-28-2017 09:23 PM (04-28-2017 01:56 PM)StephenG1CMZ Wrote: Alternatively, is there a different way of writing such an interval concisely, yet making which is included/excluded clearer. To emphasize the equal. Code:
RE: Any languages able to program (0,1] mathematical interval - nsg - 04-28-2017 10:03 PM (04-28-2017 08:28 PM)Gerson W. Barbosa Wrote: [0 clearly encloses 0 while in 9[ 9 is definitely out. This doesn't seem to be a standard notation, though. It may be not standard, but I was taught it in school too. Have to admit, never seen it after school, it seemed to have been replaced by [a,b) convention. When I get to my bookshelf I will check for it in some older texts. RE: Any languages able to program (0,1] mathematical interval - SlideRule - 04-28-2017 10:04 PM ALL From the publication Pre-Calculaus for Dummies, second edition: You can use interval notation to express where a set of solutions begins and here it ends. Interval notation is a common way to express the solution set to an inequality, and it’s important because it’s how you express solution sets in calculus. Most pre-calculus books and some pre-calculus teachers now require all sets to be written in interval notation. If the endpoint of the interval isn’t included in the solution (for < or >), the interval is called an open interval. You show it on the graph with an open circle at the point and by using parentheses in notation. If the endpoint is included in the solution (for ≤ or ≥) the interval is called a closed interval, which you show on the graph with a filled-in circle at the point and by using square brackets in notation. For example, the solution set -2 < x ≤ 3, rewrite this solution set as an and statement: -2 < x AND x ≤ 3. In interval notation, you write this solution as (–2, 3]. BEST! SlideRule RE: Any languages able to program (0,1] mathematical interval - Vtile - 04-28-2017 10:11 PM ..And in 50g plot etc.. Y1(X)=(Your function)*(0≤X)*(9>X) (0≤X)*(9>X) Boolean AND If X is less than zero and is less than 9 then 0*0=0 If X is more than zero but is less than 9 then 1*1=1 If X is more than zero and is more than or equal of 9 then 1*0=0 PS. (–2, 3] So utterly ugly !! RE: Any languages able to program (0,1] mathematical interval - StephenG1CMZ - 04-29-2017 07:29 PM (04-28-2017 09:23 PM)pier4r Wrote:(04-28-2017 01:56 PM)StephenG1CMZ Wrote: Alternatively, is there a different way of writing such an interval concisely, yet making which is included/excluded clearer. I can see that that would be less easy to skip over or mistype than "=". I can imagine times when being able to copy the (0,9] syntax in a spec into the code would make it clearer that the code limits match the spec. On the other hand when implementing and debugging the code, the <= syntax or your separate < and = make it clearer what the code is doing (when (0,9] is used infrequently). |