Ask Your Question

# SAGETEX: Howto compute solution of a function

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 close merge delete

## 2 answers

Sort by ยป oldest newest most voted

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) }$

more

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

more

## Your Answer

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

Add Answer

## Stats

Asked: 2013-04-22 05:50:37 -0500

Seen: 314 times

Last updated: Apr 22 '13