Ask Your Question

Revision history [back]

There should be a typo somewhere in your code, if i copy/paste your definition of X2, it just works fine:

sage: X2(k, j0, j1, a0, aMax, a1, v0, v1, vMax, x) = -1/24*jMax^4/k^3 +1/2*aMax*jMax^2/k^2 + jMax*vMax/k + 1/48*((2*a1 - 2*aMax + jMax^2/k -(j1^2 - jMax^2)/k)^3*k^2/jMax^2 - 24*(2*a1 - 2*aMax + jMax^2/k - (j1^2 -jMax^2)/k)*k^2*vMax/jMax - 3*(jMax^2*k - 2*aMax*k^2)*(2*a1 - 2*aMax +jMax^2/k - (j1^2 - jMax^2)/k)^2/jMax^2 + 4*(jMax^3 -6*aMax*jMax*k)*(2*a1 - 2*aMax + jMax^2/k - (j1^2 - jMax^2)/k)/jMax)/k^2+ 1/24*((j1 + jMax)^4*jMax/k - 4*(j1 + jMax)^3*jMax^2/k + 24*(j1 +jMax)*jMax*k*vMax + 6*(2*a1*jMax*k^2 - (j1^2*jMax - jMax^3)*k)*(j1 +jMax)^2/k^2 - (3*j1^4 - 6*j1^2*jMax^2 + 4*jMax^4 + 12*(a1^2 -aMax^2)*k^2 - 12*(a1*j1^2 - (a1 - aMax)*jMax^2)*k)*(j1 +jMax)/k)/(jMax*k^2)

sage: X2
(k, j0, j1, a0, aMax, a1, v0, v1, vMax, x) |--> -1/24*jMax^4/k^3 + 1/2*aMax*jMax^2/k^2 + jMax*vMax/k + 1/48*((2*a1 - 2*aMax + jMax^2/k - (j1^2 - jMax^2)/k)^3*k^2/jMax^2 - 24*(2*a1 - 2*aMax + jMax^2/k - (j1^2 - jMax^2)/k)*k^2*vMax/jMax - 3*(jMax^2*k - 2*aMax*k^2)*(2*a1 - 2*aMax + jMax^2/k - (j1^2 - jMax^2)/k)^2/jMax^2 + 4*(jMax^3 - 6*aMax*jMax*k)*(2*a1 - 2*aMax + jMax^2/k - (j1^2 - jMax^2)/k)/jMax)/k^2 + 1/24*((j1 + jMax)^4*jMax/k - 4*(j1 + jMax)^3*jMax^2/k + 24*(j1 + jMax)*jMax*k*vMax + 6*(2*a1*jMax*k^2 - (j1^2*jMax - jMax^3)*k)*(j1 + jMax)^2/k^2 - (3*j1^4 - 6*j1^2*jMax^2 + 4*jMax^4 + 12*(a1^2 - aMax^2)*k^2 - 12*(a1*j1^2 - (a1 - aMax)*jMax^2)*k)*(j1 + jMax)/k)/(jMax*k^2)

sage: X2(k=5, j0=2, j1=4, jMax=10, a0=5, aMax=20, a1=3, v0=10, v1=100, vMax=vMax, x=2000)
233/50*vMax + 10661113/75000

sage: plot(X2(k=5, j0=2, j1=4, jMax=10, a0=5, aMax=20, a1=3, v0=10, v1=100, vMax=vMax, x=2000), (vMax, 0, 200))

This last command plots a line. I am using Sage 6.4.beta4.

There should be a typo somewhere in your code, if i copy/paste your definition of The symbolic variable X2jMax, is not defined. You can either define it just works fine:separately:

