Page 1 sur 1

subst cmd: output

Publié : lun. nov. 12, 2018 11:18 pm
par compsystems
Hello, BP.

I think the subst command should throw a list with two substitutions

Code : Tout sélectionner

eq1:=2*abs(x)=6;

answer1:=solve(eq1,x,'=')  [enter] returns set[x=-3,x=3]

autosimplify(0):; answer1a:=list2exp([x=-3,x=3],x); [enter] returns ((x=-3) or (x=3))

subst(eq1, answer1 ) [enter] returns 6=6  => [6=6, 6=6]

Re: subst cmd: output

Publié : mar. nov. 13, 2018 2:01 pm
par parisse
subst does not map multiple substitutions, it would conflict with e.g. subst(x+y,[x=2,y=3])

Re: subst cmd: output

Publié : mar. nov. 13, 2018 6:18 pm
par compsystems
It is important to make a nested substitution to determine the exact or approximate value of the solution, without repeating the same instruction for each solution

solve(x^3-6*x^2+11*x=6,x, '=') => set[x=1,x=2,x=3]
subst(x^3-6*x^2+11*x=6,set[x=1,x=2,x=3]) => [6=6, 6=6, 6=6]

solve(1.1*x^2-65.4*x = 229.5,x,'=') => set[x = −3.32340211361,x = 62.7779475682]
subst(1.1*x^2-65.4*x = 229.5,set[x = −3.32340211361,x = 62.7779475682]) => [ 229.5 = 229.5, 229.500000003 = 229.5 ]

one could ask if the variable is repeated (left part of second arg) and then make multiple substitutions, otherwise a single substitution.

Re: subst cmd: output

Publié : mer. nov. 14, 2018 7:18 am
par parisse
That's precisely why there is a programming language. I already explained that to you, I will not implement myself everything that you would find convenient, I have my own priorities and limited time. If you think that it must be in the kernel itself, adapt the C++ code of subst (or convince someone to adapt it), Giac is an open-source project.

Re: subst cmd: output

Publié : mer. nov. 14, 2018 2:32 pm
par compsystems
Hello, BP

my post are only ideas or suggestions, not impositions, I will continue to report what I find and what I think should be added, for that is this forum.

Re: subst cmd: output

Publié : ven. nov. 16, 2018 7:28 am
par parisse
But you are reporting many times weierd commands, and it requires me usually more than 5 minutes to understand that it's garbage in. Cumulated, that's a lot of time lost : it does not help me improve Xcas, to the contrary. If you want your post to get more attention, you should select much more carefully your "recommandations" and try to make them more easily understandable.