2017-07-08 09:42:21 +0200 | received badge | ● Famous Question (source) |
2013-04-08 11:08:38 +0200 | received badge | ● Notable Question (source) |
2012-12-06 02:08:30 +0200 | received badge | ● Famous Question (source) |
2012-08-01 15:48:12 +0200 | received badge | ● Famous Question (source) |
2012-02-16 04:05:14 +0200 | received badge | ● Famous Question (source) |
2011-12-27 17:08:43 +0200 | received badge | ● Popular Question (source) |
2011-10-06 00:30:07 +0200 | received badge | ● Notable Question (source) |
2011-07-26 17:03:41 +0200 | received badge | ● Notable Question (source) |
2011-07-21 20:19:14 +0200 | received badge | ● Notable Question (source) |
2011-06-18 18:24:03 +0200 | received badge | ● Taxonomist |
2011-03-20 01:06:52 +0200 | received badge | ● Popular Question (source) |
2011-03-05 12:59:12 +0200 | received badge | ● Popular Question (source) |
2011-02-01 09:49:26 +0200 | received badge | ● Popular Question (source) |
2010-10-14 23:11:12 +0200 | received badge | ● Student (source) |
2010-10-14 23:11:11 +0200 | received badge | ● Supporter |
2010-10-14 23:11:11 +0200 | received badge | ● Scholar (source) |
2010-10-14 23:11:11 +0200 | received badge | ● Editor (source) |
2010-09-01 12:39:45 +0200 | commented answer | Numerical integration in a function The only other item would be a mess I keep running into at defining the variable of integration. integral(f(x),x,0,1) verses numerical_integral(f(x),0,1). Numerical integral errors when the variable of integration is declared. If it would not do that, it would help bring the two into uniformity. |
2010-09-01 12:36:57 +0200 | commented answer | Numerical integration in a function For example in the answer to this one. I did not know that f=lambda x: x^2 would allow me to do f(2) result 4. Nor has any of the python docs on it been the most help. Mind I do more in Java :( and PHP :) than the little I have done in Python, but still some Sage documentation pointing at others? |
2010-09-01 12:34:38 +0200 | commented answer | Numerical integration in a function The main area I think that could use some documentation is the use of the Python inline lambda function. Most if not all of the integration issues I have had, have been solved with using this. However there is little in how to use it with Sage specifically. |
2010-09-01 12:32:51 +0200 | commented answer | Numerical integration in a function This worked great! |
2010-09-01 12:32:41 +0200 | marked best answer | Numerical integration in a function This works for me: |
2010-09-01 09:21:58 +0200 | marked best answer | Double Integral You could try with numerical_integral. You didn't provide definition of B(), so here is example with simpler function: BTW: I'd like to know how to do the above without 'lambda'. BTW2: Are you sure your integral converges at d=0? |
2010-09-01 09:20:26 +0200 | asked a question | Numerical integration in a function So what I want is to the integration wait until after the variables have been substituted so that it is able to numerically integrate. (Yes I need to numerically integrate. This is a simplified form that reproduces the same result.) I thought there might be a way using a lambda defined function, but I was unable to find one. |
2010-08-31 14:04:46 +0200 | commented answer | Setting Precision in Sage I found out how. Deleting ~/.sage did it. rm -Rf ~/.sage |
2010-08-31 08:37:30 +0200 | commented answer | Setting Precision in Sage Hmm... I still get the same error with your options. Perhaps I broke something while trying to fix the problem. Any way to reset everything? Note I tried reset() and it still produced the error. |
2010-08-30 16:27:44 +0200 | asked a question | Setting Precision in Sage I have been working through an error I am receiving with the above command. The error I get when I run it is: However if I shorten the decimals to something like: Then the command runs fine without any issues. Now perhaps this is a bug, but really I do not need the level of precision that is in these commands. Of course I do not want numbers here but variables and it is evaluating the variables to this level of precision that is causing the issue. For example I say: Any ideas? P.S. I have searched around, but I have not found any that apply to just basic numbers in Sage. |
2010-08-26 17:39:08 +0200 | edited question | Double Integral So I have equations: (a##-d## are all decimals) And I want to double integrate over d and h. So just for example I can integrate over just d: and it evaluates just fine. Likewise if I put in an value for d and integrate over h, it also produces a value. So I want the numerical approximation of this double integral, but when I try for it using: At any rate, I think what is happening is that it is trying to evaluate the inside integral numerically first perhaps, which it is not able to do as it has a variable? I tried using the lambda in the first answer, and I was able to evaluate, but I had to set it to max_points=10 to get an answer that was even close to correct, plus I could find no way to plot that one. Thanks for any help! Wil |
2010-08-26 14:51:39 +0200 | marked best answer | Plot error: a free variable? Thanks; I don't quite understand what's broken, but I think I have a workaround. sage: normal(x,av,sd)=((1/(sd*sqrt(2*pi)))*exp(-(x-av)^2/(2*sd^2))) sage: f(x,y)= x*y^3*normal(y,1,2) sage: g = f.integrate(y,-2,2) sage: g (x, y) |--> 1/4*sqrt(2)*x*integrate(y^3*e^(-1/8*(y - 1)^2), y, -2, 2)/sqrt(pi) (note that sage seems to think sage: h(x) = f.integrate(y,-2,2) sage: h x |--> 1/4*sqrt(2)*x*integrate(y^3*e^(-1/8*(y - 1)^2), y, -2, 2)/sqrt(pi) (this is looking better, but still doesn't work . . . the problem seems to be the sage: plot(h,0,5) ... ValueError: free variable: y (the first way I could think of to get Sage to evaluate the integral was to use the sage: k = lambda x: h(x).numerical_approx() sage: plot(k,0,5) (graph is shown!) Note that, unfortunately, the following does not work: Unless someone knows better, I'm inclined to think this should be filed as a Trac ticket. EDIT: after writing all this, I think the problem is the "symbolic expression" |
2010-08-26 14:13:35 +0200 | commented question | Plot error: a free variable? See below. |
2010-08-26 14:13:18 +0200 | commented answer | Plot error: a free variable? Oh and before this I did run var('x d') so both of those are declared. |
2010-08-26 14:11:58 +0200 | commented answer | Plot error: a free variable? I only have trouble with it when I want to integrate with the same variable as is in normal() and having that variable outside of normal(). Example: x/(d+1)*normal(d,2.85,0.61) the integral(normal(d,2.85,0.61),d,0,Infinity)= just under 1 |
2010-08-26 13:59:15 +0200 | commented answer | Plot error: a free variable? normal(x,av,sd)=(1/(sd*sqrt(2*pi)))*exp(-(x-av)^2/(2*sd^2)) If I integrate this alone at say the standard normal (x,0,1) or any other mean and standard deviation I get a number just like you would expect. It is just the normal distribution. |
2010-08-26 13:14:41 +0200 | commented answer | Double Integral I figured out what the [0] was! It was limiting the return to only the value and leaving out the error calculation. |
2010-08-26 13:09:11 +0200 | asked a question | Plot error: a free variable? This should be a rather simple question, and I think I am just not understanding the error. I have a function say So I want to integrate across the pdf and then plot x. What I thought I would do was: But that give the error: ValueError: free variable: x What am I missing? |
2010-08-26 11:43:53 +0200 | commented answer | Double Integral The full equation takes a really long time. I am guessing that it is just trying to be too precise. I don't need much. Anyway to decrease the precision? |