Register to reply

If possible, I'd like a function f(i,j)=k defined as follows

by Jamin2112
Tags: defined, function
Share this thread:
FactChecker
#19
Apr20-14, 12:02 PM
P: 278
The original solution by Mark44 is a simple, direct solution. (The dimensions were off and a typo, but without a compiler it is hard to get it right the first time.) Regarding array indices and table look-ups, nothing can beat the versatility of well implemented associative arrays (aka hash tables, dictionaries, etc.). C++ hash tables (unordered_map) are awkward to use, Perl is very good, Python looks good but I have no experience with it.
Mark44
#20
Apr20-14, 12:27 PM
Mentor
P: 21,216
Quote Quote by FactChecker View Post
The original solution by Mark44 is a simple, direct solution. (The dimensions were off and a typo, but without a compiler it is hard to get it right the first time.)
I'm not sure what you're talking about. I didn't use arrays at all. You might be referring to the code that AlephZero wrote that I quoted in one post.
Quote Quote by FactChecker View Post
Regarding array indices and table look-ups, nothing can beat the versatility of well implemented associative arrays (aka hash tables, dictionaries, etc.). C++ hash tables (unordered_map) are awkward to use, Perl is very good, Python looks good but I have no experience with it.
AlephZero
#21
Apr20-14, 01:27 PM
Engineering
Sci Advisor
HW Helper
Thanks
P: 6,929
Quote Quote by Mark44 View Post
Unless you're referring to Fortran, then whatever languages you're talking about are newer than C, which has been around since the early 70's. Newer languages don't have the need to maintain compatability with existing code, so can start on a clean page. For me, it's not a hardship to forgo negative array subscripts.
IIRC, PL/1 (which I used back in the days of IBM S/360 mainframes) had this feature before Fortran.

C's model of arrays (like almost everything else in C) is tied much too closely to the "standard" computer hardware designs when it was invented. But at least the same people didn't make the same mistake twice when they invented Unix.
FactChecker
#22
Apr20-14, 02:09 PM
P: 278
Quote Quote by Mark44 View Post
I'm not sure what you're talking about. I didn't use arrays at all. You might be referring to the code that AlephZero wrote that I quoted in one post.
Sorry. You're right. It was AlephZero.


Register to reply

Related Discussions
Function defined as series Calculus 4
The action is not a well defined function Classical Physics 8
When y is defined as a function of x Calculus & Beyond Homework 3
Existence of a function vs being well-defined? Calculus 0
[tex] f(x) = x^x [/tex]Given this function, defined, let's say for General Math 9