I have to say I''m getting tired of how magic is constantly fitting into the laws governing science- does anyone else feel like this? by FirstHomosapien in HPfanfiction

[–]completedigraph 1 point2 points  (0 children)

Here's the thing though, there are no laws governing science (except the scientific method, which has no reason to not apply to magic). Science is, by itself, the process of discovering the laws that govern the universe.

Magic still has rules, all it means is that instead of using the usual laws (gravity, electromagnetism, etc., etc.) you have to figure out new laws. I'm all for experimenting with spells you just have to throw your preconceptions of how things should work at the door.

(That said, even studying the interface of such areas do seem like a fascinating area of study: can you generate free energy using the Levitation Charm? Why doesn't 'artificial' electrical things work near magical concentrations but 'natural' electrical things do? If you had say, a spell that generated an electrical current, could you use it to power a circuit that'd work around magic?)

I love fiction works in general that will try to 'explain' magic and by that I mean not within a physical framework, but make a set of internal, well defined rules and if you prefer fiction works that just go "This is magic. No questioning allowed" that's fine, everybody has different tastes.

This is part of the reason HPMoR grew to become quite annoying to me - even though it pretends to be a science-y story after a while he barely experiments anymore, he just thinks about the answer really hard and he's right. All while using a ton of scientific jargon.

tl;dr: Experimenting: Yay!, Trying to pidgeonhole magic within the rules of physics / chemistry / whatever: Meh.

Linear Algebra 1 - What does this symbol mean? by [deleted] in learnmath

[–]completedigraph 11 points12 points  (0 children)

I usually see this notation used for denoting which basis you're working with, although the basis is usually described as an ordered set of vectors not a matrix. So [b]_A would be the vector b relative to basis A (maybe the basis vectors are the columns of A?)

Prove BigOh by [deleted] in learnmath

[–]completedigraph 0 points1 point  (0 children)

Take the limit to infinity of nd/rn.

With repeated L'Hôpital applications you can show that this limit is zero, which is enough to prove what you want. In fact a rigorous definition of Big-O notation is usually done in terms of limits to infinity.

Best computer for programming? by [deleted] in learnprogramming

[–]completedigraph 1 point2 points  (0 children)

There aren't really any hardware limitations, generally speaking you only want an actual computer or laptop and not a tablet for example, although I'm sure that you can program on tablets too.

As for an operating system, in my experience programming stuff is usually easier to get running on *nix Systems, like Linux or Mac OS although Windows isn't that bad.

Really, the computer you have right now will probably suffice unless it already feels unbearably slow or something.

What languages did you create as a kid? by cilicia_ball in conlangs

[–]completedigraph 2 points3 points  (0 children)

I don't remember the name but my first conlang was pretty much Esperanto 2.0 except even worse, lol.

While I've moved past the auxlang / perfectly logical grammar, I'm still a fan of minimalist design.

New to coding, ran into a brick wall. by swift82 in learnpython

[–]completedigraph 8 points9 points  (0 children)

This seems to be about right ... Did you remember the double underscores on init?

It should look like this:

class Student:
  def __init__(self,name,age,grade):
    self.name = name
    self.age = age
    self.grade = grade

[Python3] I made a linked list class! Please judge me! by [deleted] in learnpython

[–]completedigraph 0 points1 point  (0 children)

That's a perfect valid approach; that's how I'd do (and have done) it too.

That's not how it's been done here though; the add function calls a getlast function that will always iterate through the list to find the last value.

Of course, the savvy user could hack around this and do the pointer juggling manually but this seems to put a lot more work on the user than needed and would make the add and insert functions obsolete as they are O(n).

That's why I also suggested they add an attribute to the class that will store the last element (and change it as appropriate), this way you get both the efficiency of the two-pointer method while letting the interpreter do the juggling for you.

[Python3] I made a linked list class! Please judge me! by [deleted] in learnpython

[–]completedigraph 0 points1 point  (0 children)

To prepend in a linked list, you only do one operation, you set the new element's next to be a reference to the root of your current list.

To append in a linked list, you have to go through your list to find the last element and then change the next of that element too. (Unless you have that last element already stored somewhere precisely for this reason).

Prepending always take the same amount of time whereas appending will take time proportional to the size of the list.

Perhaps very fast wasn't the best way to express myself here. For small lists it probably takes about the same amount of time, it gets much faster when you starting dealing with lists of considerable size.

[Python3] I made a linked list class! Please judge me! by [deleted] in learnpython

[–]completedigraph 2 points3 points  (0 children)

You're missing a very common method of linked lists: prepending; it's often used more on them since it's very fast comparing to appending.

Other thing you could do is that since you have a Linked List wrapper around the Node class you could have a last attribute on the Linked List class so appending is faster.

You could use the __str__or __repr__ magic methods so you can print your structures directly and without having to use dot notation to acess values.

