« first day (1939 days earlier)      last day (2843 days later) » 

00:39
Guys, if I have two lists {a,b,c} and {d,e,f} and I want to to make a graph object {a->d,b->e,c->f}, How can I write a function to do so? This doesn't work: f[one_,two_]:=one->two;
@e3labs But this {a->d,b->e,c->f} is not a graph object. It is a list of rules.
@hal
@halirutan I mean I want to make the list of rules to create a graph, i.e. Graph[{a->b...}]
@e3labs :) Would you know how you can transform {a,d} into a->d?
@halirutan I don't :/
@e3labs Do you know what the Head of an expression is?
00:47
@halirutan Yup
@e3labs So tell me, what is the head of {a,b} and the head of a->b?
@Halirutan the head of {a,b} is a list, and I (I just checked) is Also a list
@e3labs To shorten this a bit, let's look at
FullForm[{a,b}]
FullForm[a->b]

List[a,b]
Rule[a,b]
Can you say in what we need to do to turn List[a,b] into Rule[a,b]?
@halirutan Seems like I just have to use Rule[a,b] ? That returns a->b
@e3labs Yes, but do you see that we only need to replace the head of List[a,b] with Rule to turn {a,b} into a->b?
00:54
@halirutan Yes, I see that
@e3labs Let's assume for a moment we can rearrange your two lists into the following form
{{a, d}, {b, e}, {c, f}}
You see what you had to do with the inner lists, right?
@halirutan Ok, that is the form I have the list in. Then I transposed the list to try and create the rules. Hold on.. let me mess around with it a bit without transposing.
@e3labs If you don't know how to replace the head of an expression in Mathematica, you will miss the easy solution.
Do you know the operator or function that replaces the head of an expression in Mathematica?
@halirutan Ok, with that hint, I tried Apply[Rule, {{a, d}, {b, e}, {c, f}}]
@halirutan is that the one?
@e3labs Right, there is one problem with this. Apply in your call replaces the head of the *first level of the expression.
01:03
@hal
This is the reason you get
Rule[{a, d}, {b, e}, {c, f}]
@halirutan Yup, so I need to apply it to the second level
Exactly!
Apply has a second parameter
Boom!
@halirutan Apply[Rule, {{a, d}, {b, e}, {c, f}}, 2]
@e3labs And you know that this function call has a very short operator form, yes?
01:05
@halirutan What is it?
@halirutan Haha Second isn't it
@e3labs It's in the second line of the documentation
@e3labs To put everything together, do you know how you can transform your lists {a, b, c} and {d, e, f} into the form we need?
@halirutan Yess Rule @@@ {{a, d}, {b, e}, {c, f}}
Correct
Or to make it into an assignment: Write a function toRules[l1_, l2_] which takes two lists l1 and l2 and gives you the desired output.
@halirutan First thought would be to transpose... but yes, I think I can make it like that. let me try..
@e3labs Transpose is the right way.
01:12
@halirutan toRules[l1_, l2_] := Rule @@@ Transpose[{l1, l2}]
@e3labs There you go. See, you could solve it yourself. Very nice.
@halirutan Hahahaha With a few hints. Your the man. Thanks again!
@e3labs No problem at all.
02:08
I can't seem to assign the results of Import[] to a variable.
For example, this works: ListPlot[Import["horner_sine_13.csv", "CSV"]]
But this doesn't:
fh = Import["horner_sine_13.csv", "CSV"]
ListPlot[fh]
It tells me: ListPlot::lpn: IImport[horner_sine_13.csv,CSV] is not a list of numbers or pairs of numbers.
Well, I think I just figured it out while copying that over.
For some reason, when I copied the text it gets encoded as "\.16Import"
So just retyping "Import" fixes it. Weird
02:46
Does someone know why the "news feed" in the chat shows the same SO question 3x?
 
5 hours later…
07:53
@halirutan It appears that there are feeds for the mathematica, wolfram-mathematica and wolfram-language tags. I don't have time to clean this up now (and make sure I don't mess up anything). If you do, feel free to fix it. We need to check which tags are truly distinct.
@halirutan As I remember the problem is that these are SE-wide feeds that include all sites. And not all sites use the same tag names. SO have renamed mathematica to wolfram-mathematica, but some other sites have not.
So perhaps it cannot be fixed without missing some questions.
 
1 hour later…
08:55
The undocumented RandomSeed and RandomSeeding options are showing up from the autocompletion menu in the FE (they correspond to ClusteringComponents and/or NMinimize functions according to some MSE posts)... Apart the fact that this is probably a "bug", it shows also the limit of having autocompletion without any context (RandomSeed is an OPTION name, i used that (without FE warning) instead of the FUNCTION SeedRandom).
Does someone know if there are plans to get a more context sensitive \
and useful auto-completion menu ? (as the number of functions / \
options / methods / ... grows very fast ? At least the autocompletion \
menu could mention or tag the name as a function or option or ...
@SquareOne I'd not be interested in plans. If something isn't meant to be shipped in V11.X then there is no point in waiting. And yes, there are plans about making autocompletion or fe resources customizable for users but so what :)
09:30
@SquareOne There is already context sensitive auto-completion. Options with string names are only offered inside functions. Options values are only offered inside functions. The issue is that RandomSeed is a symbol that exists and all symbols are auto-completed.
Also, as sloppy as it is, there are even some function names which are also used as option names.
Otherwise I so understand th frustration with RandomSeed. Just days ago I corrected someone's use of it, then the next day I misused it myself.
3
@Szabolcs @SquareOne I had it in hot Fast spherical polygon and noone even noticed :P
 
4 hours later…
13:13
So far I have not found an example on site in which Charting`ScaledTicks or Charting`ScaledFrameTicks works in V11.1 as it shown to work in the answer....and I can't get it to work yet either. The frustrations of undocumented things... :/
I mean with FrameTicks. Haven't checked Ticks.
One problem seems to be Log of zero and negative numbers in plot range.
13:37
FrameTicks docs does not show that one can pass tick functions, as the docs for Ticks does. Maybe the functionality has been removed?
 
1 hour later…
14:55
@Kuba If you get a chance, does your answer here now fail for you in 11.1?: mathematica.stackexchange.com/a/24070/4999
I was going to suggest a fix to it, but FrameTicks won't work like it used to....
Actually, if in your initial run, you don't use Frame and use Ticks instead of FrameTicks, it works. I got sidetracked by FrameTicks being broken.
@MichaelE2 yep, fails. I'm not angry at ticks anymore, I just ignore them since ~2014. It is just ridiculous that there is no stable and general api. But at least we have famous people curves etc.
@MichaelE2 I will problably just put a note it is outdated. Thanks for checking.
15:23
Guys, I'm trying to plot the integral of a function
not sure how to describe that
but technically, I have this:
I would like to plot the integral of the sign function of sine
to get the triangle wave plot
@ShaVuklia Try f = Integrate[...]; Plot[f, ...] or Plot[Evaluate@Integrate[..], ..]
hm yea I think maybe it has something to do with my integration variables
i'll try your suggestion
Plot "holds" its arguments: It does not let them be evaluated until it has replaced all occurrences of x with a number. So it tried to evaluate things like Integrate[h[0.01], {0.01, -Pi, Pi}]
hm yea I think I've managed!
I tried this:
yea you're right.
thanks!
hm, I don't understand
why is my function smooth?
it should be triangle-like
oh never mind
i get the right graph now!
15:39
OK :)
15:55
@Szabolcs @Szabolcs @Kuba The fact that this context sensitive auto-completion with option values exists only inside functions (and is very useful) shows that it is clearly possible to do more in that direction. I mean, auto-completion should absolutely know when you need a function or an option. If you start typing a new command in the FE, you clearly need a function not an option. This is not only not useful for the advanced programmer but also for the begginner.
@Kuba RandomSeed typos (instead of SeedRandom) in text only (not in code): this post and that one. I'll correct it.
Is it possible to open WL/M files and have auto-indentation apply the same as with NB files? I've been porting more code to WL scripts and I like the auto-indentation of notebooks. I could do all of the formatting manually, but I find I prefer just specifying where the new lines go and then letting auto-indent do the rest. But the auto-formatting information is stripped from scripts and everything is aligned left when I reopen.
@MichaelHale copy as input text
16:11
@Kuba I have a WL file open now. The cell is input style and there is auto-indentation. When I save though and re-open the auto-indentation is lost.
WL file is .wl file?
@MichaelHale I see. Don't know how to affect this .wl saving scripts.
16:31
Nice. Just saw FieldCompletionFunction. Something I've wanted.
Finally :)
16:55
@MichaelE2 I have a problem with ticks in ListLogPlots disappearing or changing in something linear when the notebook in which these plots occurs is loaded back. Haven't investigated yet in other versions, but it's 11.1.1 what I'm using now. Might be related.
 
4 hours later…
21:09
@SjoerdC.deVries I've had problems with *Log* plots going back several versions. They get fixed sometimes, but now for personal use, I tend to favor regular plots and apply RealExponent[] to my function. In the case I ran into earlier today, it seemed that the plot range padding expanded the plot range into an interval with a negative end point. When Log was applied, the ticks failed at the complex result and returned an empty list of ticks.
21:36
@SjoerdC.deVries @Kuba Well, I haven't restarted the kernel (I'm up to In[3654] and no crash yet), but FrameTicks seems fixed.

« first day (1939 days earlier)      last day (2843 days later) »