Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
akadajet
Sep 14, 2003

Subjunctive posted:

Perl can be 1-based indexing, but, you know, it’s up to you

same with visual basic

Adbot
ADBOT LOVES YOU

Athas
Aug 6, 2007

fuck that joker

VikingofRock posted:

Clearly the solution is to use Haskell's Arrays, where you decide at construction time how to index the arrays. You can do 0-indexed, 1-indexed, 2-indexed, or even tuple-indexed (great for mapping 2D matrices onto contiguous memory)!

Those are in practice row major, because they inherit the lexicographical ordering of tuples. They also don't support things like slices.

Haskell has some decent array libraries, but Data.Array feels like it was designed by someone who had never actually written an array program.

Nomnom Cookie
Aug 30, 2009



array program, you mean blas bindings?

Arcteryx Anarchist
Sep 15, 2007

Fun Shoe

Nomnom Cookie posted:

array program, you mean blas bindings?

FlapYoJacks
Feb 12, 2009
Python: Good
Rust: Good
Python + Rust: Great

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

VikingofRock posted:

Clearly the solution is to use Haskell's Arrays, where you decide at construction time how to index the arrays. You can do 0-indexed, 1-indexed, 2-indexed, or even tuple-indexed (great for mapping 2D matrices onto contiguous memory)!

this.

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

Arcteryx Anarchist posted:

keep that poo poo in wisconsin

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

Nomnom Cookie posted:

array program, you mean APL?

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Nomnom Cookie posted:

array program, you mean K?

mystes
May 31, 2006

Nomnom Cookie posted:

array program, you mean go gently caress myself?

Tayter Swift
Nov 18, 2002

Pillbug

prisoner of waffles posted:

many are the crimes of matlab, including cells (vectors, matrices, or tensors of pointers) and “every N-dimensional matrix is also a column-vector.” MATLAB OOP also seems totally gross.

However, their datatable implementation and interface is actually pretty good; I’d be very happy to have it instead of the pandas equivalent— assuming the MATLAB table was reimplemented in Python.

never messed with polars yet but it looked very pandas-ish.

polars fuckin' slaps

prisoner of waffles
May 8, 2007

Ah! well a-day! what evil looks
Had I from old and young!
Instead of the cross, the fishmech
About my neck was hung.

Tayter Swift posted:

polars fuckin' slaps

maybe MATLAB broke my brain, but I really like writing my matrix manipulations as functions and operators, not methods on matrix objects— and I presume polars is like pandas: functions and methods

Arcteryx Anarchist
Sep 15, 2007

Fun Shoe
i think the trouble is that dataframe != matrix

Arcteryx Anarchist
Sep 15, 2007

Fun Shoe
if you just want linalg use numpy/scipy

prisoner of waffles
May 8, 2007

Ah! well a-day! what evil looks
Had I from old and young!
Instead of the cross, the fishmech
About my neck was hung.
apropos of chat about MATLAB, Julia, etc., I am just now reading Nick Trefethen's "An Applied Mathematician's Apology" and getting some vibes. The author is the head of the Numerical Analysis Group at Oxford.

Roughly speaking, what gets called applied mathematics or numerical analysis is *actually computing* answers to problems with *continuous* numbers or *continuous* structures; CS is *actually computing* but almost entirely *discrete structures*; mathematics at large is almost entirely *proving-but-not-computing* with continuous and/or discrete structures. My general vibe: applied mathematics is not as prestigious as either mathematics or CS.

One thing that he points out is that many applied mathematicians take their work in the field towards the proving-but-not-computing territory, e.g., Chebyshev points aren't optimal for approximating a function, proving which points *are* optimal is a neat paper to write, but at the practical computational level the optimal points are largely not enough of an improvement to bother with.

The (rather MATLAB-like) language chebfun, which I had never heard of before, grew out of his research group and seems interesting.

Uhhh, to get back on topic: maybe MATLAB etc. are weird because

  • they are tools made for actually doing numerical computations in support of engineering or scientific problems;
  • the people who are best qualified to make these tools well are applied mathematicians of a certain mindset;
  • apparently this mindset is rarer in applied mathematicians than you might think (because of "envy towards pure math"?)

so no wonder that MATLAB, Julia etc. are so janky.

prisoner of waffles
May 8, 2007

Ah! well a-day! what evil looks
Had I from old and young!
Instead of the cross, the fishmech
About my neck was hung.

Arcteryx Anarchist posted:

i think the trouble is that dataframe != matrix

hmm. sorry, I would still like to manipulate both my dataframes and my matrices with operators and functions, not functions and methods.

