Need help with an error?

asked 2014-09-14 21:47:53 +0100

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

In sage math I put in the following software

var('n a b x y s u v A')
n = 5100
a = 0
b = 2*pi
h = (b-a)/n
s = 0
for i in range(n):
    x = a + i*h
    s = s + find_root(((y*cos(x))^2+u)/4+((y*sin(x))^2+v)/9-1,0,4)
A = float((b-a)/n*s)
var('u v A')
f_x = u
f_y = v
f_z = A
parametric_plot3d([f_x, f_y, f_z], (u, -2, 2), (v, -2, 2))

However, I was given the following error...

Error in lines 7-9
Traceback (most recent call last):
  File "/projects/180e8f3c-9dc5-424f-abcc-5267257c0d31/.sagemathcloud/sage_server.py", line 736, in execute
    exec compile(block+'\n', '', 'single') in namespace, locals
  File "", line 3, in <module>
  File "/usr/local/sage/sage-6.3.beta6/local/lib/python2.7/site-packages/sage/numerical/optimize.py", line 77, in find_root
    return f.find_root(a=a,b=b,xtol=xtol,rtol=rtol,maxiter=maxiter,full_output=full_output)
  File "expression.pyx", line 9683, in sage.symbolic.expression.Expression.find_root (build/cythonized/sage/symbolic/expression.cpp:42560)
NotImplementedError: root finding currently only implemented in 1 dimension.

Is there a way I can graph this? If so is there also a way to find the maximum values of u and v, from this parametric function?

edit retag flag offensive close merge delete

Comments

What do you expect when you write find_root(((y*cos(x))^2+u)/4+((y*sin(x))^2+v)/9-1,0,4) ? More generally, what mathematical function do you want to plot ? Your code is very confusing, for example when you write var('u v A') you should know that the previously computed value of A is replaced by the symbolic variable A.

tmonteil gravatar imagetmonteil ( 2014-09-14 22:49:39 +0100 )edit

I want to plot a 3-d parameter. Try and think of it this way. I'm trying to find the area under a specific curve. That is A. Then if you see u, and v in inside find_root(find_root(((y*cos(x))^2+u)/4+((y*sin(x))^2+v)/9-1,0,4)), I need highest value of A, at u, and v...... x=u y=v z=A Just look above, and it will make sense. If not I'll figure it out myself. This is as much as I can clarify it. You'll only understand if you were literally with me. This is clearly not the case!

Krishnan Arbuja gravatar imageKrishnan Arbuja ( 2014-09-15 00:04:59 +0100 )edit

I don't understand what you're trying to do either, but maybe implicit_plot3d would be useful... given the find_root appearing there.

William Stein gravatar imageWilliam Stein ( 2014-09-16 00:19:12 +0100 )edit