59,107 reputation
6176266
bio website mathprogramming-intro.org
location St. Petersburg, Russia
age 38
visits member for 2 years, 9 months
seen 11 hours ago

Ok, an obligatory note: opinions expressed here are mine and not those of my employer.


Dec
27
awarded  Good Answer
Dec
27
revised Make mathematica treat $e_i^2$ as numeric
Changed to a more elaborate version that would print everything correctly
Dec
27
answered Make mathematica treat $e_i^2$ as numeric
Dec
25
answered Using MapThread on list of lists
Dec
25
reviewed Edit suggested edit on Symbolic computations with already assigned variables
Dec
25
revised Symbolic computations with already assigned variables
If all variables unfrozen just evaluate expression
Dec
25
comment Symbolic computations with already assigned variables
@swish You can, but it is much slower than getHeldSymbols (which is a very simplified version of depends, tracking only lexical dependencies),so it may matter for larger expressions / number of symbols.
Dec
25
comment Symbolic computations with already assigned variables
@swish I forgot to mention that I redefined getHeldSymbols, so you need to take and use the new version.
Dec
25
comment Symbolic computations with already assigned variables
@swish Well, evalWithSemiFrozenSyms just attempts to determine the symbols to be kept unfrozen automatically - if you have an explicit list, you can use evalWithFrozenSyms. But, if you used evalWithSemiFrozenSyms, did you mean that is does not work for you as written and you had to modify it?
Dec
25
comment Symbolic computations with already assigned variables
@swish Ok, agree, this is a tricky question. Back in the day, I've tried it all when I had similar needs, and it was pretty hard to come up with a general enough solution.
Dec
25
comment Symbolic computations with already assigned variables
@swish Re: SetDelayed - not necessarily. All that matters is that you define dependent variables before independent ones, see e.g. here.
Dec
25
comment Symbolic computations with already assigned variables
@swish I am afraid you lost me here.Having replacements depend on any particular ordering does not sound like a robust way. I edited my answer again, providing a sort of functionality I think you are after. A note for the future: try to formulate your question correctly the first time. Three edits is too much to address a single question.
Dec
25
revised Symbolic computations with already assigned variables
Added more advanced expansion functionality
Dec
25
comment Symbolic computations with already assigned variables
@swish Your request "E.g. c=d+e and I want to substitute this definition in my computation but if d or e also defined somehow don't evaluate them if I didn't say so" is ambiguous, since c is "defined somehow" having a value "d+e", but you want to expand it, while if d or e are "defined somehow", you want not to. You have to define what is meant by "defined somehow". The only clear way I see here is to say that they are defined if they have been assigned purely numerical values.
Dec
25
comment Symbolic computations with already assigned variables
@swish See my other edit :)
Dec
25
revised Symbolic computations with already assigned variables
Modified to enable selective evaluation, per OP's request
Dec
25
comment Symbolic computations with already assigned variables
@RolfMertig HoldForm is often invisible, when you forget about it, and can confuse. Besides, I have this as an option - the evalWithFrozenSym function accepts the wrapper head as a second optional argument.
Dec
25
comment Symbolic computations with already assigned variables
@swish See my edit
Dec
25
revised Symbolic computations with already assigned variables
Added automation
Dec
25
answered Symbolic computations with already assigned variables