Suggestion for displaying solutions as a column vector

Messages in english

Modérateur : xcasadmin

compsystems
Messages : 623
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Suggestion for displaying solutions as a column vector

Message par compsystems » lun. nov. 17, 2025 2:52 pm

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]])

parisse
Messages : 5933
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Suggestion for displaying solutions as a column vector

Message par parisse » mar. nov. 18, 2025 7:04 am

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

Message par compsystems » mar. nov. 18, 2025 2:09 pm

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.

parisse
Messages : 5933
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Suggestion for displaying solutions as a column vector

Message par parisse » mar. nov. 18, 2025 8:45 pm

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.

Répondre