12:01 AM
Solved, pretty hard to create proper texture -- it does not match :X
Is there any command to fix the non-matching?

I need to divert the texture somehow to make it match.

9 hours later…
9:14 AM
2

I accidentally mentioned this to my wife and she asked me how we should celebrate. I wasn't sure if there was a protocol for this kind of thing. But I know how to find the answer -- by asking here!

2 hours later…
11:21 AM
Is there a nicer way to drop the first i and last j terms of a list? Currently I'm doing Drop[Drop[listname, i],-j], which is ok but looks a bit silly.

11:31 AM
@VincentTjeng many possibilities
e.g. with `Delete` or `Part`
list[[i+1;;j-1]]
... or `Take`

11:51 AM
thanks!
delete and part make the most sense for me
don't understand how i can look at the documentation so many times and still miss it

1 hour later…
12:53 PM
@VincentTjeng Look up `ArrayPad[]`.

1:42 PM
@J.M. fancy, that!

@YvesKlett Yes, I'm starting to use that thing a bit more frequently. Very handy.

2:12 PM
hi
may i ask a question why mathematica doesn't give a solution of an ode (which i find)

2:29 PM
@DominicMichaelis why don't you post the ODE?
@DominicMichaelis I probably won't be able to help, but I think it might increase your chances of someone spotting it. :)

` DSolve[{y'[x] - x^2 (y[x] + 1) (y[x] - 2)^2 == 0, y[4] == 2}, y[x], x]`

So for the record, when we try to execute this in Mathematica, it tells us this: For some branches of the general solution, the given boundary \
conditions lead to an empty solution

yeah but try the constant 2 function

What do you mean?

try y=2 for all x
it is a solution to the ode

2:36 PM
given a list [a,b,c,d,e,f ..... z] how can i do f[a,b], f[b,c]
... f[y,z]

@DominicMichaelis The corresponding manual entry says it can be caused by there not being a unique solution. So you found one solution but it might not be unique? My points is just that it would be better to ask what does this error message really mean? Rather than, why can't Mathematica solved an unspecified ODE ;)

if you write it y'[x]=... it is obviously local lipschitz hence a unique local solution exists

@DominicMichaelis Sorry, never mind what I said cause I feel like I'm starting to be rude. I was just looking for a more precise question, I got that now.

oh i didn't interprete it rude sorry. Thanks for the advice :)

@Rojo @J.M. Has someone an idea what open-source license to use? GPL, Apache, ..?

2:43 PM

I mean... when you have absolutely no plan with this stuff like I have.

@belisarius What's up?
17

I'm just going to address the second part of your question about licences. Incidentally, I will say that this having been moved to Meta has provided an incentive for me to answer, since it's appropriate here to give personal views and opinions, whereas on Main it's not. Probably by far the best ...

@rm-rf Hiya
@rm-rf I think Rozita needs a few good pointers

@belisarius Thanks for volunteering to give it to him :D

2:45 PM
@DominicMichaelis Nonlinear DEs are often poorly handled by `DSolve[]`, so I'm not too surprised...

@rm-rf I mean, by a mean mod

but the NDSolve works pretty nice on an experimental plot

@rm-rf And "Rozita" is most probably a "she"
Portuguese, probably

@belisarius Why Portuguese?

@belisarius Nah, too soon... the community should first try to comment and explain and knock some sense into him. That hasn't happened yet

2:47 PM
@DominicMichaelis Well, numerics is a bit easier to do. Symbolics takes some work.

She's portuñola. Zi, pero ita.

No one ever likes being contacted "officially" by the mods, and this user is just 30 mins old on the site and no one else has said anything of substance to them...

@rm-rf What a great answer by @OleksandrR.

In the Help it says that using currency units you need internet connection but you need for all units internet don't you ?

@DominicMichaelis The currency units will need the current exchange rates

2:51 PM
yeah but even if I used use something like meter it fails

@rm-rf Sorry, I forgot cowardice and inaction are mod's virtues

The other units will work without internet... I think it just prefers to have it (to contact W|A)

You only need an internet connection if you don't specify the exact name of the unit
(of course the monetary one is the exception)

