9,476 reputation
1642
bio website
location
age
visits member for 2 years, 6 months
seen Jul 17 at 21:28

Jul
15
comment Controlling quality of discretized region meshes
good to see you back alive, user21 :-). Is it possible to refine the grid only near the edge, in one way or another?
Jul
6
comment Why are functions called first-class objects in Mathematica?
@Eric: one more remark about 3=9: for a term rewriting system this might not be that meaningless at all, e.g. it would work perfectly well in a local replace rule: (a+3) /. {3->9}. As far as I understand, the only reason why defining such a rule globally with Set wouldn't work is that Mathematica demands a global replace rule to be attached to a symbol, which in this case isn't possible as the LHS is just an atomic integer ...
Jul
6
comment Why are functions called first-class objects in Mathematica?
@Eric: as has been explained the "miracle" of Set is that it has the HoldFirst attribute. This will make Set see the unevaluated LHS. What the code within Set does with that unev. LHS is up to the programmers at WRI who wrote that code. Obviously it does analyze that LHS-expr. and for some special cases does "the right thing". There is nothing to be understood at the language level here, it really is just an implementation detail which even could change between versions. Unfortunately the documentation of what such functions actually implement is often somewhat vague or incomplete...
Jul
5
comment Why are functions called first-class objects in Mathematica?
I think the statement "{g,h,j}[[1]] = 6 can never work" is not correct. As Set has HoldFirst it would very well be able to extract the (held) symbol g and change its OwnValues, just as it is able to do in something like {g,h}={1,2}. Unlike the latter the former has not been implemented, probably for good reasons, probably just because nobody at WRI bothered about that specific case...
Jul
4
comment Why are functions called first-class objects in Mathematica?
I think that this statement might have had in mind "pure functions" like (#^2)& or Function[x,(1+x)^3]. These quite obviously are normal expressions and functions. "function definitions" like f[x_]:=... in Mathematica are actually definitions for global rewrite rules (as others have explained in more detail) which just happen to have an intuitive interpretation as functions but conceptually are not different from rules which e.g. define variable values.
May
28
comment Cell with no form using NotebookWrite
yes, my porposal was that you explain in your answer what exactly it is that you refer to with "text cell". I guess you call a "text cell" one that has a string or TextData as content as opposed to an expression cell which has BoxData as content, which -- as you mentioned -- hasn't anything to do with its style, which can be "Text" or not. It probably also is worth mentioning that some functions (e.g. CellPrint and NotebookWrite) expect low level Cell expression as arguments while others (like CreateDocument) accept higher level stuff like TextCell...
May
27
comment Cell with no form using NotebookWrite
There is a difference between a Cell with no assigned style as the OP wants (for what reason?) and a "Text" cell, which you might make clearer in your answer. You can easily see that with NotebookWrite[nb,Cell["test"]] vs. NotebookWrite[nb,Cell["test","Text"]]. What these two cases look like depends on the active stylesheet, of course...
May
18
comment PDE combined with ODE 1D
After applying the method of line there will be one ODE per discretization point and extra initial conditions for each discretization point. You would just have to insert the corresponding x into each of them. Or do I miss something? Unfortunately I don't have the time to elaborate, but if it is just for inserting an x dependent initial condition, that might make a good extra question (if you provide a otherwise working example)...
May
18
comment PDE combined with ODE 1D
NDSolve (up to version 9) uses the method of lines exclusively to solve PDEs and AFAIK can't automatically solve coupled equations of PDE and ODEs. What you can do is to apply the method of lines yourself and then combine the resulting set of ODEs for the PDE with the single ODE to one system which then can be solved to NDSolve. I think there are examples of manual application of the method of lines in the advanced documentation of NDSolve as well as on this site...
May
17
comment Running unit tests while debug session is running in Workbench
The workbench is based on an older version of the MUnit package which was available as a standalone Mathematica package before there was the workbench and which you might be able to use in an extra session as Akater suggested for his package. You can still find it deep in the directory tree of the workbench/eclipse installation (put a Print[$Path] in a test and run it). I have never checked if that MUnit package still works without the workbench but it would be the first place to look at. Maybe you'll find documentation for the older package somewhere to start off...
May
13
comment How to generate a unique file name similar as that created by CreateTemporary
it probably is worth noting that it is common practice to use such random strings as "global unique identifiers" (GUID). Of course they are not guaranteed to be unique, but only have probabilities of almost 1 to be so. See e.g. the wikipedia article on GUID for details. From the format of the strings I could well imagine that the conventions mentioned there are what Mathematica uses for CreateTemporary, or at least something very close...
May
6
comment NDSolve producing an overdetermined system
for me the error message seems to be very clear: you have 3 differential equations but want to solve for 4 functions. What is em? Why don't you have an equation for it?
May
6
comment Why do NDSolve and OutputResponse not evaluate non-analytic functions numerically?
It probably should be noted that it does help to start from a value larger than zero for NDSolve (at least if one adopts the initial condition), but not for OutputResponse...
Apr
30
comment How to save the results in an identical Excel file (.xls) in each iteration of a Do loop
the standard Export for excel files can only write content in one go. Of course you can completely overwrite the file for each line, which is inefficient but probably not too problematic. Other than that I see the following possibilities: write to a text file (or CSV) line by line, for these appending is simple and efficient. Depending on the data, you won't loose much compared to an excel file. If you really need excel, you could use NETLink to do what you want, if you search for "NET excel" you'll find many Q+A to start...
Apr
26
comment Prevent package from being opened in a notebook interface
well thats what I would probably try to do in your situation, but as I said, my experience with .NET is very limited. I would know how to do that in Java or C, so I can hardly imagine it wouldn't be possible with .NET.
Apr
25
comment Prevent package from being opened in a notebook interface
Honestly, I don't know .NET very well, but there are for sure binary libraries/assemblies/object-files that another .NET program can load? If you provide such a binary for them to load from their .NET code that wouldn't make much difference to calling an encoded package file via NETLink for them, would it? You could even sell that as a feature as they wouldn't have to bother with NETLink in their code :-)
Apr
24
comment Dynamic Syntax - Evaluate AppendTo as the second argument
@m_goldberg: I think the missing not makes my previous comment superfluos :-)
Apr
24
comment Prevent package from being opened in a notebook interface
what about compiling the compressed code string into the NET assembly and send it to to the kernel for uncompress/evaluation? Then it would not even live as a file in the filesystem on the executing machine...
Apr
24
comment Dynamic Syntax - Evaluate AppendTo as the second argument
@m_goldberg: you say "only seems to work reliably", but does it work at all and is it supposed to? I would have said it most probably isn't even meant to work, but honestly don't know what actually is the "documented" behavior that I could expect. I also can't see that a naked Dynamic with a 2nd argument does anything relevant concerning its 2nd argument, other than quietly ignoring it. Am I missing something here?
Apr
24
comment How to copy a function by value?
it might well not be the right choice for your problem, but I think you should be aware that for those cases where you treat a function as an object, using Functions is often more appropriate than downvalue-definitions. When using func1=Function[x,x^2] for the first definition and func1=Function[x,-x] for the second your example will work as you want...