ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 21 Jan 2013 20:41:30 +0100how to find a local maximum?https://ask.sagemath.org/question/8890/how-to-find-a-local-maximum/Hello. I'm fairly new to Sage, so lets see if someone more experienced can help!
Say I have a function f(x) continuous in [a,b] and derivable in (a,b).
How can I implement in Sage a function 'maximum(f,a,b)' that returns the maximum of f(x) in [a,b] (as a numerical approximation, not as an expression)?
Thanks you a lot!NilSun, 15 Apr 2012 15:37:12 +0200https://ask.sagemath.org/question/8890/obtaining all numerical roots of a function in an intervalhttps://ask.sagemath.org/question/8886/obtaining-all-numerical-roots-of-a-function-in-an-interval/Hello, thanks for reading.
I'm working on single variable calculus here:
Basically what I need is what "find_root" does, but I need a list of ALL roots in a given interval, not just one.
So I've been playing with "solve". I found this piece of code which works in most cases:
sage: roots = solve(f(x),x,solution_dict=True)
sage: roots = [s[x] for s in roots]
sage: num_roots = map(n, roots)
but it gives an error if the function is periodic and has inifinite roots, becuase the symbolic expression that "solve" gets has infinite solutions too.
Defining a desired interval should solve this issue, but I have no idea how to implement such thing!
Thanks you and have a good day.NilSun, 15 Apr 2012 01:17:01 +0200https://ask.sagemath.org/question/8886/Using numerical integration within solve or find_roothttps://ask.sagemath.org/question/9728/using-numerical-integration-within-solve-or-find_root/Hi there,
I have a function of two variable, u and Z:
F(u,Z).
I would like to know for what value of u the integral of this function is zero.
Could someone please help me with the syntax to do so?
I think I want to do something like:
find_root(numerical_integral(F,Z,-infinity,infinity),0,1)
U must be between 0 and 1: 0<=u<=1
F cannot be solved symbolically.
Thanks so much!ZelenojZemljiMon, 21 Jan 2013 20:41:30 +0100https://ask.sagemath.org/question/9728/