58,937 reputation
6175266
bio website mathprogramming-intro.org
location St. Petersburg, Russia
age 38
visits member for 2 years, 9 months
seen 11 mins ago

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


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
Dec
25
comment Once more on object orientation in Mathematica: does it have to be so hard?
@OleksandrR. So, I am very much looking for feedback on this, particularly from you. On my side, I will make sure that this stuff is more accessible and easier to start playing with, as well as using for more serious things.
Dec
25
comment Once more on object orientation in Mathematica: does it have to be so hard?
@OleksandrR. As for the usefullness of OO in Mathematica, I used to think the same way (that it is not that useful), but then we usually use Mathematica for problems with high degree of algorithmic content. But some problems are not like that, but much more ad hoc. In particular, the problem that prompted me to start with this OO stuff was the version control system for Mathematica projects based on Github gists, which I am currently working on in my free time. It became much more tractable after I started using there the OO extension I described in my answer.
Dec
25
comment Once more on object orientation in Mathematica: does it have to be so hard?
@OleksandrR. Well, thanks :). I just felt that I finally found an answer to some of my problems when developing larger apps in Mathematica, and since I tested it already on a couple of real use cases, I wanted to share it. I might have done it a bit prematurely, perhaps should have tested it more. Time will tell, but so far I think this stuff can really help for certain tasks (it helped me, at least). And I wanted the feedback from the community as well (I already got a bunch of good suggestions and plenty of food for thought). I will soon document this much better, add more expamples etc.