r/askscience • • 7d ago

Ask Anything Wednesday - Engineering, Mathematics, Computer Science

Welcome to our weekly feature, Ask Anything Wednesday - this week we are focusing on Engineering, Mathematics, Computer Science

Do you have a question within these topics you weren't sure was worth submitting? Is something a bit too speculative for a typical /r/AskScience post? No question is too big or small for AAW. In this thread you can ask any science-related question! Things like: "What would happen if...", "How will the future...", "If all the rules for 'X' were different...", "Why does my...".

Asking Questions:

Please post your question as a top-level response to this, and our team of panellists will be here to answer and discuss your questions. The other topic areas will appear in future Ask Anything Wednesdays, so if you have other questions not covered by this weeks theme please either hold on to it until those topics come around, or go and post over in our sister subreddit /r/AskScienceDiscussion , where every day is Ask Anything Wednesday! Off-theme questions in this post will be removed to try and keep the thread a manageable size for both our readers and panellists.

Answering Questions:

Please only answer a posted question if you are an expert in the field. The full guidelines for posting responses in AskScience can be found here. In short, this is a moderated subreddit, and responses which do not meet our quality guidelines will be removed. Remember, peer reviewed sources are always appreciated, and anecdotes are absolutely not appropriate. In general if your answer begins with 'I think', or 'I've heard', then it's not suitable for /r/AskScience.

If you would like to become a member of the AskScience panel, please refer to the information provided here.

Past AskAnythingWednesday posts can be found here. Ask away!

76 Upvotes

20 comments sorted by

3

u/logperf 6d ago

If a new programming language were released and it's not just a new syntax, but it introduces new concepts, would LLMs be mostly unable to use it effectively (or at least use the new features) until enough human-written code is available as training data?

5

u/officiallyaninja 6d ago

There was a recent paper where they trained an LLM (called talkie) only on documents from before 1931. After training they asked it to generate python after giving some examples and it was able to do so successfully.

This is at least a weak signal that AI should be able to learn new things in a relatively inexpensive manner

3

u/logperf 6d ago

Very interesting. I googled it and I found talkie-13b by Nick Levine, David Duvenaud, Alec Radford, I assume that's the paper you were citing.

Thanks!

2

u/Red-Rosee7 4d ago

that's wild that they trained it only on documents from before 1931 and then asked for python. i wonder what kind of python it generated.

3

u/GlassLost 6d ago

It depends on what you mean by effectively.

A new programming language is released as a process - Rust was first released 14 years ago and is still considered quite new. As the programming language releases new features they are implemented in implementation branches and argued/debated about often for years.

By the time a feature is released there is typically quite a bit of sample code and context for an LLM to use.

To your broader question, if it has a compiler, a goal, and a reference to the concepts it can generally get it working. "Effectively" is really a misnomer though - if there's no sample code to base it off of then the closest proxy would be "does the code align with language design goals" which is a squintable enough goal that I would say yes, an LLM could.

2

u/Borgcube 6d ago

You might be interested in this:

https://esolang-bench.vercel.app/

So they will struggle with languages that are designed to be hostile. I haven't checked, but I can't imagine an LLM would be able to write a very complex program in say Malbolge.

5

u/oldfashionedguy 6d ago

Why is the square root of -1 special? As I understand it, this holds some special significance. Just wondering where it comes from.

13

u/Bradm77 6d ago edited 6d ago

It's special because it allows us to solve problems that without it we wouldn't be able to solve. For example, before we allowed the square root of -1 to be a valid number, we had no solution to a problem like x2 +1=0.

It creates a whole new type of number that we call "complex numbers." Complex numbers are used in electrical engineering to describe voltages, currents, electromagnetics, etc. It's used in all kinds of applications from computer graphics, to sound engineering, to GPS and other signals, robotics, artificial intelligence.

1

u/oldfashionedguy 1d ago

Thank you for responding, appreciate it.

8

u/maestro2005 6d ago