it's purely a stylistic thing, but it just feels super gross to me when a manipulation that feels akin to some tidy mathematical operation (project full dataframe down to these columns, apply this function to them, aggregate) is done as dataFrame[:, columns].apply(f).aggregate(g) instead of g(f(dataFrame[:, columns])).

prisoner of waffles fucked around with this message at 05:11 on Jan 20, 2024

Arcteryx Anarchist
Sep 15, 2007

Fun Shoe
my coworker that left not too long ago was an applied math/numerical analysis guy and my favorite thing was finding an old photo of him on a university website just because he was so much younger in it that it was funny

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

prisoner of waffles posted:

hmm. sorry, I would still like to manipulate both my dataframes and my matrices with operators and functions, not functions and methods.

it's purely a stylistic thing, but it just feels super gross to me when a manipulation that feels akin to some tidy mathematical operation (project full dataframe down to these columns, apply this function to them, aggregate) is done as dataFrame[:, columns].apply(f).aggregate(g) instead of g(f(dataFrame[:, columns])).

sorry too hear that

Visions of Valerie
Jun 18, 2023

Come this autumn, we'll be miles away...

prisoner of waffles posted:

Uhhh, to get back on topic: maybe MATLAB etc. are weird because

  • they are tools made for actually doing numerical computations in support of engineering or scientific problems;
  • the people who are best qualified to make these tools well are applied mathematicians of a certain mindset;
  • apparently this mindset is rarer in applied mathematicians than you might think (because of "envy towards pure math"?)

so no wonder that MATLAB, Julia etc. are so janky.

So maybe I'm misunderstanding what you're saying, but: I don't think that applied mathematicians make the best PL designers or compiler devs. I think people who have experience in those fields do. It's important to note that being good and well-designed aren't really related to adoption and usage - just look at the popularity of javascript if you need an example how not.

Bloody
Mar 3, 2013

JawnV6 posted:

having a hard time reading the python complaints from a few pages back as someone who used to get paid to maintain perl written by EE's

"oooh my modules took me an hour to sort out file paths"

there were functions with no call sites, they'd just bodge up the name on the spot and eval() it. you'd weep

we do this a lot and call it reflection

Bloody
Mar 3, 2013

(it’s rly fuckin bad lol)

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
i don’t think anyone who’s done much numerical analysis thinks programming languages have much to offer the situation. my understanding is that general techniques for tracking precision through computation trees tend to wildly underestimate it: after a million operations, the supposed imprecision accumulates until the error bars are orders of magnitude larger than the result, when actually the computation is more stable than the general technique gives it credit for. even getting a real handle on the distribution of the result of computation requires human intelligence

prisoner of waffles
May 8, 2007

Ah! well a-day! what evil looks
Had I from old and young!
Instead of the cross, the fishmech
About my neck was hung.

Visions of Valerie posted:

So maybe I'm misunderstanding what you're saying, but: I don't think that applied mathematicians make the best PL designers or compiler devs. I think people who have experience in those fields do. It's important to note that being good and well-designed aren't really related to adoption and usage - just look at the popularity of javascript if you need an example how not.

I think there are two opposing factors:
- as you say, applied mathematicians are mostly not going to be PL designers or compiler devs;
- applied mathematicians want to make tools that are good for their distinct classes of problems.

The first causes jankiness in languages like MATLAB, at the implementation and (let's call it) specification level.
The second causes a generally good fit between MATLAB and the class of problems at which it is aimed.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



rjmccall posted:

i don’t think anyone who’s done much numerical analysis thinks programming languages have much to offer the situation. my understanding is that general techniques for tracking precision through computation trees tend to wildly underestimate it: after a million operations, the supposed imprecision accumulates until the error bars are orders of magnitude larger than the result, when actually the computation is more stable than the general technique gives it credit for. even getting a real handle on the distribution of the result of computation requires human intelligence

it would be nice if you could go like #significant_digits 2 and then its all taken care of for you all through the program

plus, people would use it even more for money and i love seeing the weird things that happen in that space (except for one thousand innocent people going to jail, but you know)

Carthag Tuek fucked around with this message at 12:05 on Jan 20, 2024

Athas
Aug 6, 2007

fuck that joker

Carthag Tuek posted:

it would be nice if you could go like #significant_digits 2 and then its all taken care of for you all through the program

How would that avoid roundoff error? It just makes it a different roundoff error.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Athas posted:

How would that avoid roundoff error? It just makes it a different roundoff error.

its called "punting the problem"

sorry boss, we only have two digits

Grum
May 7, 2007

prisoner of waffles posted:

apropos of chat about MATLAB, Julia, etc., I am just now reading Nick Trefethen's "An Applied Mathematician's Apology" and getting some vibes. The author is the head of the Numerical Analysis Group at Oxford.
✂✂✂

I've never read that of his but I have read his book Approximation Theory and Approximation Practice and I cannot recommend it enough to anyone with a vague interest in how to deal with continuous functions, computationally. the guys enthusiasm for the subject comes through incredibly well, the style is conversational, its easy to sit down and implement your own toy chebfun after, going between function samples and chebyshev polynomial coefficients feels like magic, just a really good book, love it. lecture videos on his website i think somewhere aswell

prisoner of waffles
May 8, 2007

Ah! well a-day! what evil looks
Had I from old and young!
Instead of the cross, the fishmech
About my neck was hung.
Later on in his “Apology of an Applied Mathematician”, he tells how he met both the founders of Mathworks, placed an order for 10 copies of the first version of MATLAB, and was in fact the first person to purchase MATLAB. Mathworks later gave him a plaque celebrating this.

chatt
Aug 16, 2003

Oven Wrangler
as an experimental physicist, i unironically love matlab. it is great at doing stuff with arrays of numbers, which is 90% of all my coding, and the plotting beats anything else (you can copy and paste curves from one figure to another, which is insanely useful). now though everything is switching to python with numpy, and i can't shake the feeling that it's all just knockoff matlab, where the numerical array stuff is clearly an addon as opposed to the core aspect of the language. like you have to wrap everything in np.array() to let the language know that you might like to do some math with these numbers. for anything *not* array and matrix math then for sure python wins, but that kind of coding is genuinely rare for a lot of sciency type people

my latest love is julia though, which really clearly *gets* numerical processing (absolutely any function can be broadcasted a set of arrays by adding a dot!), and actually runs fast to boot. i'm not too optimistic about there about enough momentum behind it to ever really go anywhere though,

Arcteryx Anarchist
Sep 15, 2007

Fun Shoe
python has “enough” scientific support and a huge library so its momentum is strong

Quebec Bagnet
Apr 28, 2009

mess with the honk
you get the bonk
Lipstick Apathy

chatt posted:

as an experimental physicist, i unironically love matlab. it is great at doing stuff with arrays of numbers, which is 90% of all my coding, and the plotting beats anything else (you can copy and paste curves from one figure to another, which is insanely useful). now though everything is switching to python with numpy, and i can't shake the feeling that it's all just knockoff matlab, where the numerical array stuff is clearly an addon as opposed to the core aspect of the language. like you have to wrap everything in np.array() to let the language know that you might like to do some math with these numbers. for anything *not* array and matrix math then for sure python wins, but that kind of coding is genuinely rare for a lot of sciency type people

you don't "let the language know" - python is a general-purpose programming language, it only has primitives like integers, floats, strings, lists, etc. numpy has done a lot of work to make it possible to write python that feels like matlab or R, but a numpy array is just an object from python's point of view, one that so happens to define a special behavior for "what happens when you write array1 * array2"

fundamentally it's just built on the facilities that python makes available for any type of object - if you felt deranged enough, you could define what happens when you divide an HTTP request by a datetime or w/e.

Nomnom Cookie
Aug 30, 2009



numpy is the fortran monad implemented for Python and it’s much more elegant in haskell where you also get free concurrency and a dot product operator

b0lt
Apr 29, 2005

Quebec Bagnet posted:

if you felt deranged enough, you could define what happens when you divide an HTTP request by a datetime or w/e.

https://en.cppreference.com/w/cpp/filesystem/path/operator_slash

Quebec Bagnet
Apr 28, 2009

mess with the honk
you get the bonk
Lipstick Apathy

neat, python's pathlib works the same way

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?
why wouldn’t you just port Common Lisp’s pathname system

it even works with MIT-style versioning filesystems including XNS, Lisp Machine, and VMS filesystems

eschaton fucked around with this message at 09:16 on Jan 21, 2024

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

Nomnom Cookie posted:

numpy is the fortran monad implemented for Python and it’s much more elegant in haskell where you also get free concurrency and a dot product operator

of course it is, its haskell

Athas
Aug 6, 2007

fuck that joker

Nomnom Cookie posted:

numpy is the fortran monad implemented for Python and it’s much more elegant in haskell where you also get free concurrency and a dot product operator

It is easy to heat up all your cores with Haskell and get the right result, but it is harder to make it fast.

Nomnom Cookie
Aug 30, 2009



I was trying to be ridiculous but I guess I undershot

mystes
May 31, 2006

Nomnom Cookie posted:

I was trying to be ridiculous but I guess I undershot
Humor is a side effect so you can't do it with haskell

Adbot
ADBOT LOVES YOU

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

Athas posted:

It is easy to heat up all your cores with Haskell and get the right result, but it is harder to make it fast.

its only 2-3x slower than rust. good enough for me!

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply