User Profile
Collapse
-
ok. is there a simpler way to write the newton raphsons method in python? ive looked at the discussions in the forums here and havent found anything that could help m efurther than what i already know. do u have any clue on how to write the method?... -
-
how am im supposed to fix it? fp in solve is the fisrt function. u use the first function to get the derivative of f in the first function. do u know how i fix this?...Leave a comment:
-
def countclient(fil ename, client):
f = open(filename)
x = len(f.readlines (client))
return x
does that look like something that could work?...Leave a comment:
-
derivative and newton raphson
i have made a code for finding a derivative and now im trying to use it to help me with a code for the newton raphson method:
[CODE=python]
def derivative (f,x,h):
import math
return float(1/(2*h)) * (f(x+h) - f(x-h))
def solve (f,x0,h):
delta= f(x(n))/fp(x(n)
for x(n+1) in solve():
x(n)-delta[/CODE]
the first def works fine but i cant get... -
has anyone come up with anything on function 2 and 3? ive been fooling around with this for s couple days and cant seem to get it right. thanks for all the help....Leave a comment:
-
The voting worked perfect. it was exactly what i needed.
the only reason im asking alot is cuz i have a dead line next week and i got alot to get done that is kinda hard for me....Leave a comment:
-
command-line phonebook using a dictionary
i need to make a dictionary that works as a telephone book.
this is what needs to happen when i type in the following:
add name number – it adds the name and number to the phonebook
lookup name – returns the number for the given name
alias name newname – lets u look up the number by typing the name or the alias "newname".
change name number – changes the number that is connected to the given... -
Hey guys! Actually I'm American but I live in Sweden at the moment. Where in Sweden are from?...Leave a comment:
-
temp
one other small problem i have is i need to define a function that takes the number i put in splits it up and adds them together for example:
123 --> 1+2+3=6
88 --> 8+8=16
thanks for all ur help guys u are really saving my life!Last edited by bartonc; Oct 26 '07, 04:55 AM.Leave a comment:
-
getting the sum of digits in a number
i made it like this:Code:def tvarsumman(n): if n<10: print n else: tvarsumman((n/10) + n%10)
99--> 9+9=18-->1+8=9
thats wrong according to my professor.
can u help fix my function?
and all the ones u have made so far have been perfect! u are really helping me. thank u sir!...Last edited by bartonc; Oct 26 '07, 04:55 AM. -
Parsing a log file, etc
i have to make 3 seperate functions that:
function1. Counts the lines in a my 'logfile' and returns the answer in idle.
function2. counts how many times a certain user is in the 'logfile' for instance how many times 'johnny.killed. peter' has been logged in the 'logfile' and returns only the answer
function3. shows what files the user 'johnny.killed. peter' has looked at and writes the names of the files...Last edited by bartonc; Oct 26 '07, 04:59 AM. -
Collect and Query votes using a Dictionary
i need to make a dictonary that works like so:
when u type:
vote(dict,perso n): it should vote for that person in question by modifying the dictionary and if the person does not exist it creates the person and places a vote for them.
votes(dict,pers on): it shows how many votes that person in question has and zero if a nmae is tyoed that isnt in the dictionary.
result(dict): shows who has... -
Geometrical mean
I need to define a function "geomean(number s)" that takes all the numbers in the list, adds then together then takes the sum of the numbers and puts it to the power of 1/how many numbers there are in the list. the resulty should be something like this:
geomean([1,2,3,4])
1+2+3+4=10
10^(1/4)
do yall get what im trying to say? when i read what i just wrote its hard for ME to follow... -
Thanks u guys this really helped. i ahve some more questions but ill make a new discussion. hop eu read it soon!Leave a comment:
-
list of word from a string
Im a beginner and im tryin to do a couple things.
#1. i want to def a function "func(ListOWord s)" for exampleand what i want it to do is take a list of words for example (["dod","fre","sd f","ser","ftre" ,"dfr"]) and i want it to split them at the commas and rewrite them printing everyother word first then the remaining words after. that sounds alittle weird but it should...
No activity results to display
Show More
Leave a comment: