Ask Your Question

Soul's profile - activity

2016-11-04 11:55:31 -0600 received badge  Student (source)
2016-08-05 11:11:25 -0600 received badge  Scholar (source)
2016-08-05 10:58:58 -0600 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 09:06:46 -0600 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 09:06:45 -0600 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!