sage: var('jMax')
sage: X2(k, j0, j1, a0, aMax, a1, v0, v1, vMax, x) = -1/24*jMax^4/k^3 +1/2*aMax*jMax^2/k^2 + jMax*vMax/k + 1/48*((2*a1 - 2*aMax + jMax^2/k -(j1^2 - jMax^2)/k)^3*k^2/jMax^2 - 24*(2*a1 - 2*aMax + jMax^2/k - (j1^2 -jMax^2)/k)*k^2*vMax/jMax - 3*(jMax^2*k - 2*aMax*k^2)*(2*a1 - 2*aMax +jMax^2/k - (j1^2 - jMax^2)/k)^2/jMax^2 + 4*(jMax^3 -6*aMax*jMax*k)*(2*a1 - 2*aMax + jMax^2/k - (j1^2 - jMax^2)/k)/jMax)/k^2+ 1/24*((j1 + jMax)^4*jMax/k - 4*(j1 + jMax)^3*jMax^2/k + 24*(j1 +jMax)*jMax*k*vMax + 6*(2*a1*jMax*k^2 - (j1^2*jMax - jMax^3)*k)*(j1 +jMax)^2/k^2 - (3*j1^4 - 6*j1^2*jMax^2 + 4*jMax^4 + 12*(a1^2 -aMax^2)*k^2 - 12*(a1*j1^2 - (a1 - aMax)*jMax^2)*k)*(j1 +jMax)/k)/(jMax*k^2)

sage: X2
(k, j0, j1, a0, aMax, a1, v0, v1, vMax, x) |--> -1/24*jMax^4/k^3 + 1/2*aMax*jMax^2/k^2 + jMax*vMax/k + 1/48*((2*a1 - 2*aMax + jMax^2/k - (j1^2 - jMax^2)/k)^3*k^2/jMax^2 - 24*(2*a1 - 2*aMax + jMax^2/k - (j1^2 - jMax^2)/k)*k^2*vMax/jMax - 3*(jMax^2*k - 2*aMax*k^2)*(2*a1 - 2*aMax + jMax^2/k - (j1^2 - jMax^2)/k)^2/jMax^2 + 4*(jMax^3 - 6*aMax*jMax*k)*(2*a1 - 2*aMax + jMax^2/k - (j1^2 - jMax^2)/k)/jMax)/k^2 + 1/24*((j1 + jMax)^4*jMax/k - 4*(j1 + jMax)^3*jMax^2/k + 24*(j1 + jMax)*jMax*k*vMax + 6*(2*a1*jMax*k^2 - (j1^2*jMax - jMax^3)*k)*(j1 + jMax)^2/k^2 - (3*j1^4 - 6*j1^2*jMax^2 + 4*jMax^4 + 12*(a1^2 - aMax^2)*k^2 - 12*(a1*j1^2 - (a1 - aMax)*jMax^2)*k)*(j1 + jMax)/k)/(jMax*k^2)
 

Or add it as an internal variable of your function X2:

sage: X2(k, j0, j1, jMax, a0, aMax, a1, v0, v1, vMax, x) = -1/24*jMax^4/k^3 +1/2*aMax*jMax^2/k^2 + jMax*vMax/k + 1/48*((2*a1 - 2*aMax + jMax^2/k -(j1^2 - jMax^2)/k)^3*k^2/jMax^2 - 24*(2*a1 - 2*aMax + jMax^2/k - (j1^2 -jMax^2)/k)*k^2*vMax/jMax - 3*(jMax^2*k - 2*aMax*k^2)*(2*a1 - 2*aMax +jMax^2/k - (j1^2 - jMax^2)/k)^2/jMax^2 + 4*(jMax^3 -6*aMax*jMax*k)*(2*a1 - 2*aMax + jMax^2/k - (j1^2 - jMax^2)/k)/jMax)/k^2+ 1/24*((j1 + jMax)^4*jMax/k - 4*(j1 + jMax)^3*jMax^2/k + 24*(j1 +jMax)*jMax*k*vMax + 6*(2*a1*jMax*k^2 - (j1^2*jMax - jMax^3)*k)*(j1 +jMax)^2/k^2 - (3*j1^4 - 6*j1^2*jMax^2 + 4*jMax^4 + 12*(a1^2 -aMax^2)*k^2 - 12*(a1*j1^2 - (a1 - aMax)*jMax^2)*k)*(j1 +jMax)/k)/(jMax*k^2)

