Jump to content

Импортировать код Sage (Python) в HTML шаблон


Black
 Share

Recommended Posts

Ребят, такая проблема, у меня есть HTML шаблон, и в него мне нужно импортировать простенький код Sage. Задумка была такая, чтобы там была кнопка, запускающая код Sage. Но почему то не работает, помогите пожалуйста Заранее спасибо. Вот код в Sage:

f(x) = x^3 - x
f_p(x) = diff(f(x), x)
@interact
def tap(x_0 = slider(-10, 10, 0.1, 0)):
    y_0 = f(x_0)
    m = f_p(x_0)
    b = y_0 - m*x_0
    P1 = plot(f(x), -2, 2, rgbcolor=(0, 1, 0))
    P2 = plot(m*x + b, -2, 2, color = 'red')
    P3 = point([y_0, x_0], color='blue', size = 200)
    P = P1 + P2 + P3
    P.show()
 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy