Ask Your Question

Soul's profile - activity

2023-05-08 20:16:18 +0200 received badge  Popular Question (source)
2016-11-04 17:55:31 +0200 received badge  Student (source)
2016-08-05 18:11:25 +0200 received badge  Scholar (source)
2016-08-05 17:58:58 +0200 asked a question Programming a function which is able to display Maximum or Minimum of an 1-dimensional function

I had to program a function today which is able to do what i wrote in the title. My attempt in doing this was that:


reset()
forget()
var('x')
Extrempkt= {}

def g(f):
    f=f(x)
    f1(x)=diff(f(x),x); print(f1(x))

    l=len(solve(f1(x)==0,x))
    L=l-1;
    A=[((solve(f1(x)==0,x)[n]).operands()[1]) for n in [0..L]]; print(A)

    if n in [0..L]:
        if f1(A[n]-0.0000001)>f1(A[n]+0.0000001):
            Extrempkt.update({A[n]:"Maximum"})
        if f1(A[n]-0.0000001)<f1(A[n]+0.0000001):
            Extrempkt.update({A[n]:"Minimum"})

    return (Extrempkt)

g((1/9)*x^3-(1/3)*x^2-(8/3)*x+9)

The problem is. My function only puts out my 2nd Extremum. Can you help me?

2016-08-03 16:06:46 +0200 asked a question Create a set of numbers with a equatation and 2 diffrent variables

I need to create a set of numbers which are defined by m in [0..41] and n in [100]. The new created set needs to contain all the numbers which fulfill that condition.

I tried to accomplish that with:

A=[n^2+n+m^2 for n in [1..100] and m in [0..41]]

But Sage takes the and as an bool value not as another condition. can you help me with that?

(First time programming and english is not my mother tongue. Please be pleasefull)

Thanks alot!

2016-08-03 16:06:45 +0200 asked a question Creating a list with 2 variables from 2 diffrent sets

I need to create a set of numbers which are defined by m in [0..41] and n in [100]. The new created set needs to contain all the numbers which fulfill that condition.

I tried to accomplish that with:

A=[n^2+n+m^2 for n in [1..100] and m in [0..41]]

But Sage takes the and as an bool value not as another condition. can you help me with that?

(First time programming and english is not my mother tongue. Please be pleasefull)

Thanks alot!