subst cmd: output

Messages in english

Modérateur : xcasadmin

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

subst cmd: output

Message par compsystems » lun. nov. 12, 2018 11:18 pm

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]

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

Re: subst cmd: output

Message par parisse » mar. nov. 13, 2018 2:01 pm

subst does not map multiple substitutions, it would conflict with e.g. subst(x+y,[x=2,y=3])

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

Re: subst cmd: output

Message par compsystems » mar. nov. 13, 2018 6:18 pm

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.

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

Re: subst cmd: output

Message par parisse » mer. nov. 14, 2018 7:18 am

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.

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

Re: subst cmd: output

Message par compsystems » mer. nov. 14, 2018 2:32 pm

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.

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

Re: subst cmd: output

Message par parisse » ven. nov. 16, 2018 7:28 am

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.

Répondre