Hi, when solving a system, if the variables are specified as a column vector (n*1 matrix), display the output in the same way to avoid having to perform a transposition.
solve(
[[(3*α1+α2+2*α3) = 0],
[(-α1-α2) = 0],[(-5*α1-3*α2-2*α3) = 0],
[(9*α1+3*α2+6*α3) = 0]],
[α1,α2,α3],
'=')
=>
set[[α1 = -α3, α2 = α3, α3 = α3]]
transpose(
solve(
[[(3*α1+α2+2*α3) = 0],
[(-α1-α2) = 0],[(-5*α1-3*α2-2*α3) = 0],
[(9*α1+3*α2+6*α3) = 0]],
[α1,α2,α3],
'='))
=>
[[α1 = -α3],
[α2 = α3],
[α3 = α3]]
solve(
[[(3*α1+α2+2*α3) = 0],
[(-α1-α2) = 0],[(-5*α1-3*α2-2*α3) = 0],
[(9*α1+3*α2+6*α3) = 0]],
[[α1],
[α2],
[α3]]
'=')
=>
[[α1 = -α3],
[α2 = α3],
[α3 = α3]]
Another option would be to display the answer as a vector expression if it finds a parameter.
[[α1],
[α2],
[α3]]
=
α3* ([[-1],
[1],
[1]])
Suggestion for displaying solutions as a column vector
Modérateur : xcasadmin
-
compsystems
- Messages : 623
- Inscription : sam. févr. 04, 2017 11:34 pm
- Localisation : Colombia
- Contact :
Re: Suggestion for displaying solutions as a column vector
I don't think it's a good idea to change the format of the answer, think of someone who is using solve in a program.
-
compsystems
- Messages : 623
- Inscription : sam. févr. 04, 2017 11:34 pm
- Localisation : Colombia
- Contact :
Re: Suggestion for displaying solutions as a column vector
Another option to avoid using nested function commands f(f(f()) is to accept the desired output as an argument.
solve(expression, var, 'expand')
For example, expands the output.
solve(expression, var, 'simplify')
Simplifies the output.
solve(expression, var, 'transpose')
Transposes the output.
solve(expression, var, 'parametric')
Rewrites the output based on a parameter, if one exists.
solve(expression, var, 'expand')
For example, expands the output.
solve(expression, var, 'simplify')
Simplifies the output.
solve(expression, var, 'transpose')
Transposes the output.
solve(expression, var, 'parametric')
Rewrites the output based on a parameter, if one exists.
Re: Suggestion for displaying solutions as a column vector
I don't see why you think it's simpler to have some optional arguments to solve. For me it's the contrary, it's better to have a universal way to rewrite the result of a command by nesting the command inside a rewriting command.