sage: X2
(k, j0, j1, jMax, a0, aMax, a1, v0, v1, vMax, x) |--> -1/24*jMax^4/k^3 + 1/2*aMax*jMax^2/k^2 + jMax*vMax/k + 1/48*((2*a1 - 2*aMax + jMax^2/k - (j1^2 - jMax^2)/k)^3*k^2/jMax^2 - 24*(2*a1 - 2*aMax + jMax^2/k - (j1^2 - jMax^2)/k)*k^2*vMax/jMax - 3*(jMax^2*k - 2*aMax*k^2)*(2*a1 - 2*aMax + jMax^2/k - (j1^2 - jMax^2)/k)^2/jMax^2 + 4*(jMax^3 - 6*aMax*jMax*k)*(2*a1 - 2*aMax + jMax^2/k - (j1^2 - jMax^2)/k)/jMax)/k^2 + 1/24*((j1 + jMax)^4*jMax/k - 4*(j1 + jMax)^3*jMax^2/k + 24*(j1 + jMax)*jMax*k*vMax + 6*(2*a1*jMax*k^2 - (j1^2*jMax - jMax^3)*k)*(j1 + jMax)^2/k^2 - (3*j1^4 - 6*j1^2*jMax^2 + 4*jMax^4 + 12*(a1^2 - aMax^2)*k^2 - 12*(a1*j1^2 - (a1 - aMax)*jMax^2)*k)*(j1 + jMax)/k)/(jMax*k^2)

In both cases:

sage: X2(k=5, j0=2, j1=4, jMax=10, a0=5, aMax=20, a1=3, v0=10, v1=100, vMax=vMax, x=2000)
233/50*vMax + 10661113/75000

sage: plot(X2(k=5, j0=2, j1=4, jMax=10, a0=5, aMax=20, a1=3, v0=10, v1=100, vMax=vMax, x=2000), (vMax, 0, 200))

This last command plots a line. I am using Sage 6.4.beta4.line.

The symbolic variable jMax is not defined. You can either define it separately:

sage: var('jMax')
 sage: X2(k, j0, j1, a0, aMax, a1, v0, v1, vMax, x) = -1/24*jMax^4/k^3 +1/2*aMax*jMax^2/k^2 + jMax*vMax/k + 1/48*((2*a1 - 2*aMax + jMax^2/k -(j1^2 - jMax^2)/k)^3*k^2/jMax^2 - 24*(2*a1 - 2*aMax + jMax^2/k - (j1^2 -jMax^2)/k)*k^2*vMax/jMax - 3*(jMax^2*k - 2*aMax*k^2)*(2*a1 - 2*aMax +jMax^2/k - (j1^2 - jMax^2)/k)^2/jMax^2 + 4*(jMax^3 -6*aMax*jMax*k)*(2*a1 - 2*aMax + jMax^2/k - (j1^2 - jMax^2)/k)/jMax)/k^2+ 1/24*((j1 + jMax)^4*jMax/k - 4*(j1 + jMax)^3*jMax^2/k + 24*(j1 +jMax)*jMax*k*vMax + 6*(2*a1*jMax*k^2 - (j1^2*jMax - jMax^3)*k)*(j1 +jMax)^2/k^2 - (3*j1^4 - 6*j1^2*jMax^2 + 4*jMax^4 + 12*(a1^2 -aMax^2)*k^2 - 12*(a1*j1^2 - (a1 - aMax)*jMax^2)*k)*(j1 +jMax)/k)/(jMax*k^2)

sage: X2
(k, j0, j1, a0, aMax, a1, v0, v1, vMax, x) |--> -1/24*jMax^4/k^3 + 1/2*aMax*jMax^2/k^2 + jMax*vMax/k + 1/48*((2*a1 - 2*aMax + jMax^2/k - (j1^2 - jMax^2)/k)^3*k^2/jMax^2 - 24*(2*a1 - 2*aMax + jMax^2/k - (j1^2 - jMax^2)/k)*k^2*vMax/jMax - 3*(jMax^2*k - 2*aMax*k^2)*(2*a1 - 2*aMax + jMax^2/k - (j1^2 - jMax^2)/k)^2/jMax^2 + 4*(jMax^3 - 6*aMax*jMax*k)*(2*a1 - 2*aMax + jMax^2/k - (j1^2 - jMax^2)/k)/jMax)/k^2 + 1/24*((j1 + jMax)^4*jMax/k - 4*(j1 + jMax)^3*jMax^2/k + 24*(j1 + jMax)*jMax*k*vMax + 6*(2*a1*jMax*k^2 - (j1^2*jMax - jMax^3)*k)*(j1 + jMax)^2/k^2 - (3*j1^4 - 6*j1^2*jMax^2 + 4*jMax^4 + 12*(a1^2 - aMax^2)*k^2 - 12*(a1*j1^2 - (a1 - aMax)*jMax^2)*k)*(j1 + jMax)/k)/(jMax*k^2)

