Description
Octave Version: 10.1.0
Symbolic Package version: 3.2.1
Issue:
Solving some equations in this format: 1/kx^n-C==0 by using solve
, where k is an positive integer except 1, n is a positive real number except 1 and C is an integers, may return {}(0x0)
as if it is not solvable, while it is expected to return the nth root of (Ck).
For example:
>> syms x
>> solve(sym(1)/2*x^2-1==0)
ans = {}(0x0)
The equation remains returning 0x0 unexpectedly as far as the coefficient of x^n can be simplified to the form of 1/k, so in this example, rewriting it to sym(2)/4 or 1/sym(2) or sym(1)/sym(2) won't make a difference. Oppositely, if multiply the whole equation such that the coefficient of x^n can no longer be simplified to the form of 1/k, using solve
will return the correct results:
>> solve(3/2*(sym(1)/2*x^2-1)==0)
warning: passing floating-point values to sym is dangerous, see "help sym"
warning: called from
double_to_sym_heuristic at line 50 column 7
sym at line 384 column 11
mtimes at line 54 column 3
ans = (sym 2x1 matrix)
[ ___]
[-\/ 2 ]
[ ]
[ ___ ]
[\/ 2 ]
And weirdly, removing the ==0
also return the correct results:
>> solve(sym(1)/2*x^2-1)
ans = (sym 2x1 matrix)
[ ___]
[-\/ 2 ]
[ ]
[ ___ ]
[\/ 2 ]
Or rewriting the command to solve(f1,0):
>> solve(sym(1)/2*x^2-1,0)
ans = (sym 2x1 matrix)
[ ___]
[-\/ 2 ]
[ ]
[ ___ ]
[\/ 2 ]
But some solve(f1,f2) will weirdly return 0x0 also:
>> solve(sym(1)/2*x^2-1,2*x)
ans = {}(0x0)
which is actually solvable:
>> solve(sym(1)/2*x^2-2*x-1==0)
ans = (sym 2x1 matrix)
[ ___]
[2 - \/ 6 ]
[ ]
[ ___]
[2 + \/ 6 ]