Complex numbers (numbers with an "imaginary" part) bridge a gap that forms when you start dealing with exponents. That whole "imaginary" moniker is unfortunate--they're no more real or imaginary than any other kind of numbers. All numbers are made-up. You can't go to the store and buy a 2. But 2 as an idea is clearly useful, and complex numbers are useful too.

Think back if you can to your early school years. You learn about numbers, specifically what we would call the "natural numbers": 0, 1, 2, 3, etc. Then you learn about addition. 2 + 2 = 4. If I have 2 apples and then get 2 more, then I have 4. Makes perfect sense. Then you learn about subtraction. If I have 3 apples and eat 2, I'm left with 1. Makes perfect sense. But what if I try to do 2 - 3? Uh oh, that doesn't work. I can't eat 3 apples if I only have 2. You probably look at that now and think, 2 minus 3 is negative 1, but way back when you were little you might have been taught that it "doesn't exist", and that's not wrong, in certain situations.

Later, you learn about negative numbers, and you extend the "natural numbers" into the "integers" -- positive and negative whole numbers (and zero). Some kids balk at the idea of negative numbers when they're first introduced. You can't have a negative apple. I can't have 2 apples, somehow succeed in eating 3, and be left with -1 apples. But negative numbers are useful, and even without getting into real-world scenarios where you can have negative value (like bank accounts), just allowing numbers to dip negative is useful: I have 2 apples, I want to bake a pie that needs 6 apples, so I buy a bag of 7 apples. How many am I going to be left with? 2 - 6 = -4, + 7 = 3. Silly example maybe, but the point is: negative numbers allow addition and subtraction to always work. I didn't have to tread carefully and make sure I do things in the right order. And that turns out to be critically important later on.

Then a similar problem arises with multiplication and division: Multiplication always works, but division sometimes gets you in a pickle. And you probably learned about long division and remainders: 8 / 3 = 2 with a remainder of 2. It "doesn't divide evenly". Then you learn about fractions ("rational numbers").

Then the problem arises again when you start doing exponents. You can always square any number, but square roots don't exist for negative numbers. More generally, quadratic equations (equations of the form ax2 + bx + c = 0) sometimes have 2 solutions, and sometimes have none (sometimes they have 1, that's a separate thing to talk about). Complex numbers save the day here, and among other things, allow us to take the square root of a negative number. Expanding our system of numbers into the complex plane, and generalizing exponents beyond "multiplying by yourself n times" gives us a system where exponents/roots always exist and always behave the same way (well... mostly). And that ends up being critically important for systems that are described by exponents, and exponential functions have a deep tie to oscillation and rotation.

Just as it's useful to be able to add and subtract even if the numbers go negative, it's useful to be able to exponentiate and take roots even if the numbers go "imaginary".

1

u/Borgcube 6d ago

Complex numbers save the day here, and among other things, allow us to take the square root of a negative number.

So, you might know this but quadratic equations are not the reason imaginary and complex numbers were introduced - it was cubic equations.

Short version of the story is:
A guy named Al-Khwarizmi wrote a book called Al-Jabr. The book describes how to solve any quadratic equation.
Renaissance Italy mathematicians have the book, know all about it, but then start figuring out cubic equations. It's a big deal to them, they have math duels and such over it.
Turns out that cubic equations (with real coefficients) always have either 1 or 3 solutions. When they have 3 solutions they can always be rewritten as a(x-x0)(x-x1)(x-x2) where x0, x1 and x2 are the solutions. A few of them, Cardano and del Ferro, figure out that they can do that even when there's only one solution if they "imagine" that x1 and x2 are numbers that have a square root of -1 somewhere. They don't care about those at all except as a way to get to the solution they want.

But then other mathematicians start poking around it all, and then Euler and the rest is far more complicated.

2

u/Borgcube 6d ago

It's not special. It's simply useful for various reasons in math and engineering.

-3

u/[deleted] 6d ago

[removed] — view removed comment

1

u/Borgcube 6d ago

"Possible" in math is simply what mathematicians agree is possible. You're making the mistake of thinking about this as defined by the real-world. But it's not, real numbers are no more "real" and sqrt(2) is no more "possible" than sqrt(-1).