Yeah, this took me a while to really wrap my head around when I first started CL, because there are really no native calculations you can do like in a typical programming language. Everything has to be done through evaluations of latex strings.
So, the simple way to multiply by -1 would be something like:
a = 5
b = numericValue("-1(${a})")
To get properly formatted latex, the easiest way is to type exactly what you want in a desmos graph, copy it, and then paste it into CL. It will paste as proper latex. Eventually, you will get used to the most common latex syntaxes and will be able to just type them in more quickly.
Using numericValue like this does have some downsides, and will have trouble with things like scientific notation, because it will see the ‘e’ and turn it into 2.71… There are some other issues as well. So it’s fine for simple operations with expected inputs. But it’s pretty handy to use the simpleFunction approach, where you take the function that you want and create a function object which you can then reuse with different parameters. This avoids a lot of the numericValue issues because of the way it’s handled behind the scenes. So for multiplying by -1, you could do:
a = 5
fProduct = simpleFunction("x(y)", "x", "y")
b = fProduct.evaluateAt(a, -1)
c = fProduct.evaluateAt(a, 3)
In this approach, you still use a latex string to define the function, and you can use as many parameters as you need - in this case, I just used x and y, but you can use other letters as well. Then you can call the function as many times as you need using whatever parameter values you want.
I hope this makes sense. Here are some examples of both usages.