Re: [julia-users] Official recommendation for: conversions?

2015-03-21 Thread Simon Byrne
My rough interpretation (which is by no means the official one, as I think this is still up for debate), is as follows:, 1) convert(T,x) is the most specific: it will convert x to type T, throwing an error if outside the range (though it can round, for instance when converting to a Rational

Re: [julia-users] Official recommendation for: conversions?

2015-03-21 Thread Simon Byrne
On Saturday, 21 March 2015 09:38:23 UTC+1, Simon Byrne wrote: * in some cases, x can be a string: at the moment this seems to only work for BigFloat and BigInt, but perhaps this should apply to other types. See https://github.com/JuliaLang/julia/issues/10594 in case anyone has an opinion.

[julia-users] Re: Another (basic) parameterization question

2015-03-21 Thread Seth
Thanks for pointing me in the right direction. I fixed it. It turns out that when I set the unitrange (using 1:n), the 1 was being interpreted as Int64, which caused the UnitRange to be Int64, which messed things up. I now do a convert(T,1) in the construction and everything's good: julia

Re: [julia-users] Re: inserting an Expr into AST via macro

2015-03-21 Thread Abe Schneider
Sadly it looks like this doesn't entirely solve the problem. The issue is that while it does indeed insert the function into the Expr tree, the namespace for the variables is for the module that the macro is defined in, and not the user's file (the standard issue with eval'ing). For example,

Re: [julia-users] Re: inserting an Expr into AST via macro

2015-03-21 Thread Toivo Henningsson
Have you read the macro hygiene section in the manual chapter about metaprogramming? The esc function is what you want to be able to pass through symbols to be evaluated in the invoker's name space.

Re: [julia-users] Re: Basic install question

2015-03-21 Thread Mike Innes
This seems to happen on OS X occasionally, for some reason. What you can do is try the open a terminal repl command which will open a plain copy of the version of Julia that Juno is running from. You should be able to `Pkg.update()` from there, but if you see another error then let us know. On 17

Re: [julia-users] Re: Julia v0.3.6

2015-03-21 Thread Stefan Karpinski
We may want to consider doing the minimal number of backports now for 0.3.7 and then doing a bunch more backports right afterwards. Or at least that's what we should do for anything even a little bit risky. On Fri, Mar 20, 2015 at 11:03 PM, Tony Kelman t...@kelman.net wrote: There have been

[julia-users] Re: Help with parallelization

2015-03-21 Thread Nils Gudat
Thanks for the explanation! One related question, in case anyone's still reading here: I'm planning to run my code on a cluster, where the size of the machine I'm being allocated varies with the overall usage level. That is, my code might run on a 12 core machine one day, a 24 core machine the

Re: [julia-users] Juno/Julia ODBC problem

2015-03-21 Thread Charles Brauer
I was able to get ODBC to work, but I had to give up Juno. I installed Julia-0.3.6 and ran the following script: using DataFrames using ODBC using Gadfly conn = ODBC.connect(bigsur) df = query(Select * from IBM) names(df) closes = df[6] p = plot(x = collect(1:100), y = closes[1:100]) This

[julia-users] ApproxFun Boundary Conditions

2015-03-21 Thread idontgetoutmuch
I am trying to solve Laplace's equation using ApproxFun with the following boundary conditions { \phi(x, 0) = 0 \\ \phi(x, 1) = \frac{1}{(1 + x)^2 + 1} \\ \phi(0, y) = \frac{y}{1 + y^2} \\ \phi(1, y) = \frac{y}{4 + y^2} \end{aligned} } I'm not clear how to express these. I've tried { d =

Re: [julia-users] Juno/Julia ODBC problem

2015-03-21 Thread Stefan Karpinski
The first plot does a bunch of compilation. Second time you evaluate it will be much quicker. On Sat, Mar 21, 2015 at 7:28 PM, Charles Brauer charlesbra...@gmail.com wrote: I was able to get ODBC to work, but I had to give up Juno. I installed Julia-0.3.6 and ran the following script: using

[julia-users] Rationale behind @-sign for macro usage?

2015-03-21 Thread Gregor R.
Hello @all, I'm basically interested in the rationale behind using @ for macros like @assert and @time and so on. Personally, I think that using lots of macros clutters the otherwise very likable Julia code. Also what is the purpose behind using @? I mean macro expansion is a pre compilation

[julia-users] Question: `./` has no method matching ./(::Int64, ::AdditionAtom)

2015-03-21 Thread Dongning Guo
An error occurred upon my first attempt to use Julia for solving a meaningful convex optimization problem: using Convex x = Variable(3) t = rand(3) s = t+rand(3) constraints = [x=0, x=s] p = minimize(sum(1./(x-t)), constraints) `./` has no method matching ./(::Int64, ::AdditionAtom) Searched

Re: [julia-users] Re: Another (basic) parameterization question

2015-03-21 Thread James Fairbanks
Glad to help. There is also a function Base.one(T) which is defined to give the multiplicative identity of T which for all subtypes of Real should be the same as convert(T, 1). You aren't really using it as the multiplicative identity though so I am not sure which is better. On Sat, Mar 21, 2015,

Re: [julia-users] Rationale behind @-sign for macro usage?

2015-03-21 Thread Isaiah Norton
There is a pretty good set of answers on StackOverflow now. First-posts need to be manually approved, which is why this message appears to be time-delayed. (Please don't cross-post in the future because it is the same set of people answering everywhere). On Sat, Mar 21, 2015 at 12:53 PM, Gregor

[julia-users] Re: ApproxFun Boundary Conditions

2015-03-21 Thread Sheehan Olver
It's expanding f1-f4 as bivariate functions on [-1,1]^2, but instead you want to expand them as univariate functions on [-1,1]: d = Interval()^2 f1 = Fun(x-0) f2 = Fun(x-1 / ((1 + x)^2 + 1)) f3 = Fun(y-y / (1 + y^2)) f4 = Fun(y-y / (4 + y^2)) u = [dirichlet(d),lap(d)]\[f1,f2,f3,f4] On

Re: [julia-users] Re: inserting an Expr into AST via macro

2015-03-21 Thread Abe Schneider
I have, but it's not entirely clear to me how I would use it in this particular case. The code in question is being called from a function (which while ultimately is being called from a macro) doesn't directly return an expression in this case. Specifically, I have something that looks like:

Re: [julia-users] Re: Julia v0.3.6

2015-03-21 Thread Tony Kelman
Yeah, that makes sense to me. I'll do a couple more of the simple ones that have recently been flagged, then run through Elliot's checklist. On Saturday, March 21, 2015 at 6:19:35 AM UTC-7, Stefan Karpinski wrote: We may want to consider doing the minimal number of backports now for 0.3.7