@belisarius Happy to (not) be of help :)

@rm-rf You're welcome

2:52 PM
@belisarius Well damn, if we don't have to hit somebody on the head with a mace, that's a good thing, no?

where is an list of the exact names ?are the one of physical constants and units still available ? or have some changed

@J.M. You can choose your weapon

@EiyrioüvonKauyf This seems to work: ListConvolve[{1, 1}, {a, b, c, d, e, g, h}, {-1, 1}, 0, Times, f]

8

Itâ€™s great that Quantity can utilize Wolfram Alpha to interpret unit strings that it doesnâ€™t recognize, but I need my code to work on machines that do not have Internet access. Is there a complete list of built-in (i.e. canonical) unit strings recognized by Quantity? Better yet, is there a prog...

@J.M. thanks a lot :)

3:10 PM
Hello everyone!
If you happen to be here, Mr. W, sorry I'm a bit late - having computer boot issues which shouldn't be too nasty, so I'm using my GF's computer until I remedy them.
Ah, and she's booted. Hooray! hah;a

@Ghersic Booted? Why, doe she have buttons?

@Ghersic he won't notice unless you ping him by prefixing an @ to his name as @Mr.Wizard

Haha I meant my beloved computer; she's the FIRST "she" in my book ;).

Hello @Ghersic

3:15 PM
Hello!

Give me a minute to get things opened up.

@J.M. Indeed!

No problem, thanks. @J.M. haha yes closing the chat tab before returning her laptop... ;-)

From before we have:
```recordToRule[time_List][{name_String, data__}] := name -> Transpose[{time, {data}}]
ruleData = recordToRule[time] /@ Part[data, 2 ;;, 1 ;; 5];
thirds[lst_List] := Partition[lst, #, #, 1, {}] & @ Ceiling[Length@lst/3]```

3:20 PM
btw, @J.M. or @belisarius: I have this problem â€” I have a list `X = {x1, ... xn}` (all numeric) and a blackbox function `f[k_]` that outputs a list `Yk = {y1,...,yn}` (all numeric) for a given `k` (Real). I need to find the `k` such that `kmin <= k <= kmax` (known endpoints) minimizes `|| X - Yk||_p` (in some known norm `p`). I know how to implement this by running through a grid of `k` points, but do you know of an existing question on this or if it's better handled via a builtin?

Yes. My notebook has up until that point, and I was glad when I noticed I can graph the expression `dataonly`.

(Sorry for the long silence, I'm still getting my stuff together.)

No problem.

@rm-rf No idea if there's a built-in; I'd do the same thing you did.

Ah, ok then

3:23 PM
You might be aware that you can use `Tooltip` on data elements to provide a tooltip on plot data in ListPlot. If you reviewed the styling individual curves question and answers you may also be aware that these can be used to pass arbitrary data through the plot function. Another illustration of that is this:
5

While it's not the cleanest method you can use Tooltip or Annotation to pass arbitrary data through a plot function, then reprocess it on the other side. A point passed as Annotation[{x, y}, data] will appear in the output Graphics as: Annotation[{Opacity[0.], Point[n]}, data] where n is an i...

"Pub." Ah, yes: a meeting place where people attempt to achieve advanced states of mental incompetence by the repeated consumption of fermented vegetable drinks. (Pratchett, I think.) ... advancing on that front now. </OT>

@rm-rf I don't think there is a builtin for that

In case you are not familiar with the basic functionality (which is quite nice) here is an example from the documentation:
```ListPlot[Tooltip[Table[If[PrimeQ[x], Tooltip[x, Row[{"prime: ", x}]], x], {x, 1, 25}]],
PlotStyle -> Directive[PointSize[Medium], Orange]]```

@kirma Dunno, some of the most stimulating philosophical conversations I've had were in pubs...

@belisarius Thanks! I wasn't entirely certain, since I've not used the optimization functions all that much to be fully aware of what's in there and what's not

3:25 PM
@J.M. Surely, me too. Many of them haven't sounded that stimulating if I have remembered those afterwards. :)

Let us write a new function `tt` to convert one of our records to a `Tooltip` form:
```SetAttributes[tt, Listable]
tt[name_ -> dat_] := Tooltip[dat, name]```

@J.M. The other place is the uni restroom
but the lack of alcohol kind of spoil it

@belisarius but that's without the "philosophical conversations" bit, no? ;)

@rm-rf Well, `NMinimize[]` can do integer-valued optimization, but I think that's an atom-bomb solution to a walnut problem.
@belisarius I think the act of taking something out of your body is rather distracting, tho.

taps on restrooms!

3:27 PM
I have given this function the `Listable` attribute so that it can be applied to an individual record, a list of records, or an entire array or tree of records. This is only possible because our records do not themselves have the head `List`, or the function would be threaded too deeply and would apply to individual numbers, etc.

ahh, ok
Making a note of the importance of `SetAttribute` in maniuplation.

We can write a custom plot function now. (Remember the post I linked the other day, and review it later, as those methods would improve and generalize this.)
```myPlot = ListLogLinearPlot[#, Joined -> True, ImageSize -> 300,
PlotRangePadding -> {{Automatic, Scaled[0.15]}, {Automatic, Scaled[0.1]}}] /.
Tooltip[{___, color_, line_}, tip_] :> {Text[Style[tip, 14], {.1, 0} + line[[1, -1]]],
color, line} &;```

@J.M. You need the right mindset to get the full benefit

Yes I looked through them briefly and will again in an attempt to internalize them more.

This is a bit of a hack as I have hard-coded values such as `Scaled[0.15]` which again, would be better either given as options (with defaults if desired), or carefully calculated. This is already long enough however and I don't need to hit you with a wall of inscrutable code.

3:31 PM
@belisarius "Yes, I think (ugh!) that they were justified (hurgh!) in doing so. Hey, got more paper there?"

There are two parts: `ListLogLinearPlot[ . . . ]` which you should already be familiar with, and a `ReplaceAll` (`/.`) operation taken from Accepted answer to the curve styling post I referenced yesterday.

Yes

@belisarius university restroom walls: the pre-internet forum, with some sophisticated trolling.
anonymous, too

@kirma Ah, I count graffiti differently. Then yes, the walls are conducive to philosophical discourse.

This rule exchanges (replaces) the `Tooltip` objects which remain in the output expression (from `ListLogLinearPlot`) that is normally displayed as a graphic by the Front End. Understand that the object, while displayed as a graphic, is still an expression tree like any other, as I have previously described. As such, replacements like this can be performed. Does this make sense?
(Not the details of the `Rule`, but the concept.)

3:33 PM
Gems like "the future is in your hands" above the urinals, for instance.

@J.M. "Nobody is honest. Vote for Nobody"

@J.M. supposedly highly dependent on faculty and gender version.

Yes that does, and it can be displayed using `TreeForm`?

@J.M. I'm not following your conversation but that's a hell of a non sequitur.

@Calle I posted it on the main

3:35 PM
@Ghersic Theoretically, but I wouldn't recommend that you try; it will be huge! Give me a minute to find something.

@Mr.Wizard Sometimes, it's more explicit: "You hold your future in your hands."
@kirma I've seen filthier writing in faculty stalls than student stalls. :D

@Ghersic My memory is poor (note the avatar) and this is not directly applicable, but it will almost surely come in handy later, so bookmark it:
37

The cited OpenerView solution used Trace / TraceOriginal to generate its content. This allowed the definition of show in that response to be defined succinctly, but had the disadvantage of discarding some of the trace information. TraceScan provides more information since it calls a user-specif...

Ahh ok, that's ok, I think I understand.
Oh, excellent. Thanks. Mathematica's aids for visualizing what it is doing never fail to amaze me.

Anyway, a similar method could be used to explore large expression trees.

I do like the Farnzworth (sp?) avatar.
Ok.

3:40 PM
Finally, a plot:
`myPlot /@ tt[thirds @ ruleData] // Column`
This isn't necessarily the best way to write this, but it let me illustrate the listability of `tt`, and the idea of handling data all at once.

@J.M. uni and faculty were I spent my time, there wasn't really separation between two. neither between the stalls (at least in university buildings), nor, at some respects, actually "faculty" and "students" per se. graduation wasn't exactly an requirement to appear as faculty authority on a specialized subject. (and yes, this is not a poor quality university.)

It also gave me a chance it confuse you with a mix of syntax. :^)
Remember the Ctrl+. thing when figuring out the order of operations.

Cool, haha.

@Ghersic Farnsworth.

@kirma Ah, thank you. The good doctor, haha.

3:43 PM
@kirma Hmm, interesting. :) When I was in the academe, the schools I've been in always kept faculty bathrooms and student bathrooms separate...

Philo Taylor Farnsworth (August 19, 1906 â€“ March 11, 1971) was an American inventor and television pioneer. Although he made many contributions that were crucial to the early development of all-electronic television, he is perhaps best known for inventing the first fully functional all-electronic image pickup device (video camera tube), the "image dissector", the first fully functional and complete all-electronic television system, and for being the first person to demonstrate such a system to the public. Farnsworth developed a television system complete with receiver and camera, which he...
... but also Futurama persona :)

@kirma Rather sadly the Futurama guy is much more well-known than the TV guy.

Nice. That's usually the tradition it seems, @J.M. haha

@Ghersic I don't have anything else prepared today, so now tell me what you want to do, or ask any questions you have, and I'll do my best to answer.

@J.M. despite the Futurama reference is certainly, in some sense, praise for the original.

3:45 PM
@Mr.Wizard I do see the three graphs that expression produces. It excites me that all this can be done without the repetition you saw in my original code.

@kirma Oh, I believe Groening said something to that effect. :)
At least he knows his people.

@Mr.Wizard Ok, one moment please. Thank you again.
I notice that in the plot it labels the individual curves almost perfectly, but the names cut off after "AP6-". I'm trying to play with the `PlotRangePadding`to extend the right side of the graph to incorporate the labels of the curves.
oops, `PlotRangePadding` to

@J.M. I must say I wasn't fully aware of Philo Farnsworth before watching Futurama, but I'm European and didn't go to EE...

If you enlarge the graphic by dragging the frame corners it should not clip (which incidentally demonstrates that it is not independent of scale, and is therefore not ideal). You can also try replacing `Scaled[0.15]` with `Scaled[0.25]` for example.
I thought of something else to show you that's simple enough. Our `thirds` function might be generalized to a `sections` function that splits into an arbitrary number of sections. This also gives me an chance to illustrate optional arguments.

Alright, excellent.

3:52 PM
```sections[lst_List, n_Integer: 3] :=
Partition[lst, #, #, 1, {}] & @ Ceiling[Length@lst/n]```

Working with our thirds may affect that there are 29 curves displayed for our 26 datasets, which is likely due just to rounding and a repated one here and there between the three graphs, which I don't really mind.

@Ghersic Hang on, that sounds like a bug; let me look at it.

Oh nevermind, I'm wrong.
I just realized in my new notebook I used a slightly larger set of (otherwise identically formatted) data.
and the number of curves does indeed match the number of drugs (datasets) here as well, which is excellent!

@Ghersic Okay. :-)

Sorry to alarm! That's good news actually.

3:56 PM
Looking at `sections` you see this pattern: `n_Integer: 3` this represents a pattern named `n`, that is a single expression, that must have the head `Integer` (and implicit head if you will), with a default value of `3`.

Ok

We can therefore write: `sections[Range@10]` and get `{{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10}}` or we can specify the value of `n` like `sections[Range@10, 4]` to get `{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10}}`. Does this make sense?

Ahh, ok, so the second value specified is the number of lists that it creates from the given set.
That makes sense.

Correct. And if no second argument is given the default is used. If you start using defaults you will sooner or later run into this:
25

Is it possible to create a function with optional arguments that also takes options? Here is a simple example. I have a function f with option "g". It also has optional arguments y and z which are set to default values. Options[f] = {"g" -> Identity}; f[x_, y_: 2, z_: 3, OptionsPattern[]] :=...

Ok.

4:00 PM
Although it is not the most highly voted answer (it was posted late) I will direct your attention to this answer (I posted it, but the method is not mine):
9

Here is another method that I learned about through reading this presentation: Options[f] = {"g" -> Identity}; f[x_, Shortest[y_: 2, 1], Shortest[z_: 3, 2], OptionsPattern[] ] := OptionValue["g"][x + y + z] From the documentation for Shortest: Shortest[p, pri] is given priority pr...

That gives the greatest amount of control for this kind of thing. This is advanced stuff and you don't need to understand it now, but again, something to bookmark for later. :-)

Certainly, I'll check it out when the more gnitty-gritty time comes :)

Do you have another question at this time?

Is the text in the effective "legend" for our plot specified by the `Text[Style[...]]` string?
If string is the right term for it

expression is more correct; yes, it is. You can use `Style[tip, 19, Red]` to see what it affects.

Alrighty, excellent.

4:05 PM
The second parameter of `Text` is controlling the position of each label. The positions are being taken from the line data itself via the replacement rule.

Ah alright, changing this position may be a fix to my clipping issue, as I still seem to be having clipping issues on the right side, regardless of the the `Scaled[x]` parameter being increased to .5 or higher.

Try for example: `line[[1, 1]]` -- the labels should be put at the left end of the lines rather than the right.

Ah alright, I see
so the [1,1] is effectively a decimal representation of the percentage of the graph axes
rather than an actual (t,y) value on the axes themselves

@Ghersic That sounds like a change between versions. Try this please: `PlotRangePadding -> {{Automatic, 1}, {Automatic, 5}}`

that is better in my opinion (the percentage way it is actually done).
Ah ok, thank you.
Sorry, I forget we use slightly different versions.

4:10 PM
@Ghersic Sorry, no that's not correct. Once again I'm hitting you with too much. The expression `line[[1, 1]]` is extracting an element from the list of coordinates used to draw the line itself.

That's ok, just wanted to show I'm at least grappling with it... if not a bit errantly. :)
Ah alright.

The `-1` is taking the last point, while `1` would take the first. You cannot find the middle point as easily. There are I believe examples of this in the labeled curves question. Let me also look up another Q&A that is relevant.
@Ghersic Yes, you're doing fine. :-)

Ok, thanks.
Inputting `PlotRangePadding -> {{Automatic, 1}, {Automatic, 5}}` in place of `PlotRangePadding -> {{Automatic, Scaled[0.15]}` in our myPlot seems to give errors, let me see if I can remedy them really quickly.
AHA

To be sure this isn't a transcription error please try:
```myPlot = ListLogLinearPlot[#, Joined -> True, ImageSize -> 300,
PlotRangePadding -> {{Automatic, 1}, {Automatic, 5}}] /.
Tooltip[{___, color_, line_},
tip_] :> {Text[Style[tip, 19, Red], {.1, 0} + line[[1, -1]]], color, line} &;```

Strange, the text has turned red although I don't /think/ the other stylings have changed.
I did notice, though, that I can make the names move more to the left by changing the `Text[Style[tip,14,, {x,0}+line[[1,-1]]],color,line}&` x character!
they move left as the x becomes more negative, it seems.

4:18 PM
@Ghersic Correct; those numbers are acting as offsets, applied listwise. That is `{a, b} + {c, d}` yields `{a + c, b + d}`.

Yes!

From here is a nice demonstration of labeling curves:
```fns[x_] := {Log[x], Exp[x], Sin[x], Cos[x]};
len := Length[fns[x]];

DynamicModule[{pos = Table[{1, fns[1][[i]]}, {i, len}]},
LocatorPane[
Dynamic[pos, (pos = MapIndexed[{##} /. {{x_, y_}, {i_}} :> {x, fns[x][[i]]} &, #]) &],
Plot[Evaluate[fns[x]], {x, 0, 10}, PlotRange -> {-5, 5}],
Appearance ->
Background -> White], {i, len}]]]```
Notice that you can interactively drag the labels along the lines.

I believe I linked to that in my original question you answered (or perhaps a different, related one)!
Oh no, my mistake, it's similar but different.