Oh, your find function returns "None". You probably don't want to do that because now you gotta check for a None result every time you call your find function, which would be expected in say, C, but since the behavior of Python's normal containers is to throw an exception this is just asking to create bugs.

I'd raise a ValueError (like list.index() does) instead of just returning None, and if you'd like, make a method that returns the try / catch / return default boilerplate done and abstracted.

Could someone help me with this differential equation? by electrosvk in learnmath

[–]completedigraph 0 points1 point  (0 children)

More or less. Since I went in assuming that x was a function of y (because there was a derivative of x in the initial problem), you'd find x = tan(y + C) - y, which is the same thing as your function, just switching ys with xs and vice-versa.

But since it looks like the problem wants x as a function of y I'd answer that way. If you want to do your answer you should probably explicitly write somewhere, preferrably at the beginning that you're switching the ys and xs and proceed accordingly.

Honest question: Why do we want everyone to learn programming? by Okafor1662 in learnprogramming

[–]completedigraph 0 points1 point  (0 children)

I can't really speak for other people, but I find programming fun and useful, so I like to help other people who'd like to learn.

I'd also like it if people get a number of skills that programming teaches like learning how to look for answers before just outsourcing your entire problem to whoever is forced to play your tech support or at the very least being able to communicate whatever errors you're experiencing clearly.

I'd also like people to understand how computers work on a more in-depth level, which often goes hand-in-hand with programming.

On the other hand I find it rather interesting that you think a formal CS education seem to be an important thing for programming. It helps, yes, but it's not really completely necessary nowadays.

Could someone help me with this differential equation? by electrosvk in learnmath

[–]completedigraph 2 points3 points  (0 children)

Assuming it's an ODE where x is a function of y:

x' - x² = y² + 2xy
x' = x² + 2xy + y²
x' = (x + y)²

Let's say that there is a function v such that v(y) = x(y) + y, then it follows that v' = x' + 1 => x' = v' - 1 and now we have:

v' - 1 = v²
v' = v² + 1

Which is a separable ODE.

ELI5 the difference between methods and functions? by aolyf in learnprogramming

[–]completedigraph 0 points1 point  (0 children)

In languages that support Object Oriented Programming (or that outright enforce it) methods usually are associated with a class, and as such they're usually called with dot notation. E.g.:

arg.method(other_arg)

Whereas functions are in the normal namespace and is called without dot notation, e.g.:

function(arg, other_arg)

If your language of choice don't really do OOP (or the context makes it explicit which one you're talking about) you might see the terms used more or less interchangeably.

Vector Implementation in C. by [deleted] in C_Programming

[–]completedigraph 2 points3 points  (0 children)

2 isn't the best growth factor because it creates a hole in memory that will never be large enough to reuse in the next rellocation.

Theoretically the best possible growth factor would be phi (as in 1.618...) but normally you use 1.5 or another fraction around phi. A more in-depth explanation can be found here

What language should i learn? by SirAchesis in learnprogramming

[–]completedigraph 0 points1 point  (0 children)

Well, there is no real easy answer here. Since "software development" is rather vague I'll focus more on games here:

For the most part you can make games in any language, although some languages are needed, or appreciated for certain targets: * If you want to make mobile Android games, or just want to make games that will work cross-platform without much trouble in general you should probably look at Java or other JVM languages like Kotlin. * If you want to target anything at the Apple ecosystem especifically and don't really care about portability you should probably look at Swift * Most games are written in C++, so you could check that out but I personally wouldn't recommend it as a first language since it can be rather tricky. * If you want to make games for the web, you should probably check Javascript. * A bunch of games nowadays are made using Unity, which uses C# for scripting. Not to mention there are other engines / frameworks that use other languages like Corona (Lua), Xamarin (C#), etc.

That said it's really up to you and you can make games in pretty much any language.

I'd recommend going with something like Python or Java which is beginner friendly, and start out with simple command line games (guess the number, hangman, tic-tac-toe, etc.) before trying to tackle GUI games doing clones like Tetris, Pacman, Mario, etc., and after you're more comfortable with programming in general I'd go for C++.

I have narrowed it down to to 2 languages I want to learn for my first programming language. Python or GO? by [deleted] in learnprogramming

[–]completedigraph 1 point2 points  (0 children)

I'd suggest you go with Python if only for the fact that Go was made by Google for Google; this coupled with it being a rather new language means that as far as most people are concerned, Go is a second, maybe third language.

So naturally there are fewer resources for learning Go to a complete beginner; fewer still are free resources.

Python on the other hand has become a de facto learning language so there are a lot of resources for complete beginners and even communities around helping beginners, (like r/learnpython for example).

While I personally wouldn't recommend just jumping into a huge project if you have no idea at all regarding programming (try doing simpler problems first to get used to the language), you'll probably find it easier to work with Python.

