Aaron S. Meurer a écrit :
> You're probably right. According to
> http://en.wikipedia.org/wiki/Interval_(mathematics)#Notations_for_intervals
> , there is a different notation based on whether you are in America or
> in Europe. I think we can allow multiple different notations for the
> arguments of the function. For example, also allow the use of a
> bracket to denote open and a parenthesis to denote closed as is the
> standard notation, so open-closed would be '(]', and so on.
>
> As to printing, I think we need to decide. I have never seen
> the ]3,4] notation, but I guess that is used. What do you think? I
> guess we can include to option to have both, but we still need a
> default option.
>
]3;4] is the french standard notation of (3,4]. I could add an optional
argument lang. The choice lang='fr' will write ]3;4] and other value of
lang will write (3,4].
>>> class Interval():
>>> def __init__(self, a, b, endpoints ='cc'):
>>> if endpoints not in ['cc', 'oc', 'co', 'oo']:
>>> raise Exception, 'Unkown endpoints of interval : "' +
>>> str(endpoints) + '"'
>>>
>>
>> please use raise Exception (...)
>> ...and note the grammar and typo.
>>
> Actually, this should be TypeError, not Exception. Also, the typo he
> is referring to is the misspelling of "Unknown".
>
Sorry for my english but I try to do my best. Ok for changing of the
error that must be raised.
>>> def __str__(self):
>>> if self.min == self.max:
>>> if self.endpoints == 'cc':
>>> return '{' + str(self.min) + '}'
>>>
>> Should we use [ or { ??
>>
> I am unfamiliar with the European notation, as I mentioned above, but
> usually '{' is reserved for finite sets, like {1, 2, 3}, or set
> builder notation, like {x | 1 < x < 2}.
>
Here we have an interval like [3,3] which is equal to {3}. No ?
Is sympy is able to work with inequalities like 3<oo ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sympy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---