Or add it as an internal variable of your function X2: (it will be automatically injected in the namespace):

sage: X2(k, j0, j1, jMax, a0, aMax, a1, v0, v1, vMax, x) = -1/24*jMax^4/k^3 +1/2*aMax*jMax^2/k^2 + jMax*vMax/k + 1/48*((2*a1 - 2*aMax + jMax^2/k -(j1^2 - jMax^2)/k)^3*k^2/jMax^2 - 24*(2*a1 - 2*aMax + jMax^2/k - (j1^2 -jMax^2)/k)*k^2*vMax/jMax - 3*(jMax^2*k - 2*aMax*k^2)*(2*a1 - 2*aMax +jMax^2/k - (j1^2 - jMax^2)/k)^2/jMax^2 + 4*(jMax^3 -6*aMax*jMax*k)*(2*a1 - 2*aMax + jMax^2/k - (j1^2 - jMax^2)/k)/jMax)/k^2+ 1/24*((j1 + jMax)^4*jMax/k - 4*(j1 + jMax)^3*jMax^2/k + 24*(j1 +jMax)*jMax*k*vMax + 6*(2*a1*jMax*k^2 - (j1^2*jMax - jMax^3)*k)*(j1 +jMax)^2/k^2 - (3*j1^4 - 6*j1^2*jMax^2 + 4*jMax^4 + 12*(a1^2 -aMax^2)*k^2 - 12*(a1*j1^2 - (a1 - aMax)*jMax^2)*k)*(j1 +jMax)/k)/(jMax*k^2)

sage: X2
(k, j0, j1, jMax, a0, aMax, a1, v0, v1, vMax, x) |--> -1/24*jMax^4/k^3 + 1/2*aMax*jMax^2/k^2 + jMax*vMax/k + 1/48*((2*a1 - 2*aMax + jMax^2/k - (j1^2 - jMax^2)/k)^3*k^2/jMax^2 - 24*(2*a1 - 2*aMax + jMax^2/k - (j1^2 - jMax^2)/k)*k^2*vMax/jMax - 3*(jMax^2*k - 2*aMax*k^2)*(2*a1 - 2*aMax + jMax^2/k - (j1^2 - jMax^2)/k)^2/jMax^2 + 4*(jMax^3 - 6*aMax*jMax*k)*(2*a1 - 2*aMax + jMax^2/k - (j1^2 - jMax^2)/k)/jMax)/k^2 + 1/24*((j1 + jMax)^4*jMax/k - 4*(j1 + jMax)^3*jMax^2/k + 24*(j1 + jMax)*jMax*k*vMax + 6*(2*a1*jMax*k^2 - (j1^2*jMax - jMax^3)*k)*(j1 + jMax)^2/k^2 - (3*j1^4 - 6*j1^2*jMax^2 + 4*jMax^4 + 12*(a1^2 - aMax^2)*k^2 - 12*(a1*j1^2 - (a1 - aMax)*jMax^2)*k)*(j1 + jMax)/k)/(jMax*k^2)

In both cases:

sage: X2(k=5, j0=2, j1=4, jMax=10, a0=5, aMax=20, a1=3, v0=10, v1=100, vMax=vMax, x=2000)
233/50*vMax + 10661113/75000

sage: plot(X2(k=5, j0=2, j1=4, jMax=10, a0=5, aMax=20, a1=3, v0=10, v1=100, vMax=vMax, x=2000), (vMax, 0, 200))

This last command plots a line.