ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 03 Nov 2016 00:29:02 -0500Numerical real solution of derivativehttp://ask.sagemath.org/question/35374/numerical-real-solution-of-derivative/I would like to know where a function attains its maximum, so I'm trying to solve some
>diff(y,x),x
where y depends on y. I have difficulties with Sage returning equations, complex roots, converting equations, find_maximum_on_interval command etc, and instead of spending another hour trying to figure it out myself, I thought I would try asking here...
Here is a more concrete example:
>f = log(2.02 * x + 1) / 2 + log( -2 * x + 1) / 2
>find_local_maximum(diff(f,x), 0, 1)
What is mysterious for me, is that the above works if instead I have
>f = log(1.01 * x + 1) / 2 + log( -x + 1) / 2domotorpThu, 03 Nov 2016 00:29:02 -0500http://ask.sagemath.org/question/35374/Real Solution of x^3+8 == 0?http://ask.sagemath.org/question/8393/real-solution-of-x38-0/I do not understand the following:
sage: assume(x,'real')
sage: solve(x^3+8==0,x)
[]
Why does this equation have no solution?
But -2 is a solution!
Thanks for help!
amaleaTue, 18 Oct 2011 08:07:48 -0500http://ask.sagemath.org/question/8393/SAGETEX: Howto compute solution of a functionhttp://ask.sagemath.org/question/10051/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_rebreb_rebMon, 22 Apr 2013 05:50:37 -0500http://ask.sagemath.org/question/10051/Issues with: Solving a polynomial equation with multiple variableshttp://ask.sagemath.org/question/9015/issues-with-solving-a-polynomial-equation-with-multiple-variables/It's probably very simple but I'm completely new to Sage and could not find a definitive answer. So here's the problem. I have a polynomial equation like this:
v**6 + a(k)*v**4 + b(k)*v**2 + c(k) == 0
For simple forms of a(k), b(k), c(k) etc. solve works like a charm and gives me a solution v(k) very quickly. When a(k), b(k), c(k) become very complicated e.g.
b(k) = e + f/(1+g*k**2) + (1+(h*k**2)/(1+g*k**2))/(1+g*k**2)
solve function chokes for long time. In such situations I would like to revert to some numerical solution because my final goal is to get numerical values for v(k).
I'm in the very early stages of learning sage and python so have no idea about how to proceed. I have copied my existing code below for your reference. For the parameters Ca, Cak etc. given right now, solve works fine. When I start giving non-zero values of Cak: a(k), b(k), c(k) become complicated functions as described above and I start getting into trouble.
from sage.all import *
import numpy as np
v,k=var('v, k')
Ca=4.; Cs=sqrt(6.0); di=1; de=0.04; Cak=0.;
dx=0.05; L=12.8;
kmin=2*pi/L;
kmax=pi/dx;
def DDe(k):
return 1+k**2*de**2
def Cmk(k):
return sqrt((Ca**2/DDe(k))+Cs**2)
def f(v,k):
return v**6-((Cmk(k)**2)+(Cak**2/DDe(k))*(1+(k**2*di**2)/DDe(k)))*v**4\
+ (1/DDe(k))((Cmk(k)**2*Cak**2)+(Cs**2*Cak**2)*(1+(k**2*di**2)/DDe(k)))*v**2\
- Cs**2*Cak**4/(DDe(k)**2)
sol=solve(f(v,k) == 0, v)
for i in range(0,len(sol)):
print 'Solution ', i, ': '; show(sol[i])
# plot(sol[i].rhs(),kmin,kmax)
show(plot(sol[0].rhs(),kmin,kmax)+plot(sol[1].rhs(),kmin,kmax)+\
plot(sol[2].rhs(),kmin,kmax)+plot(sol[3].rhs(),kmin,kmax))
Any help, pointers on how to proceed would be of great help.
**EDIT**
I just compared the output of the code with a similar code in Mathematica from which I'm trying to translate the code and found that the numbers in the simpler cases are wrong too. So it seems I'm doing more than a few things wrong. :(
Thanks!toylasTue, 29 May 2012 12:20:13 -0500http://ask.sagemath.org/question/9015/Using the solution of equationhttp://ask.sagemath.org/question/7732/using-the-solution-of-equation/How can I use after solve(eq) the result? For example, the result for this simple linear system
[x + 2*y + 4*z - 1]
[ x + 4*z - 5]
[ 3*x + 6*z - 6]
is
[[x == -1, y == -2, z == (3/2)]]
How can I use x,y,z in an expression, say x^2+y^2+z^2 ?
czsanMon, 18 Oct 2010 06:25:45 -0500http://ask.sagemath.org/question/7732/exponential equation real solutionhttp://ask.sagemath.org/question/7720/exponential-equation-real-solution/How can I solve the equation
exp(2*x)+exp(-2*x)==2
to get only the real solution x==0 ?
Thanks for help.
amaleaSat, 02 Oct 2010 23:24:29 -0500http://ask.sagemath.org/question/7720/exponential equationhttp://ask.sagemath.org/question/7719/exponential-equation/sage: solve(exp(-x)+exp(x) == 2,x)
[x == 0]
sage: solve(exp(-2*x)+exp(2*x) == 2,x)
[]
Can tell me anyone why the second equation has no
solution?
amaleaSat, 02 Oct 2010 06:35:11 -0500http://ask.sagemath.org/question/7719/