Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #3026 > unrolled thread
| Started by | Murray Eisenberg <murray@math.umass.edu> |
|---|---|
| First post | 2011-06-08 11:16 +0000 |
| Last post | 2011-06-15 11:19 +0000 |
| Articles | 13 — 10 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
Re: How show axes labels with AxesOrigin->{0,0,0} in 3D? Murray Eisenberg <murray@math.umass.edu> - 2011-06-08 11:16 +0000
Re: How show axes labels with AxesOrigin->{0,0,0} in 3D? Peter Breitfeld <phbrf@t-online.de> - 2011-06-09 09:45 +0000
Is there ToNumber? Ted Sariyski <tsariysk@craft-tech.com> - 2011-06-11 07:59 +0000
Re: Is there ToNumber? Albert Retey <awnl@gmx-topmail.de> - 2011-06-14 11:52 +0000
How to extract a pattern Ted Sariyski <tsariysk@craft-tech.com> - 2011-06-15 11:20 +0000
Re: Is there ToNumber? "Hans Michel" <hmichel@cox.net> - 2011-06-16 08:02 +0000
Re: Is there ToNumber? "Dr. Peter Klamser" <klamser@googlemail.com> - 2011-06-11 10:52 +0000
Re: Is there ToNumber? "Harvey P. Dale" <hpd1@nyu.edu> - 2011-06-12 09:07 +0000
Re: Is there ToNumber? ADL <alberto.dilullo@tiscali.it> - 2011-06-12 09:07 +0000
Re: Is there ToNumber? "Hans Michel" <hmichel@cox.net> - 2011-06-12 23:00 +0000
Re: Is there ToNumber? "Dr. Peter Klamser" <klamser@googlemail.com> - 2011-06-12 23:01 +0000
Re: Is there ToNumber? DrMajorBob <btreat1@austin.rr.com> - 2011-06-15 11:19 +0000
Re: Is there ToNumber? Daniel Lichtblau <danl@wolfram.com> - 2011-06-15 11:19 +0000
| From | Murray Eisenberg <murray@math.umass.edu> |
|---|---|
| Date | 2011-06-08 11:16 +0000 |
| Subject | Re: How show axes labels with AxesOrigin->{0,0,0} in 3D? |
| Message-ID | <isnllk$n7b$1@smc.vnet.net> |
Aha! Thanks for spotting that the 3D axes labels are really there. But
they're hardly in an optimal position.
In 2D, the axes labels are at the ends of the axes. So you'd think, for
the sake of Mathematica's much-vaunted consistency, that the same would
be the case in 3D.
The example does not really make a reasonable argument against using
axes in 3D that emanate from the origin. Rather, it makes a convincing
argument that WRI made a dumb design decision when they implemented
AxesOrigin for 3D.
On 6/7/2011 6:46 AM, Robert Rosenbaum wrote:
> Running your example on my Mathematica 7 in OS X, the axes labels appear, but are small and difficult to distinguish from the mesh lines on the surface. I hazard to guess that they appear on your machine too, but you failed to detect them by eye.
>
> The following modification makes the labels more apparent:
>
> mystyle = {Red, 16};
> Plot3D[x^2 - y^2, {x, -2, 2}, {y, -2, 2}, AxesOrigin -> {0, 0, 0},
> AxesLabel -> {Style["x", mystyle], Style["y", mystyle],
> Style["z", mystyle]}, BoxRatios -> {1, 1, 1}, Boxed -> False,
> MeshStyle -> None]
>
> Incidentally, your example makes a reasonable argument against using axes that emanate from the origin. Of course, if axes labels were placed at the ends of the axes instead of along the axes, they would be easier to see in your example. Perhaps there is a way to accomplish this.
>
>
>
> On Jun 6, 2011, at 5:23 AM, Murray Eisenberg wrote:
>
>> Since Mathematica 7, 3D graphics has allowed the AxesOrigin option so
>> that, for example, the axes can go through the origin {0,0,0}, just like
>> the way that mathematicians (or at least college calculus teachers) do
>> it and teach their students to do it.
>>
>> That works, but...
>>
>> If you include an AxesLabel option, the labels do not appear, e.g., from:
>>
>> Plot3D[x^2 - y^2, {x, -2, 2}, {y, -2, 2},
>> AxesOrigin -> {0, 0, 0},
>> AxesLabel -> {x, y, z},
>> BoxRatios -> {1, 1, 1}, Boxed -> False]
>>
>> Is there some way to make the axes labels appear (other than to add them
>> manually using the Text function, say in an Epilog)?
>>
>> [And is this just another instance of WRI protracted stubbornness even
>> in admitting that having 3D axes emanating from the origin is a
>> permissible way of handling 3D graphics? (Scientific/engineering
>> convention seems overwhelmingly to favor axes along edges of a 3D
>> graphic, whereas in math -- as I suggested, at least in multivariable
>> calculus -- axes emanating from the origin is the norm.)
>>
>> --
>> Murray Eisenberg murray@math.umass.edu
>> Mathematics& Statistics Dept.
>> Lederle Graduate Research Tower phone 413 549-1020 (H)
>> University of Massachusetts 413 545-2859 (W)
>> 710 North Pleasant Street fax 413 545-1801
>> Amherst, MA 01003-9305
>>
>
>
> Best,
> Robert
>
>
>
>
>
--
Murray Eisenberg murray@math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305
[toc] | [next] | [standalone]
| From | Peter Breitfeld <phbrf@t-online.de> |
|---|---|
| Date | 2011-06-09 09:45 +0000 |
| Message-ID | <isq4na$62s$1@smc.vnet.net> |
| In reply to | #3026 |
Murray Eisenberg wrote:
> Aha! Thanks for spotting that the 3D axes labels are really there. But
> they're hardly in an optimal position.
>
> In 2D, the axes labels are at the ends of the axes. So you'd think, for
> the sake of Mathematica's much-vaunted consistency, that the same would
> be the case in 3D.
>
> The example does not really make a reasonable argument against using
> axes in 3D that emanate from the origin. Rather, it makes a convincing
> argument that WRI made a dumb design decision when they implemented
> AxesOrigin for 3D.
>
> On 6/7/2011 6:46 AM, Robert Rosenbaum wrote:
I followed this thread and my opinion is, that at least in education
area axes trough the origin are often used. So I ended with the
following function, which places labels at the end of the axes and plot
any Graphics3D with axes:
NoOpt[x__]:=And@@(Not[OptionQ[#]]&)/@{x}
SyntaxInformation[AchsenStattPlot]=
{"ArgumentsPattern"->{_,_.,_.,_.,_.,OptionsPattern[]}};
AchsenStattBox[g_Graphics3D,
achsenOrigin_: {0, 0, 0},
labFakt :(_Real | _Integer | _List) : 1.2,
labColor_: Red,
labSize_: 16,
opts:OptionsPattern[]]/;NoOpt[achsenOrigin,labFakt,labColor,labSize]:=
Module[{labels, o = achsenOrigin, xmax, ymax, zmax, lx, ly, lz},
If[Head[labFakt] === List, {lx, ly, lz} = labFakt,
{lx, ly, lz} = ConstantArray[labFakt, 3]];
{xmax, ymax, zmax} = #[[2]] & /@ AbsoluteOptions[g, PlotRange][[1, 2]];
labels = {
Text[Style["x", labSize, labColor], {xmax lx, o[[2]], o[[3]]}],
Text[Style["y", labSize, labColor], {o[[1]], ymax ly, o[[3]]}],
Text[Style["z", labSize, labColor], {o[[1]], o[[2]], zmax lz}]};
Show[{g, Graphics3D[{labels}]},
AxesLabel->None, Boxed -> False, AxesOrigin -> o,Evaluate[opts]]
]
--
_________________________________________________________________
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de
[toc] | [prev] | [next] | [standalone]
| From | Ted Sariyski <tsariysk@craft-tech.com> |
|---|---|
| Date | 2011-06-11 07:59 +0000 |
| Subject | Is there ToNumber? |
| Message-ID | <isv78n$80$1@smc.vnet.net> |
| In reply to | #3026 |
Hi, Is there a built-in function which returns the numeric value of a string (like ToString but inverse). Currently I use mine function toNumber: ch = StringToStream[timeStr]; timeNum = Read[ch, Number]; Close[ch]; but I suspect there is easier way. Thanks in advance, --Ted
[toc] | [prev] | [next] | [standalone]
| From | Albert Retey <awnl@gmx-topmail.de> |
|---|---|
| Date | 2011-06-14 11:52 +0000 |
| Subject | Re: Is there ToNumber? |
| Message-ID | <it7i1h$787$1@smc.vnet.net> |
| In reply to | #3069 |
Hi,
the short answer is: no.
> Is there a built-in function which returns the numeric value of a string
> (like ToString but inverse). Currently I use mine function toNumber:
>
> ch = StringToStream[timeStr];
> timeNum = Read[ch, Number];
> Close[ch];
>
> but I suspect there is easier way.
The question is what kind of input you expect "ToNumber" to handle. As
others have pointed out ToExpression is the most simple and also
relatively fast but only works for numbers given in Mathematica syntax.
If you need to handle other formats, then there are alternatives to what
you do, but they seem to be slower if used in a naive way, e.g.:
ImportString["1e3", "Table"][[1, 1]]
whether you consider that to be "easier" is another question. What about
defining:
toNumber[s_String] := Module[{ch, res},
ch = StringToStream[s];
res = Read[ch, Number];
Close[ch];
res
];
This is easy to use and also relatively fast. Is there a reason why you
think that is not good enough? If you need further advice, I think it
would be necessary to specify where these strings come from...
hth,
albert
[toc] | [prev] | [next] | [standalone]
| From | Ted Sariyski <tsariysk@craft-tech.com> |
|---|---|
| Date | 2011-06-15 11:20 +0000 |
| Subject | How to extract a pattern |
| Message-ID | <ita4hk$m9i$1@smc.vnet.net> |
| In reply to | #3069 |
Hi,
I have the following problem. I have to extract from a file data
structure which is specified by a label (e.g. "A"), a set of points
("lbl") and the corresponding weights ("mod") (example is attached).
Data is berried within a lot of garbage. The only invariant structure in
all files is e.g.:
{"(iter)","Filter", "A"}, {"lbl", 5, 2., 20., 20.,20., 2.}, {"mod", 5,
0., 0.6, 0., 0.7, 0.}
where "ilter", "lbl" and "mod" are always present but "{iter}" differs
from file to file. The first element after "lbl" and "mod" is the same
- the number of point for this filter.
How can I extract only these list elements which contain "Filter" and
"lbl" and "mod"?
Thanks in advance,
Ted
{{"MEN(00)=", "total", "sa=", 3.717*10^-6, "[um]"}, {"Field", "[m/s]:",
2.615, 80., 83.,51., 10., 6., 5., 66.,1.175}, {"Filtered", "[m/s]:",
1.2, 4.2, 2., 46., 520., 990., 800., 143., 862.}, {},
{"(iter)", "Filter", "A"}, {"lbl", 5, 2., 20., 20., 20., 2.}, {"mod", 5,
0., 0.6, 0., 0.7, 0.},
{"(iter)", "Filter", "B"}, {"lbl", 1, 14., 14., 600.,660., 50., 20.,
10., 15., 16., 1.}, {"mod", 10, 0., 0.14, 1., 0.97, 0.97, 0.9, 0.89,
0.7, 0.1, 0.},
{"(iter)", "Filter", "C"}, {"lbl", 5, 1., 1., 1., 1., 1.}, {"mod", 5,
0., 0.1, 1., 0.6, 0.6},
{"(iter)", "Filter", "D"}, {"lbl", 7, 1., 1., 1., 1., 1., 1., 1.},
{"mod", 7, 0., 10., 0.1, 10., 0., 0.8, 0.},
{"(iter)", "Filter", "E"}, {"lbl", 5, 9.,9., 9., 9., 9.}, {"mod", 5, 0.,
0.2, 7., 0.9, 0.},
{"(iter)", "Filter", "F"}, {"lbl", 2, 3.,4.}, {"mod", 2, 1., 1.},
{"(iter)", "Filter", "G"}, {"lbl", 2, 3., 3.}, {"mod", 2, 1., 1.},
{"(iter)", "Filter", "H"}, {"lbl", 2, 1.,3.}, {"mod", 2, 1., 1.}, {"#"}}
[toc] | [prev] | [next] | [standalone]
| From | "Hans Michel" <hmichel@cox.net> |
|---|---|
| Date | 2011-06-16 08:02 +0000 |
| Subject | Re: Is there ToNumber? |
| Message-ID | <itcd9t$d0b$1@smc.vnet.net> |
| In reply to | #3069 |
Is it possible that you can post a few representative file names with the
time stamps.
Assuming that the "file name+time stamp + . + extension" is the file name.
Otherwise you may be speaking of file attributes. If you clarify your
problem to the group, you will probably have more answers to choose from.
But you seem to be hitting a road block and finding a solution and feel that
it maybe awkward.
Please post a representation of the problem and then your desired end point.
The raw data not the step you feel may have a better solution.
Mathematica has numerous DateTime functions and numerous functions for
directory information.
I feel that you may be asking a question such as:
What is an efficient way to grab a time stamp from a file name or file
attribute and serialize that time stamp to a number so I can sort it or do
something else with that number?.
Hans
-----Original Message-----
From: Ted Sariyski [mailto:tsariysk@craft-tech.com]
Sent: Wednesday, June 15, 2011 6:19 AM
Subject: Re: Is there ToNumber?
Hi,
> would be necessary to specify where these strings come from...
I had to extract the time stamp from the file names.
>Is there a reason why you
>think that is not good enough?
That is exactly what I am doing and it works fine. The only reason I
posted the question was because I felt that I am missing something.
Thanks,
--Ted
On 6/14/2011 7:51 AM, Albert Retey wrote:
> Hi,
>
> the short answer is: no.
>
>> Is there a built-in function which returns the numeric value of a string
>> (like ToString but inverse). Currently I use mine function toNumber:
>>
>> ch = StringToStream[timeStr];
>> timeNum = Read[ch, Number];
>> Close[ch];
>>
>> but I suspect there is easier way.
> The question is what kind of input you expect "ToNumber" to handle. As
> others have pointed out ToExpression is the most simple and also
> relatively fast but only works for numbers given in Mathematica syntax.
> If you need to handle other formats, then there are alternatives to what
> you do, but they seem to be slower if used in a naive way, e.g.:
>
> ImportString["1e3", "Table"][[1, 1]]
>
> whether you consider that to be "easier" is another question. What about
> defining:
>
> toNumber[s_String] := Module[{ch, res},
> ch = StringToStream[s];
> res = Read[ch, Number];
> Close[ch];
> res
> ];
>
> This is easy to use and also relatively fast. Is there a reason why you
> think that is not good enough? If you need further advice, I think it
> would be necessary to specify where these strings come from...
>
> hth,
>
> albert
>
[toc] | [prev] | [next] | [standalone]
| From | "Dr. Peter Klamser" <klamser@googlemail.com> |
|---|---|
| Date | 2011-06-11 10:52 +0000 |
| Subject | Re: Is there ToNumber? |
| Message-ID | <isvhci$20l$1@smc.vnet.net> |
| In reply to | #3026 |
... ToExpression["1+1"] One Hint: If you know a function in Mathematica like "ToString", you mentioned in your email, look in the help system in the section "see also", there you find ToExpression["1+1"]. Kind regards Peter Am 11.06.2011 09:59, schrieb Ted Sariyski: > Hi, > Is there a built-in function which returns the numeric value of a string > (like ToString but inverse). Currently I use mine function toNumber: > > ch = StringToStream[timeStr]; > timeNum = Read[ch, Number]; > Close[ch]; > > but I suspect there is easier way. > Thanks in advance, > --Ted > -- Mit freundlichen Grüßen Uta& Peter Klamser
[toc] | [prev] | [next] | [standalone]
| From | "Harvey P. Dale" <hpd1@nyu.edu> |
|---|---|
| Date | 2011-06-12 09:07 +0000 |
| Subject | Re: Is there ToNumber? |
| Message-ID | <it1vke$b72$1@smc.vnet.net> |
| In reply to | #3026 |
ToExpression. Best, Harvey -----Original Message----- From: Ted Sariyski [mailto:tsariysk@craft-tech.com] Sent: Saturday, June 11, 2011 3:59 AM Subject: Is there ToNumber? Hi, Is there a built-in function which returns the numeric value of a string (like ToString but inverse). Currently I use mine function toNumber: ch = StringToStream[timeStr]; timeNum = Read[ch, Number]; Close[ch]; but I suspect there is easier way. Thanks in advance, --Ted ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________
[toc] | [prev] | [next] | [standalone]
| From | ADL <alberto.dilullo@tiscali.it> |
|---|---|
| Date | 2011-06-12 09:07 +0000 |
| Subject | Re: Is there ToNumber? |
| Message-ID | <it1vl4$b7d$1@smc.vnet.net> |
| In reply to | #3026 |
On 11 Giu, 12:52, "Dr. Peter Klamser" <klam...@googlemail.com> wrote: > ... ToExpression["1+1"] > > One Hint: If you know a function in Mathematica like "ToString", you > mentioned in your email, look in the help system in the section "see > also", there you find ToExpression["1+1"]. > > Kind regards > > Peter > > Am 11.06.2011 09:59, schrieb Ted Sariyski: > > > Hi, > > Is there a built-in function which returns the numeric value of a string > > (like ToString but inverse). Currently I use mine function toNumber: > > > ch = StringToStream[timeStr]; > > timeNum = Read[ch, Number]; > > Close[ch]; > > > but I suspect there is easier way. > > Thanks in advance, > > --Ted > > -- > Mit freundlichen Gr en > > Uta& Peter Klamser The request is less trivial than ToExpression["1+1"] since, for example, typical number format cannot be read into Mathematica without the rather involved trick reported by Ted Sariyski. As an example, ToExpression["1e3"] ==> e3 ch = StringToStream["1e3"]; timeNum = Read[ch, Number]; Close[ch]; timeNum ==> 1000 I feel this complication as rather unfortunate, unless I am also missing a simpler way to read in numbers. ADL
[toc] | [prev] | [next] | [standalone]
| From | "Hans Michel" <hmichel@cox.net> |
|---|---|
| Date | 2011-06-12 23:00 +0000 |
| Subject | Re: Is there ToNumber? |
| Message-ID | <it3gf6$hlk$1@smc.vnet.net> |
| In reply to | #3026 |
-----Original Message----- From: ADL [mailto:alberto.dilullo@tiscali.it] Sent: Sunday, June 12, 2011 4:07 AM Subject: Re: Is there ToNumber? On 11 Giu, 12:52, "Dr. Peter Klamser" <klam...@googlemail.com> wrote: > ... ToExpression["1+1"] > > One Hint: If you know a function in Mathematica like "ToString", you > mentioned in your email, look in the help system in the section "see > also", there you find ToExpression["1+1"]. > > Kind regards > > Peter > > Am 11.06.2011 09:59, schrieb Ted Sariyski: > > > Hi, > > Is there a built-in function which returns the numeric value of a string > > (like ToString but inverse). Currently I use mine function toNumber: > > > ch = StringToStream[timeStr]; > > timeNum = Read[ch, Number]; > > Close[ch]; > > > but I suspect there is easier way. > > Thanks in advance, > > --Ted > > -- > Mit freundlichen Gr en > > Uta& Peter Klamser The request is less trivial than ToExpression["1+1"] since, for example, typical number format cannot be read into Mathematica without the rather involved trick reported by Ted Sariyski. As an example, ToExpression["1e3"] ==> e3 ch = StringToStream["1e3"]; timeNum = Read[ch, Number]; Close[ch]; timeNum ==> 1000 I feel this complication as rather unfortunate, unless I am also missing a simpler way to read in numbers. ADL
[toc] | [prev] | [next] | [standalone]
| From | "Dr. Peter Klamser" <klamser@googlemail.com> |
|---|---|
| Date | 2011-06-12 23:01 +0000 |
| Subject | Re: Is there ToNumber? |
| Message-ID | <it3gfh$hlm$1@smc.vnet.net> |
| In reply to | #3026 |
... ToExpression["1 e^3"] It looks for an string, that smells a little bit like a expression. I think it is good idea to offer something, that can be interpreted as an exponent. Kind regards Peter Am 12.06.2011 11:07, schrieb ADL: > On 11 Giu, 12:52, "Dr. Peter Klamser"<klam...@googlemail.com> wrote: >> ... ToExpression["1+1"] >> >> One Hint: If you know a function in Mathematica like "ToString", you >> mentioned in your email, look in the help system in the section "see >> also", there you find ToExpression["1+1"]. >> >> Kind regards >> >> Peter >> >> Am 11.06.2011 09:59, schrieb Ted Sariyski: >> >>> Hi, >>> Is there a built-in function which returns the numeric value of a string >>> (like ToString but inverse). Currently I use mine function toNumber: >>> ch = StringToStream[timeStr]; >>> timeNum = Read[ch, Number]; >>> Close[ch]; >>> but I suspect there is easier way. >>> Thanks in advance, >>> --Ted >> -- >> Mit freundlichen Gr en >> >> Uta& Peter Klamser > The request is less trivial than ToExpression["1+1"] since, for > example, typical number format cannot be read into Mathematica without > the rather involved trick reported by Ted Sariyski. As an example, > > ToExpression["1e3"] > ==> e3 > > > ch = StringToStream["1e3"]; > timeNum = Read[ch, Number]; > Close[ch]; > timeNum > ==> 1000 > > I feel this complication as rather unfortunate, unless I am also > missing a simpler way to read in numbers. > > ADL > -- Mit freundlichen Grüßen Uta& Peter Klamser
[toc] | [prev] | [next] | [standalone]
| From | DrMajorBob <btreat1@austin.rr.com> |
|---|---|
| Date | 2011-06-15 11:19 +0000 |
| Subject | Re: Is there ToNumber? |
| Message-ID | <ita4g9$m81$1@smc.vnet.net> |
| In reply to | #3026 |
'Cuz you can't. Simple. Bobby On Tue, 14 Jun 2011 05:13:39 -0500, SigmundV <sigmundv@gmail.com> wrote: > I had imagined that applying Real to the string would make it a > number, e.g. Real@@"1.2", but it doesn't work: > > In[1]:= Head[Real @@ "1.2"] > > Out[1]= String > > Of course ToExpression works as intented: > > In[2]:= Head[ToExpression@"1.2"] > > Out[2]= Real > > Why can't I simply change the head of a string by using Apply? > -- DrMajorBob@yahoo.com
[toc] | [prev] | [next] | [standalone]
| From | Daniel Lichtblau <danl@wolfram.com> |
|---|---|
| Date | 2011-06-15 11:19 +0000 |
| Subject | Re: Is there ToNumber? |
| Message-ID | <ita4gk$m89$1@smc.vnet.net> |
| In reply to | #3026 |
On 06/14/2011 05:13 AM, SigmundV wrote: > I had imagined that applying Real to the string would make it a > number, e.g. Real@@"1.2", but it doesn't work: > > In[1]:= Head[Real @@ "1.2"] > > Out[1]= String > > Of course ToExpression works as intented: > > In[2]:= Head[ToExpression@"1.2"] > > Out[2]= Real > > Why can't I simply change the head of a string by using Apply? Same reason one cannot change the head of an Integer. They are atomic. http://www.great-quotes.com/quote/1727982 In[3]:= Apply[Integer,1.0] Out[3]= 1. Moreover, even if String was not atomic an type, there is neither documentation nor functionality to suggest Real converts input to real numbers. Daniel Lichtblau Wolfram Research
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web