Plotting issue, number of arguments error

asked 2015-04-02 19:19:22 +0200

ajk_birdman gravatar image

updated 2015-04-02 19:48:18 +0200

Hey all,

I have a question that's probably been asked before (tough I couldn't find it here)

I'm trying to plot these two functions of d. Area is a function of d and some other functions of d. I could swear I had this code working a few months ago but now I get the error:


*File "", line 1, in <module>

  File "/tmp/tmp0fBGGb/___code___.py", line 21, in <module>
    plot1 = plot(Area, R1-R2, limit, color='red')
  File "sage/symbolic/expression.pyx", line 4382, in sage.symbolic.expression.Expression.__call__ (build/cythonized/sage/symbolic/expression.cpp:24669)
  File "sage/symbolic/ring.pyx", line 760, in sage.symbolic.ring.SymbolicRing._call_element_ (build/cythonized/sage/symbolic/ring.cpp:8970)
ValueError: the number of arguments must be less than or equal to 1*

Does anyone have any ideas what this could be? (Using sageNB and 6.4.1)

var('x, y, z, R1, R2, d, a, s1, s2, Area, limit, Area2')



R1 = 6
R2 = 4


a = (1/d)*sqrt( (-d+R1+R2)*(d-R1+R2)*(d+R1-R2)*(d+R1+R2) )

s1 = (a + 2*R1)/2
s2 = (a + 2*R2)/2

limit = sqrt(R1**2 - (R2/2)**2) + (R1 - R2)


Area = [((R1**2)*arcsin(a/(2*R1))) - sqrt(s1*(s1-a)*((s1-R1)^2)) + (R2**2)*(pi - arcsin(a/(2*R2))) + sqrt(s2*(s2-a)*((s2-R2)**2))]

plot1 = plot(Area, d, R1-R2, limit, color='red')


Area2 = ((R1**2)*arcsin(a/(2*R1))) - sqrt(s1*(s1-a)*((s1-R1)^2)) + (R2**2)*(arcsin(a/(2*R2))) - sqrt(s2*(s2-a)*((s2-R2)**2))

plot2 = plot(Area2, d, limit, R1+R2, color='green')
show(plot1)
edit retag flag offensive close merge delete

Comments

This works fine for me in Sage Math Cloud and in sagecell.sagemath.org. I do wonder whether you need to make sure Area is not a list in your version of Sage.

calc314 gravatar imagecalc314 ( 2015-04-06 02:53:22 +0200 )edit

Thanks calc314 and sorry for the slow response.

Yep. Sagecell worked well. Soon as I deleted the brackets in "Area" it worked fine in other environments too. Not sure why they were there in the first place.

ajk_birdman gravatar imageajk_birdman ( 2015-04-16 09:43:38 +0200 )edit