« first day (1031 days earlier)      last day (3467 days later) » 

1:30 AM
Hi everyone, I'm having some trouble getting a function that dumps the solution to an NDSolve to behave properly when it's called within a Table or within a Plotting routine
I've tried dummy functions, NumericQ, etc, no luck
All of the arguments to my function that returns the NDSolve have ?NumericQ arguments
Evaluating the function outside of a table works fine, but inside I get the error NDSolve::ndode: Input is not an ordinary differential equation.
I can share the code if someone would be willing to take a look
Oddly, if I do it in an Array instead of a Table, it works! I'm really confused
 
1:59 AM
Maybe there's a way to get it to work with SetAttributes?
Tried this, didn't work either: mathematica.stackexchange.com/questions/6894/…
 
 
9 hours later…
11:16 AM
@Rojo thanks!
 
12:09 PM
@Rojo Take a look: Block[{$IterationLimit = Infinity}, First[(#0^Boole[RandomReal[] < 0.9999])[# + 1] &@1]]
 
 
2 hours later…
2:38 PM
Hi all. @kirma recently mentioned the slides from WTC2014 on the Wolfram Library Archive. After a brief look at it (especially on the CDF Stuff) I found a presentation on iOS from Rob Raguet-Schofield. He demoed how to integrate CDF in an app on iOS via the so called CDFKit. Question: Is this static library available yet? It looks like (from other presentations) that CDFPlayer for iPad/iPhone is also still not finished...
 
@Xacobeo2002 Interesting find! I have no idea of that though. :o
 
2:55 PM
Hi @kirma, oh ... maybe some folks who attended the WTC have seen the demontration and might comment on it...
 
@Xacobeo2002 Maybe :)
 
 
3 hours later…
6:17 PM
My award link is on Wolfram page now. A lot of my work was possible due too the exchange of experience here in the community. So I would like to say my sincere thanks to all here.
 
6:57 PM
@Murta Nice and congrats. I'm going on vacation to Recife and Fernando de Noronha from January 17-28. Any suggestions?
 
7:32 PM
Is the function Ordering in Mathematica, not as well designed as it should be? reference.wolfram.com/language/ref/Ordering.html because, in the spirit of functional programming, it should accept a user defined function to base the ordering on. Right now, it uses Sort. But what if I want to base the ordering on something other than Sort? Or even call Sort myself differently? I think there should be an OrderingBy similar to SortBy function at least.
I think all of the above (too many functions) is due to one basic issue with Mathematica. Its functions return one result at a time, instead of multiple outputs. In Matlab for example, the function find() can return both the value and the position of what it finds. If Mathematica can do the same, many of current functions can be collapsed into small set of functions.
 
7:59 PM
@Nasser There are lots of improvements that could be made to the language. Starting a new language is too much work, so hopefully the new, incremental improvements team they've mentioned will be what we want. You can use the three argument form of Ordering, which is similar to the two argument form of Sort. It's straightforward to convert a SortBy command into a Sort/Ordering command then.
 
@MichaelHale but the three aguments version still uses Sort. What if I do not want to base Ordering on Sort? And use my own function. That is what I meant. The spirit of functional programming should allow ont to be able pass their own function. The default can still be Sort. that is what I meant.
 
@Nasser Ordering[{{1, 2, 3}, {2, 3, 1}, {3, 1, 2}, {2, 2}}, All,
 OrderedQ[Total /@ {#, #2}] &]
You can replace Total there with any function you would use in SortBy.
 
@MichaelHale thanks. This should be added to the examples section as it helps clear things. (very little examples in help actually, more is needed. I learn more by seeing examples.
 
8:39 PM
@Szabolcs Hey, I'm trying to think of how to proceed. I could try fiddling with your suggestion for a few minutes (and probably learn that you're right and that I'm doing something dumb). Or I could upload a simple example - the problem is that I don't have a place to host a simple text file.
 
@higgy So you can talk here, good. I was worried the system wouldn't let you because you don't have enough rep score.
@higgy Can you give a short example which fits in a couple of lines?
SemanticImport gives a Dataset usually. Is this the case for you?
 
@Szabolcs This was the simple mock-up example that I created. It has all the features of my data set.
 
Also, there's no need to freeze the question. If you wish, you can delete it, keep the page open, and undelete it later. But I don't think that's necessary.
 
@Szabolcs a b c d
1. 28.95 29.05 10.
1. 29.95 30.05 70.
2. 28.95 29.05 20.
2. 29.95 30.05 65.
3. 28.95 29.05 30.
3. 29.95 30.05 60.
1. 28.95 29.05 11.
1. 29.95 30.05 69.
2. 28.95 29.05 18.
2. 29.95 30.05 0.
3. 28.95 29.05 33.
3. 29.95 30.05 59.
1. 28.95 29.05 10.5
1. 29.95 30.05 nan
2. 28.95 29.05 18.5
2. 29.95 30.05 66.5
3. 28.95 29.05 33.5
3. 29.95 30.05 59.5
 
If I apply SemanticImport to that, it gives me a Dataset. What do you need to do with the Dataset?
 
8:43 PM
@Szabolcs Copied from a text file. It is tab-delimited, the first column are the headers. But notice that one entry has a non-number.
 
Yes, it doesn't seem to like that.
It gave me Indeterminate.
 
@Szabolcs Yes, I get a dataset, too, but not in the right form.
@Szabolcs and my attempts so far to convert it involve several lines. I was hoping to find a quick one-liner that would do the transformation, but that led me to thinking about this question. FYI my SE question isn't just to solve this, it's also out of curiousity
@Szabolcs Will explain goals of dataset in a moment - having issues in the office, one sec
 
What is the form you need?
Actually I don't get a usable Dataset when applying SemanticImport to this data. SemanticImport and Dataset don't seem to be ready for prime time ...
But let's just say we have this:
{<|"a" -> 1., "b" -> 28.95, "c" -> 29.05, "d" -> 10.|>, <|"a" -> 1.,
  "b" -> 29.95, "c" -> 30.05, "d" -> 70.|>, <|"a" -> 2., "b" -> 28.95,
   "c" -> 29.05, "d" -> 20.|>, <|"a" -> 2., "b" -> 29.95,
  "c" -> 30.05, "d" -> 65.|>, <|"a" -> 3., "b" -> 28.95, "c" -> 29.05,
   "d" -> 30.|>, <|"a" -> 3., "b" -> 29.95, "c" -> 30.05,
  "d" -> 60.|>, <|"a" -> 1., "b" -> 28.95, "c" -> 29.05,
  "d" -> 11.|>, <|"a" -> 1., "b" -> 29.95, "c" -> 30.05,
  "d" -> 69.|>, <|"a" -> 2., "b" -> 28.95, "c" -> 29.05,
  "d" -> 18.|>, <|"a" -> 2., "b" -> 29.95, "c" -> 30.05,
 
@Szabolcs Columns "a", "b", and "c" are independent variables. Column "d" is a dependent variable. I need to delete all rows for which "d" is (not a number)&&(in a certain range). I then need to average values of "d" for which the corresponding independent variables ("a", "b", and "c") are identical
 
OK, but that's a completely different question than what you asked on the main site.
 
8:50 PM
@Szabolcs (In my real data, I have 4+ independent variables, 20+ dependent variables, and 4000+ rows)
@Szabolcs That should be okay. If in figuring out how to solve my main goal, I end up pondering a different question, do a little research into it and can't find a clear answer, I feel that is acceptable to ask a SE question.
 
OK, let's start by creating a usable Dataset, as SemanticImport fails here. If your file is named f, then do Dataset@First@SemanticImport[f] which should give a usable Dataset.
 
@Szabolcs I appreciate your attention and help, btw. My SE question really is curiosity
 
At least for your test data.
Of course SemanticImport should do this automatically, but it seems to be buggy ...
Let's name the dataset ds. Then ds[Select[#d =!= Indeterminate &]] will select all rows where d is not Indeterminate.
 
Okay, imported
Whoa, that looks great.
That's exactly what I wanted (for my main goal).
I now have the code to do the rest from here. That is, to use Datasets features to Select and average my data.
So apparently First was necessary.
Thanks for figuring that out.
 
This is to work around a bug ... you should report that to WRI ....
 
8:56 PM
@Szabolcs Hi
 
@Kuba Hi
@higgy I'm not sure what to say about Dataset. It's a new feature in v10. It's nice and has potential, but it also has rough edges ... plenty of them ..
 
Do you maybe have better understanding of $CellContext` as a placeholder for context?
 
@Kuba No, sorry. I never tried to figure that one out.
 
@Szabolcs Ok :)
 
It does some weird things. I don't understand, for example, why loading a package in the help window doesn't load it globally ...
 
8:58 PM
Okay. As for the SE question, I wanted to know if there was a function f that would do f[ a -> {1, 2, 3} ] = {a -> 1, a -> 2, a ->3 }.
And Thread does it!
 
@higgy That function is called Thread.
 
@Szabolcs Help notebook has context set to CellGroup or something. So symbols are not going to be seen outside?
 
Hmm, so the issue here is that I only just now wrote that "pseudocode" out explicitly in Mathematica, because I thought it was pseudocode, and would not really work.
So that's embarrassing.
 
@MichaelHale Yes I can!.. My wife lived in Fernando de Noronha for work, she knows a lot about it, wonderful place in earth. Send me a mail that I can send you nice tips. Here is my mail: Uncompress@"1:eJxTTMoPChZjYGDILS0qSXQoyk8pykzPB3P0kvNzAZilCqM="
 
@Szabolcs And I see now that this is because Rule[] is the Head. But the connection wasn't clear when I first read the documentation on Thread (which I did before posting the question).
@Szabolcs What do suggest I do about the SE question? Should I delete it? Rephrase it?
 
9:01 PM
@higgy If you need to group elements of the dataset which have the same "a" value, you can use GroupBy. For example something like this: ds[Select[#d =!= Indeterminate &]][GroupBy[Key["a"] -> Key["d"]]][All, Mean]
here Key["a"] represents an actual function that extracts a key from an association, i.e. Key["a"][ <| "a" ->1, "b" -> 2 |> ] will give 1.
Again, if you're a beginner, and you just need to get work done, I'm not sure if I should recommend Dataset ... If you have time to play with it and work around the glitches, then by all means, go for it.
Otherwise you can just treat the data as a simple matrix of values, without referring to the columns by their names (you'll need to use their numerical indices), and use the pre-v10 functionality.
To tell the truth, I haven't used Dataset for real work that much recently. Others are likely more experienced with it.
@higgy Regarding the question, the "not referring to the LHS" part was confusing to me. If others think so too, then perhaps you can just remove that part and leave Thread as the answer. But maybe it's just me ...
I need to go do some work now :)
 
@Szabolcs Perhaps I'm a beginner, or maybe just a slower learner than most. I've been using Mathematica for about 7 years, and used it significantly for 2012-2013 while working on my dissertation. I can explain my misunderstanding of the application of Thread here. I was not thinking of x->y as a function. In the doc, Thread takes a function as an argument. It is obvious to me now that x->y uses the function Rule.
@Szabolcs I've been trying to use Dataset because I have a grad student that has been giving me data as text files, and it seemed like I could use it to parse and analyze the data efficiently. That import problem threw me off, as did my prolonged (i.e. 1 hour) lapse of understanding that "->" = "Rule[]" = "a function that can be used by Thread"
@Szabolcs Anyway, thanks a ton for you help and insight. I'll edit the original question and accept your answer. Cheers.
 
@higgy I see the documentation says Thread[ f[args] ], which looks like a function, but actually it's just an expression. In Mathematica every expression has a head and a body, they can all be written as head[arg1, arg2, ...] (see FullForm). The full form of x -> y is Rule[x,y] (check FullForm[x->y]).
@higgy Sorry about the misunderstanding. Mathematica is a large system and we're all beginners in one area or another. I'm certainly a beginner with Dataset. :-) I tried to use it, but things didn't go as smoothly as I had hoped and the old way of doing things were just faster ... so I reverted to the old way. But then I don't work with many data tables like these.
@higgy If you haven't seen this yes, read through it when you have time. Understanding this aspect of Mathematica well is really useful.
 
9:21 PM
@Szabolcs No worries, you're trying to help, and you've been quite helpful! That Overview looks interesting. It's funny, but I had used StandardForm for quite a while, and then switched to using prefix and postfix form for a lot of applications (just to get used to it). But now I believe that both types of syntax have their pro's and con's, and that it's important to be aware of FullForm always.
 
10:19 PM
@Murta Great, thanks. I wrote you. Respond at your leisure.
 
 
2 hours later…
11:53 PM
0
Q: Is it ok to post both on mathematica.stackexchange.com and Wolfram community?

Tyler DurdenIs it ok to post both on mathematica.stackexchange.com and Wolfram community? There seems to be a difference in that community is supposed to be for "discussions" whereas this mathematica.se is strictly for questions.

 

« first day (1031 days earlier)      last day (3467 days later) »