Ask Your Question
0

SAGETEX: Howto compute solution of a function

asked 2013-04-22 12:50:37 +0100

reb_reb gravatar image

updated 2013-04-22 12:53:09 +0100

Hello,

how can i display the solution of the following function with sagetex?

\documentclass[11pt,a4paper,landscape]{article}
\usepackage[utf8]{inputenc}
\usepackage[german]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{sagetex}
\usepackage[left=10cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\author{}
\title{Vordimensionierung Hallentragwerk}
\begin{document}

\begin{sagesilent}

lambda_z = 5
s_ka = 4
loesung (lambda_z, s_k) = lambda_z * s_k

\end{sagesilent}
$ \sage {loesung }$
\end{document}

Sincerely reb_reb

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2013-04-22 14:04:57 +0100

First, what do you want to solve? It's a function, not an equation. Do you want to solve loesung(lambda_z, s_k) = 0? Do you want to compute loesung(5, 4)? Second, I believe that the line defining loesung will overwrite the previous definition of lambda_z, making it a symbolic variable instead of just being 5.

So perhaps:

\begin{sagesilent}

lambda_za = 5  # note the 'a' at the end
s_ka = 4
loesung (lambda_z, s_k) = lambda_z * s_k

\end{sagesilent}
$ \sage {loesung }$

This will print out 20:    
$ \sage {loesung(lambda_za, s_ka) }$
edit flag offensive delete link more
0

answered 2013-04-22 18:08:42 +0100

reb_reb gravatar image

Thank you, that was helpful.

To finalize my project one last question: How can I display the values of the variables in the function?

Like: f(lambda_z, s_k) = lambda_z * s_k = 5 * 4 = 20

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-04-22 12:50:37 +0100

Seen: 662 times

Last updated: Apr 22 '13