This is from an older post on StackOverflow.

Oh okay, sorry I thought I recognized it.
My question here might be silly, but it seems like the same question I had with the other related instance of graphing curves.

4:22 PM

I notice he specifies `len` using a function of an independant variable. If your data is in terms of time, which you lack a definite equation for reproducing as a fns[x], how do you alter his use of `fns[x]`?

16

I made a function that could be used for labeling plots interactively, adding labeled Bezier arrows, preserve your labels from session to session, and a few more goodies. Some snapshots follow: Calling code: Clear[f, r] f[r_] := 4 r/(1 - r)^2 i[r_, delta_] := 1/(1 + f[r] Sin[delta/2]^2) s = ...

@Ghersic You mean, a parametric equation?

@belisarius Yes, I saw that in my earlier escapades, I blame it on being intimidated, but I didn't give it all of the time it deserves just yet.

@belisarius I hadn't seen that before; looks useful!

4:24 PM
@Mr.Wizard Oh yes, this is that post I believe! It has the nicely rounded labels and everything - so smooth. :)
It does look useful, and impressive!
@Mr.Wizard the earlier link, that is. Sorry many links I could have been referring to there.

@Mr.Wizard I use it a lot because I don't have to redo the arrows and labels when I do minor modifications to the plot

@Ghersic I need to go for today, or at least for the morning. I'll be happy to talk again soon, but J. M. may answer your question in the mean time it appears.

Alright, thank you again for all of your help @Mr.Wizard. I'll be sure to visit chat again soon, hopefully to be able to tell you what all this effort is for since you at least deserve knowing that!

See you later!

Bye, thanks again!
Earlier Mr.Wizard linked an article I've linked below (because I still need to figure out how to shorten the address to a link). It seems easy enough to integrate into labelling my own curves, but I have a time-series collection of data and here he seems to use `len := Length[fns[x]]`whereas my data is not from an equation, it is from an experiment, so I lack the defined fns[x] ... despite that being my research's goal to determine, of course ;).

http://stackoverflow.com/questions/7221315/how-do-i-label-different-curves-in-mathematica
No obligation to look at it of course haha, you had just asked if I meant a parametric equation earlier.

4:30 PM
@Ghersic If all ye have are data points, then you use `ListPlot[]` instead of `Plot[]`. Should still be amenable to labeling.

@belisarius I do hope to grapple with your interactive labelling of curves you linked. I am sorely noob though, so I have some wading to do before I get to that point, I think haha.

If you're stuck on `Plot[]`, you could build an interpolating function outta yer points with `Interpolation[]`.

@Ghersic :D

I'm currently using `ListLogLinearPlot` and have labels, but they overlap significantly and are less "dynamic" than the linked article's.
I'm not too concerned though, as I have come leaps and bounds so far from the painful, 100+ line, alter-each-line-per-dataset code I was using before to only having to worry about a little legending.

@Ghersic How long are these labels?

4:38 PM
an example of one of the labels is "AP6-214"
So, not terribly long, and they could be shortened to 4 characters even. Simply a matter of having 10 datasets represented on 1 graph (down from 29 on 1 to 10-10-9 on 3).
I shall fiddle with it some. This community is pretty awesome, independant of their utility / helpfulness, so "I'll be back," likely this evening haha. Meanwhile it's lab inspection day for us so I must get to hiding the tea / coffee / poorly placed consumables. Have a good day everyone!

@Ghersic That looks like there's too much going on in one graph. You can't group the data?
See ya.

5:41 PM
@J.M. Just between runs of experiments. I agree, it may end up being too much for one graph, in which case I might opt for splitting the entire dataset into fifths instead of thirds, if I can't achieve the most desired / sexier method Mr.W linked to (whose drag-able labels would fit my graph perfectly).
(It's currently grouped in thirds)

@Ghersic Yes, if there's a logical grouping of the datasets, implement that. I know I find it terribly confusing when people stuff too much into just one picture.

Alrighty, I'll do that if I can't implement another method! Thanks!

2 hours later…
7:24 PM
hi