'Why does sage solve() return another equation(when it is clearly simple and solvable)
I am trying to solve a simple equation on sage with the given data:
a=var("a")
x=vector([1,1])
y=vector([2,3])
A=matrix(2,2,[a,-1,-1,1])
I want to solve the equation:
f= ((x*A*y)/((sqrt(x*A*x)*sqrt(y*A*y))))==1/2
which returns :
(2sqrt(a - 1)/sqrt(4a - 3) == (1/2)
solving f for a returns:
solve(f,a)
[sqrt(a - 1) == 1/4sqrt(4a - 3)]
while this equation is easily solvable by hand. Is there something I'm missing or doing wrong?
Solution 1:[1]
Sage is not implementing every possible way to search for a solution. In my way of using it, the combination of human (structural) insight and the computational power of the machine always works best.
Why do we have the half-way answer? In our case f is an equation,
sage: f
2*sqrt(a - 1)/sqrt(4*a - 3) == (1/2)
which is not really an algebraic equation. (Square roots appear in there.)
The documentation of solve, ask for it via solve? or ?solve or... , mentions this algebraic character wanted for the involved equations / expressions. Sage may try on its own to get an algebraic version, but this is too much a voluntary step, depending on the typed solve command line.
So it is a normal fact to get an "echo" of the equation.
Note however, that involving an other solver helps (in this case):
sage: solve(f, a, algorithm='sympy')
[a == (13/12)]
Solution 2:[2]
Js Fiddle Link check this out
hide all ids from localstorage
window.onload = function() {
allStorage().map(id => {
$("#"+id).hide();
})
}
Get get all ids in localstorage
function allStorage() {
var values = [],
keys = Object.keys(localStorage),
i = keys.length;
while ( i-- ) {
values.push( localStorage.getItem(keys[i]) );
}
return values;
}
Get id from class, hide the div and set an item in localstorage
$('.del').on('click', function(event) {
$("#"+this.id).hide();
window.localStorage.setItem("id"+this.id, this.id)
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | dan_fulea |
| Solution 2 | Can't Code |