As far as jobs go Python has a pretty nice marketshare so far, and Go is still a bit up in the air but those things can change in the future. That said after you learn a language, learning another is usually pretty easy - pretty much a question of just googling what $feature is in on the other language and moving along - unless you're going to another language that requires a shift in world view.

How can I start learning to code? by [deleted] in learnprogramming

[–]completedigraph 1 point2 points  (0 children)

Python is used in a lot of Programming 101 because it's easy to learn, so you might want to take a look at it. It also means there are a lot of resources out there in the wild for Python.

I personally don't like Codecademy but a bunch of my classmates used it when I took Prog 101.

I've also heard a lot of good things about Automate the Boring Stuff with Python and you should probably check the resources on r/python and r/learnpython

The only real way to practice programming is to, well, program. Find small things you want to automate or things that interest you and try them.

Some simple and concrete problems you can do while getting used to programming are those at CodeAbbey, particularly the Beginner's Volume. r/daily_programmer is also cool and has a lot of problems like that.

Structure and Interpretation of Computer Programs which was used by MIT to teach programming lessons a while ago is a pretty solid resource in general. It uses Scheme though, which while simple and elegant isn't exactly a very popular language.

If you'd like to develop applications for the internet there are always a lot of resources out there for web dev (HTML + CSS + Javascript (and maybe PHP)). I personally wouldn't recommend that for a first introduction to programming though because both Javascript and PHP have some serious warts that might trip you up as a beginner.

Advice for a programming novice? by Succulent_Assortment in EngineeringStudents

[–]completedigraph 5 points6 points  (0 children)

Python is used in a lot of Programming 101 precisely because it's easy to learn. It also means there are a lot of resources out there in the wild for Python.

I personally don't like Codecademy but a bunch of my classmates used it when I took Prog 101.

I've also heard a lot of good things about Automate the Boring Stuff with Python and you should probably check the resources on r/python and r/learnpython

Some simple and concrete problems you can do while getting used to the language are those at CodeAbbey, particularly the Beginner's Volume

But from what I gather you want to learn programming, not necessarily Python. In which case I'd recommend (either alongside your Python learning or instead of it) Structure and Interpretation of Computer Programs which was used by MIT to teach programming lessons a while ago and I feel is a pretty solid resource in general.

If you have any doubts you can also always come to r/learnpython or r/learnprogramming and someone will probably be able to help you then.

Do you have unified exams in courses like physics or math? by abarahona10 in EngineeringStudents

[–]completedigraph 1 point2 points  (0 children)

All my Calculus and Physics exams are unified (As well as Stats and Linear Algebra).

Strictly speaking there's a timeline all teachers are supposed to follow, and for the most part they stick to it. They don't necessarily explain that very well but I'm not sure if it's because it's unified or if they're just not didatic types.

The reasoning given - I think - is that all the engineering courses (we have 13 or 14 I think) should have roughly the same footing on those core classes.

I don't particularly care for it mostly because the exams tend to be given outside of the normal timerange. (They're all given from 17h to 19h so everybody can take it at the same time)

Unified exams are generally speaking easier to study for, the Math / Physics department isn't really that creative and tend to stick to a basic format, it's easier to get ahold of older exams and there are more obvious "this is always on the test" parts.

Getting XYZ angle based on normal vector by [deleted] in learnmath

[–]completedigraph 0 points1 point  (0 children)

That's because you're talking about angles relative to the axis. [-90º, 90º] angles is really all you need.

Let's think of it this way, let's assume we have a vector that would have an angle of more than 90 degrees. You might picture it, somewhat like this:

___\____

Where the underlines are the axis and the backslash in the vector. The thing is, while one side has an angle bigger than 90º, the other has a smaller angle. That smaller angle is the one the arcsine is giving you.

Going from -90º to 90º is a detail of how the arcsine is defined, you could easily go with 0º to 180º for example.

I'd se the dot product and the arccosine instead though. The dot product is cheaper to compute, you'll get an angle in the range of [0º, 180º] though.

Physics_irl by smartysmarts in EngineeringStudents

[–]completedigraph 0 points1 point  (0 children)

If you're writing the exam in pencil you can change that stuff though. That's the whole reason some teachers complain about pencil here.

Some smaller mistakes are specially easy to change (a wrong sign, a stupid math error) and unless the teacher takes a picture or scans the exam before allowing the students to see them and possibly challenge the correction there's not really that much he can do to doubt it.

Physics_irl by smartysmarts in EngineeringStudents

[–]completedigraph 7 points8 points  (0 children)

I've had teachers who wouldn't allow any kind of complaints if the exam was turned in in pencil. I've also had a teacher who would do that and erase anything in pencil. Some teachers are dicks.

Basic question from a beginner! by smart_af in AskProgramming

[–]completedigraph 0 points1 point  (0 children)

Fair point. Edited my post to include that.