Any languages able to program (0,1] mathematical interval

04282017, 01:56 PM
(This post was last modified: 04282017 08:18 PM by StephenG1CMZ.)
Post: #1




Any languages able to program (0,1] mathematical interval
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. Stephen Lewkowicz (G1CMZ) ANDROID HP Prime App broken offline on some mobiles 

04282017, 03:48 PM
Post: #2




RE: Any languages able to program (0,1] mathematical interval  
04282017, 04:54 PM
(This post was last modified: 04282017 05:00 PM by Gerson W. Barbosa.)
Post: #3




RE: Any languages able to program (0,1] mathematical interval
(04282017 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). WA understands the notation I was taught in middle school: Plot [0, 9[ 

04282017, 08:16 PM
Post: #4




RE: Any languages able to program (0,1] mathematical interval
(04282017 03:48 PM)Gerson W. Barbosa Wrote:(04282017 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 <= Stephen Lewkowicz (G1CMZ) ANDROID HP Prime App broken offline on some mobiles 

04282017, 08:28 PM
Post: #5




RE: Any languages able to program (0,1] mathematical interval
(04282017 08:16 PM)StephenG1CMZ Wrote:(04282017 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. 

04282017, 09:23 PM
(This post was last modified: 04292017 08:50 PM by pier4r.)
Post: #6




RE: Any languages able to program (0,1] mathematical interval
(04282017 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:
Wikis are great, Contribute :) 

04282017, 10:03 PM
Post: #7




RE: Any languages able to program (0,1] mathematical interval
(04282017 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. 

04282017, 10:04 PM
(This post was last modified: 04302017 12:24 PM by SlideRule.)
Post: #8




RE: Any languages able to program (0,1] mathematical interval
ALL
From the publication PreCalculaus 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 precalculus books and some precalculus 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 filledin 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 

04282017, 10:11 PM
(This post was last modified: 04282017 10:23 PM by Vtile.)
Post: #9




RE: Any languages able to program (0,1] mathematical interval
..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 !! 

04292017, 07:29 PM
Post: #10




RE: Any languages able to program (0,1] mathematical interval
(04282017 09:23 PM)pier4r Wrote:(04282017 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). Stephen Lewkowicz (G1CMZ) ANDROID HP Prime App broken offline on some mobiles 

« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)