« first day (431 days earlier)      last day (4059 days later) » 

12:05 AM
@OleksandrR. Hmm... You could pass FilterRules[Options[f], Options[g]] to g instead of individual options
 
@rm-rf but options given explicitly in the call to f will not be included in Options[f] (they are known only by OptionValue)...
 
@OleksandrR. Oh, you said "defaults for f", which is why I suggested that
 
@rm-rf sorry, I suppose I was unclear. I meant the union of the defaults and any explicitly given options
 
Then why not do FilterRules[{opts}, Options[g]], where opts is from the definition of f[..., opts: OptionsPattern[]
 
@rm-rf unfortunately that is a literal pattern match; it does not do the same magic as OptionValue does
 
12:11 AM
@OleksandrR. DeleteDuplicates[FilterRules[{opts}, Options[g]] ~Join~ Options[g], First@# === First@#2 &] then? Options that come first trump same options that come later (perhaps with a different value), so you could just join them and not bother deleting
 
@rm-rf hm, interesting approach with DeleteDuplicates; I hadn't considered that. I was thinking of something like:
Options[gg] /.
 HoldPattern[opt_~(op : Rule | RuleDelayed)~_] :>
  opt~op~OptionValue[ff, opt]
 
@OleksandrR. The problem with that is that if opt is not a default option in ff, you'll get an error
 
@rm-rf good point
 
If I understood you correctly, the following demonstrates what you want:
ClearAll@g
Options[g] = {"a" -> 2, "c" -> 2};
g[o : OptionsPattern[]] := {"a" -> OptionValue["a"],  "c" -> OptionValue["c"]}

ClearAll@f
Options[f] = {"a" -> 1, "b" -> 2};
f[o : OptionsPattern[]] := With[{gOpts = FilterRules[{o}, Options[g]]~Join~Options[g]},  g[gOpts]]
f["a" -> 3, "c" -> 4]
f["b" -> 2]
f["a" -> 2, "b" -> 2]
 
@rm-rf almost... f["b" -> 2] should give {"a" -> 1, "c" -> 2} (defaults from f), not {"a" -> 2, "c" -> 2} (defaults from g)
 
12:27 AM
@OleksandrR. Oh, that can be done... I didn't know that was required too. Just join FilterRules[Options[f], Options[g]] before Options[g] in the With
i.e., gOpts = Join[FilterRules[{o}, Options[g]], FilterRules[Options[f], Options[g]], Options[g]]
You can actually omit the Options[g] at the end, as it'll pick up whatever is not specified from the defaults anyway
 
@rm-rf hmm, seems like a viable approach
Thanks; I think I was overcomplicating matters
 
No problem :)
 
@rm-rf oh, wait... f["a" -> 3, "c" -> 4] also should give {"a" -> 3, "c" -> 2} and a warning because "c" isn't a valid option for f
 
@OleksandrR. But I didn't add a check for that; by default it'll accept anything you give it
Only OptionValue will throw an error
 
@rm-rf yes, I know. That's why I was trying to involve OptionValue and wished to avoid too many extra levels of checking
 
12:40 AM
Which brings us to what I was talking about earlier :)
@OleksandrR. The problem with using OptionValue for this is that you cannot map it on the options (or at least, that's what I seem to remember). The option needs to be explicit
 
@rm-rf yes, that's indeed the case
Hence my ReplaceAll...
 
So you did not want to override other options in g by passing them through f?
 
@rm-rf yeah, that's right. Only ones that are explicitly options of f should carry through.
 
You could perhaps add a simple check for that using FilterRules[{opts}, Options[f]] === {opts}
 
1:00 AM
@rm-rf can you see a problem with changing my first attempt to include FilterRules[Options[gg], Options[ff]] in place of simply Options[gg] as the first arg to ReplaceAll?
Wait, same problems... should have tested before asking
@rm-rf oops, that's not right either... I screwed up by copying your test case, but copied it too literally (forgot to change f to ff!). That does actually work fine, AFAICT. So the question stands--do you see an issue? :)
ClearAll[gg];
Options[gg] = {a :> 1, c -> 3};
gg[opts : OptionsPattern[gg]] := {OptionValue[a], OptionValue[c]};

ClearAll[ff];
Options[ff] = {a -> 2, b :> 4};
ff[opts : OptionsPattern[ff]] := gg[
   FilterRules[Options[gg], Options[ff]] /.
    HoldPattern[opt_~(op : Rule | RuleDelayed)~_] :>
     opt~op~OptionValue[ff, opt]
   ];

ff[a -> 3, c -> 4]
ff[b -> 2]
ff[a -> 2, b -> 2]
 
1:19 AM
Is there an obvious way a string from HoldComplete[a/b*c] in FullForm?
The output should be "HoldComplete[Times[Times[a,Power[b,-1]],c]]"
 
@halirutan I think I misunderstand you. Why is ToString@FullForm@HoldComplete[a/b*c] not suitable?
 
@OleksandrR. Because I'm dump ;-)
@OleksandrR. Thanks. It's not even too late for me, so I don't have an excuse for this cache miss..
 
@halirutan I think you found a bug/omission though. Seemingly FullForm should be a member of $PrintForms. But it's Locked, so... tough...?
 
@OleksandrR. I was too keen to know why smth like ToString[.., FullForm] was not working..
 
@halirutan $PrintForms::usage claims that "it is automatically updated when Format definitions using new printforms are made." But Format[Unique[], FullForm] := Null; causes a big mess...
Maybe a question should be posted as this smells like a bug.
 
acl
1:27 AM
All, this seems to be one of the usual problems with needing f[b_?NumericQ] etc. which is the canonical question to link to, if any?
there's too many answers
 
@OleksandrR. so I better not try it now..
 
@halirutan actually this might be my unfamiliarity with Format rather than a bug per se. (I never use it because I find its attempts to do everything for you automatically highly confusing and unreliable.) This does work:
Format[myFullForm[x_], FullForm] := FullForm[x];
ToString[myFullForm@HoldComplete[a/b*c], FullForm]
 
@OleksandrR. I only need it for a function and not always. So I'm fine with typing it manually.
 
@acl I think the canonical answer is one of rcollyer's... he sent it to me before but I can't remember which it is now
 
acl
@OleksandrR. neither can I. I'll search for it later, no point in duplicating effort
 
1:35 AM
@acl I found this to be an extraordinarily clear instance that could perhaps become a canonical answer but there have been so many of them in the mean time that I haven't written one. You could do so now if you feel like it.
 
acl
@OleksandrR. I don't that's the point :)
 
@acl do you see any potential problems with this? Don't feel obliged if you're busy, but there's procrastination potential in there for you...
@acl I cast my vote as TL for now since someone else will find the right one later on and that will override mine
 
acl
@OleksandrR. sorry, I never use options. No clue.
@OleksandrR. as for procrastination, reading up on the recent collapse of the entire financial sector (at best) in cyprus is giving me procrastination material beyond my wildest dreams
 
2:09 AM
@acl no problem, thanks anyway
@acl also in the news, Berezovsky has been found dead (as you probably saw already)
 
acl
@OleksandrR. yes; maybe he had invested there :)
 
@acl I think that is indeed the suspicion
 
acl
@OleksandrR. I understood from the few articles I read that he had financial trouble after the abramovich court case
I don't think losing 20% or even 40% of your wealth would be such a huge blow if you have millions. if you're broke, though...
 
@acl he probably already was in trouble and hoped for this to save him, but the court was completely unconvinced by anything he said and branded him a "fundamentally unreliable witness". So after that judgment there was no hope for appeal, really
 
acl
@OleksandrR. yep, read all about it in the guardian.
 
2:25 AM
Quick question: How to use the Iff to check if a number is even? I've tried something like: If[Length[l] == EvenQ, ..., ...]
How to issue the command: "If n is odd, do..."
 
acl
@GustavoBandeira try If[EvenQ[Length@i],blah]
EvenQ is a predicate
 
2:46 AM
@acl Oh, it worked. Thanks for your help.
 
 
1 hour later…
3:51 AM
@belisarius You've still got an extra ]; and a missing comma in p01
By the way, Hi!
 
@MichaelE2 Yep, I just found it, but found an improvement and I'm going to edit for both of them in a few minutes
HI!
 
@belisarius Nice use of RegionPlot3D.
 
@MichaelE2 I always wonder how that kind of solutions will play in future versions on Mma ...
 
@belisarius You mean you think the structure of the output of RegionPlot3D might change?
 
@MichaelE2 Yep. Why not? It's an internal decision after all
 
3:58 AM
I often take advantage of the plot functions that yield a GraphicsComplex and I worry about the same thing.
 
@MichaelE2 That's the point
 
@belisarius The docs: "RegionPlot3D returns Graphics3D[GraphicsComplex[data]]. "
It could still change, I suppose.
 
@MichaelE2 There, see my "new" answer
 
@belisarius Nice. You're still missing a comma after Boxed -> False.
 
damn
 
4:04 AM
@belisarius The second of the OP's is an upside down version. You should rotate one of yours.
 
@MichaelE2 Let's try :)
The trick is `PlotPoints -> 2,
MaxRecursion -> 0`
Because if not, you end up mnipulating 1000 polygons
 
@belisarius Neat. (Yes, I've used them before.) I suspect the OP should be happy to find out about Translate and Rotate.
 
@MichaelE2 In any case one of those solutions should be of his taste, yes
 
@belisarius I would think so.
 
@MichaelE2 I think you could improve your answer
 
4:14 AM
@belisarius Is it obvious or would you give me a hint? It's getting late for me....
 
@MichaelE2 Translating ' y <= 1 - 0.5 z, {x, 0, 1}, {y, 0, 1}, {z, 0, 1}' into '{y == 0 || y == 1 - 0.5` z, x == 0 || x == 1, z == 0 || z == 1}'
automagically
 
@belisarius I actually had that at first, but thought it was being lazy by not writing it out. It was so short to type...
 
So you could tranlate his RegionPlot to your form
 
@belisarius That's what I did. Then pasted the equations into Solve. You think it would be better that way?
 
@MichaelE2 Let me show you. I think I'm not being clear enough. Wait a minute
@MichaelE2 Something like
p02 := RegionPlot3D[y <= 1 - 0.5 z, {x, 0, 1}, {y, 0, 1}, {z, 0, 1}];
((OwnValues@p02) /. RuleDelayed[x_, y_] :> Hold[y])
And then
working that out to get your hexawhatever
 
4:27 AM
@belisarius I see. I wouldn't have thought of OwnValues. Not familiar with it. One problem is can be seen from what I did:
Flatten@{y == 0 ||
   y == 1 - 0.5 z, (#[[2]] == #[[1]] || #[[1]] == #[[3]]) & /@ {{x, 0,
      1},(*{y,0,1},*){z, 0, 1}}}
{var, a, b} should transform to var==a || var==b, except for y. I worry about how to choose y.
 
@MichaelE2 wait
 
4:39 AM
@MichaelE2 Something like
p02 := RegionPlot3D[y <= 1 - 0.5 z, {x, 0, 1}, {y, 0, 1}, {z, 0, 1}];
s = ((OwnValues@p02) /. RuleDelayed[x_, RegionPlot3D[y__]] :> y);
And @@ Join[s[[1 ;; 1]],
Less @@ {#[[2]], #[[1]], #[[3]]} & /@ s[[2 ;;]]]
 
@belisarius OK, this does it (I think)
p02 := RegionPlot3D[
  y <= 1 - 0.5 z, {x, 0, 1}, {y, 0, 1}, {z, 0,
   1}]; s = ((OwnValues@p02) /.
   RuleDelayed[x_, RegionPlot3D[y__]] :> y);
Solve[#[[3]] == #[[1]] || #[[3]] == #[[5]] & /@
  Reduce[And @@
    Join[s[[1 ;; 1]],
     Less @@ {#[[2]], #[[1]], #[[3]]} & /@ s[[2 ;;]]], {}], {x, y, z}]
 
@MichaelE2 pure genius :)
 
@belisarius I didn't really know about using OwnValues that way, so I couldn't have done it without you. I did write a program to automatically set up triple integrals, and I think the Reduce is necessary.
 
@MichaelE2 Sorry, need to go. Perhaps there is an easier way without using OwnValues, I'll think about it. See ya
 
@belisarius Good night
 
 
3 hours later…
7:50 AM
@OleksandrR. sorry, just got back and it's way too late here. I'll look at it and reply tomorrow when I'm sober.
 
 
2 hours later…
9:55 AM
Hello, any idea on how to turn off a builtin message whenever a certain function is called but not for any other?
@rm-rf Aaah, the obligatory Saturday-night-forget-the-week-drinking-like-theres-no-tomorrow-event? : )
 
10:49 AM
@IstvánZachar You can inject the Off[msg] into the function before the routine is called.
 
11:00 AM
@IstvánZachar Here is an example:
Unprotect[NSolve];
NSolve[args__] := Block[{calledQ = True, result},
    Quiet[NSolve[args], {NSolve::infsolns}]
    ] /; Not[TrueQ[calledQ]];
Protect[NSolve];
This is a bit useless, because NSolve is the only function using this message, but you should grasp the idea.
 
@halirutan Sure, I forgot about the Quiet command, thanks!
Also, my example goes a bit different:

f[expr_, patt_: Except[_List]] := MatchQ[expr, patt]
Do I have to wrap the whole definition in Quiet?
 
@rm-rf well, there's at least one potential problem... ReplaceAll isn't right; it should be Replace[..., {1}].
Other than that, I think it's okay.
 
11:19 AM
@IstvánZachar I thought you want to quiet builtin messages (for builtin functions)?
Maybe I misunderstood you. Can you give a small example where a message is thrown you want to suppress?
 
No, sorry: builtin message for custom-made functions. As you see, my example produces a warning that - according to the Documentation - can be ignored.
@halirutan f[expr_, patt_: Except[_List]] := MatchQ[expr, patt] issues Optional::opdef warning.
 
11:37 AM
@IstvánZachar Yes, then
Quiet[f[expr_, patt_: Except[_List]] := MatchQ[expr, patt], Optional::opdef]
 
@halirutan Ok, thanks! I was a bit afraid about the wrapper possibly interfering with the function application.
 
@IstvánZachar You could instead use this notation:
ClearAll[f];
Default[f, 2, 2] = Except[_List];
f[expr_, Optional[patt_]] := MatchQ[expr, patt]
Although the 2,2 shouldn't be required.
 
 
1 hour later…
1:06 PM
@whuber To ping someone, I think you have to specify at least 3 letters. Therefore @rco is required to get the attention of @rcollyer.
@OleksandrR. @whuber @rcollyer Would someone of you write up an answer to this here?
The question is not so bad and shows effort of the OP. It shouldn't stay un-answered. Be sure I vote for and answer ;-)
 
acl
@halirutan guess they are telepathic...
@halirutan (could you please ping me, I am testing my browser settings; thanks)
 
@acl With the chat short-cut plugin you could ping yourself ;-)
 
acl
@halirutan thanks, I'll test that once I am done. could you possibly do it once more? just once :) thanks
 
@acl Booom
 
acl
@halirutan thanks!
@halirutan I think you forgot to link to something here...
 
1:15 PM
@OleksandrR. @whuber @rcollyer I mean this question here mathematica.stackexchange.com/q/20285/187
@acl Yes, you chimed in when I was about to post the link and I forgot it afterwards.
 
 
1 hour later…
2:21 PM
@halirutan the question is not so bad but it's TL--she didn't specify starting values so the fit didn't converge. I voted to close it and think it should just be deleted
@halirutan with SigmaPlot you have to specify initial values. Chances are she gave more sensible ones than Mathematica's defaults (i.e. 1 for every parameter). whuber's comments about linearization are useful even if only for obtaining usable initial values for a nonlinear fit but I don't think the suggestion is particularly generalizable
 
2:52 PM
4
Q: How to silence all messages associated with a built-in symbol?

kjoThe post title's pretty much says it all... The reminder of this post just describes the little headway I made with this problem, FWIW. One would hope that In[100]:= Quiet[whatever[], Messages[SomeArbitraryBuiltIn]] would do it, but no. For one thing, Messages shows only those messages th...

 
3:05 PM
@OleksandrR. Yes, it looks like it's okay. Using OptionValue explicitly also allows you to get the warning that you wanted.
 
@OleksandrR. I just thought because the Q has already 4 upvotes and it was discussed in the comments heavily. We Q which are by far worse and a short answer would resolve the situation and someone.
I read as bottom line the question What can I do when NMinimize does not find a good minimum because my parameters differ by magnitudes.
 
3:28 PM
@halirutan in that case isn't it a duplicate of this?
 
 
2 hours later…
5:05 PM
@halirutan btw, just in case you didn't know... you can't ping arbitrary users in chat either (your pings to rcollyer and whuber will not be delivered). You can only ping them if they are in chat at present or if they have been around in the past X time units, where X is kinda fuzzy (a good approximation is: does their name show up in the chat log if you scroll up till you need to press "load more".)
 
5:19 PM
@rm-rf I didn't know that. I realized, that suggestions only work for certain users but I thought they get pinged. I would have written this in a comment, but there you can only ping one user and the OP at the same time.
So bottom line is, that I have no way to get the attention of an arbitrary user? I mean not everything should be posted as comment.
Superping is only available for mods?
@OleksandrR. I had hoped one of you three can decide this better because you were already involved with the topic. I only skimmed through it ;-)
I just don't want to leave it unanswered.
 
5:36 PM
0
Q: problem in copying input

Math.fI want to copy the input from Mathematica, but when I'm doing that, I see here different input. I mean how can I copy the input from Mathematica and post here the exact input to ask you a question? I have copied a which is look like when I post here DSolve[Subscript[\[Phi], 4]''[\[Tau]] + Subs...

 
5:47 PM
@halirutan Yes, it is mods only. There is no way to get the attention of an arbitrary user, and I think this is a very good decision. Imagine if you could — there'd be an endless stream of pings from random low rep/new users pinging @halirutan for every single minor question just because they happened to see your answer somewhere...
 
acl
6:00 PM
@rm-rf there were attempts to do this recently; also someone asking for email to continue. as if it's our job to solve their problems
can i have your e-mail ? — Lucas G Leite F Pollito 3 mins ago
second time
 
6:36 PM
@acl Yup, exactly what I'm talking about... there are actually several such comments from new/low rep users on the site. No one knows about them, because they never get pinged =) I just remove such comments.
 
 
1 hour later…
7:56 PM
Hm the last week I have used a "discussion between"-room to ping others that were not originally there. So these users never got pinged... Ah I see clicking about on mathematica.stackexchange.com leads to nice information, which I should have realized earlier. But there do not appear to be links there to things like "formatting questions/answers" or pinging. When I arrived here I was greeted warmly by Mr.Wizard, including a link to /editing-help . And of course there is also the meta site..but..
shouldn't the about site be just a little more exhaustive?
 
8:11 PM
@Mr.Wizard @Leonid Shifrin Perhaps you would be interested to know I have made a new answer here: mathematica.stackexchange.com/… ? I realize it may be not very well documented as well as that the subject might be a little over my head, as I feel Leonid's answer is the superior one. So if you have seen it but ignored it, well, that is too bad. But to me this is a method that deserves to be looked at further. I would also very much appreciate any comment that can put this in some context.
woops, link doesn't work. Heres the link: mathematica.stackexchange.com/a/21801/4330
 
8:25 PM
@jacob The about page was meant for those who know nothing about stack exchange and happened to stumble upon our site. There's the /faq page for more. If you want the editing help page, there's always a link to it when you write a post (look in the right sidebar).for comments, click the ?
 
@rm -rf ah thank you :). I'll go see if there is some major FAQs that are a gap in my basic skills
 
9:17 PM
huhu
is there a way to export a manipulate plot ?
 
9:32 PM
i hate it when wolframalpha doesn't make the same fancy plots as mathematica, so i can't share them :(
 
hm.. -saving and sharing a picture made by mathematica, whenever such sharing is possible- will just have to do? I don't know about manipulate. You can make .avi files out of Animate. I think you can use your interfaces like manipulate with its slides in an embedded way in a website.. Who knows if the player can show interfaces..
 
how to make an avi file ?
 
Export["testtesttest.avi",
Animate[Plot[x^n, {x, 0, 1}], {n, 0, 1, 0.1}]]

Make sure to set your directory and give it a second, it took about 30 seconds here
 
6
Q: Exporting images as .avi

AnonHere's a list of images: images = Table[ExampleData[i], {i, ExampleData["TestImage"]}]; And according to the reference "Export exports a list of graphics, images, or arbitrary expressions, taking each element to be an animation frame." This is on the reference page for .avi. However, Export["...

 
9:52 PM
I don't know if this was the right approach to a low-effort question, but you can give a guy a fish or give him a rod and teach him how to fish...
 
If you give a programmer a fish function, he will eat pizza and play with the function for one day. But if you give him a programming language, he will make his own fish functions and eat pizza for a lifetime. (from land of lisp)
 
10:19 PM
@Verbeia Much more helpful for the OP than just the answer.
 
Hm... I can do

qqq = Nest[Hold, 0, 10000];
Cases[qqq, 0, Infinity] == {0}
-> True

,but I cannot do

Nest[Hold, 0, 10000] (* without the ; *)
-prints to messages--> Recursion depth of 4096 exceeded

Funky
 
10:52 PM
also my $RecursionLimit had the value 1024, not 4096.
 
11:28 PM
Hm, ToExpression does not like deeply nested "string-expressions". I was going to ask a question, but I guess nobody would really care :P. Maybe somebody here will still want to see:

mmm = 509;
Cases[ToExpression[
StringJoin[
Join[ConstantArray["{", mmm], {"Null"},
ConstantArray["}", mmm]]]], Null, Infinity]

--> {Null}

So that it interprets this string as we expect. However

ToExpression[
StringJoin[
Join[ConstantArray["{", mmm], {"Null"}, ConstantArray["}", mmm]]]]

-> $Failed

Note that similarly, SyntaxQ gives false and SyntaxLength drops as mmm goes from 509 to 510. It seems that the
 
11:47 PM
@Verbeia that's very kind of you, but I prefer to think of this sort of OP as deserving either a slap with the fish or a good thrashing with the fishing rod (your choice)
 
If you slap him with the fish, he will remember for one day....
 

« first day (431 days earlier)      last day (4059 days later) »