tachim
Joined 19 years ago
Joined 19 years ago
If you also think this is the future of programming and are interested in building it, please consider joining us: https://jobs.ashbyhq.com/Harmonic. We have incredibly interesting challenges across the stack, from infra to AI to Lean.
Yes, the government funds research, the benefit of which accrues to all of society. There is no credible alternative to government funding for public research; the scales are not the same. Private funding of basic research (internal R&D budgets) accrues benefits to the funders directly.
Knock-on effects to cutting the government funding include a decimation of future research leadership by the US by making it unattractive to study and do basic research here. Other countries are taking advantage of this (like any private sector company would if one of its competitors makes such a drastic mistake).
> Lastly you are implying that your graduate research was something that advanced some combination of science, humanity, the country...or maybe that the current work you do is of such value that the government should have paid your way to your current status.
You're overly indexing on the benefits any specific researcher gets from research funding. Research is currently done by humans; if we want more research done, then the people doing that research will necessarily get some of the benefits.
Also, since you're commenting on a software-focused web forum -- you should be aware that the compensation for government-funded researchers is a fraction of what these folks could make in the private sector. Framing it as some greedy theft of resources from the public is foolish and disingenuous to readers who don't know about how science funding works in the US.
Write an efficient, not brute force, python program that solves the following problem: suppose we have two unknown quantities x and y. If three time x plus two times y is twenty, and 2 times x plus three time y is ten, what are x and y?
Output: To solve this problem efficiently, we can use linear algebra. We can represent the equations as a system of linear equations, and then use matrix operations to solve for the unknown quantities x and y.
First, we can represent the equations as follows:
3x + 2y = 20
2x + 3y = 10
Next, we can put the equations in matrix form:
| 3 2 | | x | | 20 |
| 2 3 | * | y | = | 10 |
To solve for x and y, we can use the inverse of the matrix on the left side to eliminate the coefficients. The inverse of a matrix is denoted as A^-1, and is calculated as follows:
A^-1 = (1/det(A)) * adj(A)
Where det(A) is the determinant of the matrix A, and adj(A) is the adjugate matrix of A. The determinant of a 2x2 matrix is calculated as follows:
det(A) = a * d - b * c
Where a, b, c, and d are the elements of the matrix A:
| a b |
| c d |
The adjugate matrix of a 2x2 matrix is calculated as follows:
adj(A) = | d -b |
| -c a |
We can then calculate the inverse of the matrix on the left side of the equations, and use it to solve for x and y:
| 3 2 |^-1 1 | 3 -2 |
| 2 3 | ----- * | -2 3 | = (1/5) * | 3 -2 | = | 3/5 -2/5 |
|-2 3 | |-2/5 3/5 |
| 3/5 -2/5 | | x | | 20 |
|-2/5 3/5 | * | y | = | 10 |
We can then solve for x and y by multiplying the inverse matrix with the vector on the right side of the equations:
| 3/5 -2/5 | | 20 |
|-2/5 3/5 | * | 10 | = | 6 |
| 7 |
Therefore, the values of x and y are 6 and 7, respectively.
Here is the complete Python program to solve this problem using linear algebra:
Calculate the determinant of a 2x2 matrix
def determinant(a, b, c, d):
return a * d - b * c
Calculate the adjugate matrix of a 2x2 matrix
def adjugate(a, b, c, d):
return [[d, -b], [-c, a]]
Calculate the inverse of a 2x2 matrix
def inverse(a, b, c, d):
det = determinant(a, b, c, d)
adj = adjugate(a, b, c, d)
return [[adj[0][0] / det, adj[0][1] / det], [adj[1][0] / det, adj[1][1] / det]]
Solve the system of linear equations
def solve(a, b, c, d, e, f):
inv = inverse(a, b, c, d)
return [inv[0][0] * e Write an efficient, not brute force, program that solves the following problem: suppose we have two unknown quantities x and y. If three time x plus two times y is twenty, and 2 times x plus three time y is ten, what are x and y?
Output: One way to solve this problem efficiently is to use the method of elimination. We can set up a system of equations as follows:
3x + 2y = 20
2x + 3y = 10
We can then multiply the first equation by 2 and the second equation by 3, to get:
6x + 4y = 40
6x + 9y = 30
We can then subtract the second equation from the first equation, to get:
-5y = 10
y = -2
We can then substitute this value of y into one of the original equations (for example, the first one), to get:
3x + 2(-2) = 20
3x - 4 = 20
3x = 24
x = 8
Therefore, the values of x and y are x = 8 and y = -2.