Welcome! This page is using CodeRay 1.1.2.

We currently have 3043 rays in the database.
You can add a New Ray or browse the posted rays by pages.

Page 109, 10 entries

asdas 42 lines of Ruby by asfd 893 Bytes Show Edit Expand
1
2
3
4
5
6
7
8
9
10
11
a=100000.0
r=0.06
p=10000.0
n=Math.log((-p)/(a*r-p),1+r) #formula for n, directly
p "n=#{n}" 
time= ( (1.0+r)**n * (a*r-p) +p)/r
p "Amount to pay after #{n} years : #{time}" 


a=100000.0
...
asdas 44 lines of Ruby by asfd 852 Bytes Show Edit Expand
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
a=100000.0
r=0.06
p=10000.0
n=Math.log((-p)/(a*r-p),1+r) #formula for n, directly
p n 
time2=( (1.0+r)**n * (a*r-p) +p)/r
p time2




a=100000.0
r=0.07754689530012998
#p=10000.0
n=15....
asdas 46 lines of Ruby by asfd 694 Bytes Show Edit Expand
1
2
3
4
5
6
7
8
9
10
11
12
13
tr=6.0155030729515095
def g(x)
  6.28+Math.sin(x)
end
results=Array.new
eps= 0.00001
x0 = 6
x1 = x0+eps*10.0
i = 0
while ((x1-x0).abs>eps) do 
  x0=i==0 ? 6 : x1
  x1=g(x0)
  results[i]= x1...
asdas 45 lines of Ruby by asfd 687 Bytes Show Edit Expand
1
2
3
4
5
6
7
8
9
10
11
12
13
 tr=0.714190048071806
def g(x)
  0.9/(1.0+x**(4.0))
end
results=Array.new
eps= 0.00001
x0 = 0.75
x1 = x0+eps*10.0
i = 0
while ((x1-x0).abs>eps) do 
  x0=i==0 ? 0.75 : x1
  x1=g(x0)
  result...
asdas 50 lines of Ruby by asfd 713 Bytes Show Edit Expand
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
tr=0.85260550201372549135
def g(x)
  2.0*Math.exp(-x)
end

results=Array.new

eps= 0.00001
x0 = 0.8
x1 = x0+eps*10.0
i = 0
while ((x1-x0).abs>eps) do
  x0 = i==0 ? 0.8 : x1
  x1 = g(x0)
...
asdas 50 lines of Ruby by asfd 713 Bytes Show Edit Expand
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
tr=0.85260550201372549135
def g(x)
  2.0*Math.exp(-x)
end

results=Array.new

eps= 0.00001
x0 = 0.8
x1 = x0+eps*10.0
i = 0
while ((x1-x0).abs>eps) do
  x0 = i==0 ? 0.8 : x1
  x1 = g(x0)
...
asdas 10 lines of Ruby by asfd 216 Bytes Show Edit Expand
1
2
3
4
5
6
7
8
9
x = 0.5
c_values = [1.0, 1.25, 1.5, 1.75, 2.0, 2.25, 2.5, 2.75, 3.0, 3.25, 3.75]
c_values.each { |c|
  temp=0
  100000.times { 
    temp = x
    x = c* x * (1-x)
  }
  puts "c=#{c} \t:\t x=#{x} :\t...
asdas 82 lines of Ruby by asfd 1.27 KB Show Edit Expand
1
2
3
4
5
6
7
8
9
10
11
12
13
14
trueroot=1.0
Restults=Hash.new()

def f(x)
  x**(3.0)-3.0*x**(2.0)+3.0*x-1
end

def f1(x)
   3.0*x**(2)-6.0**x+3.0
end

def bisection(inta, intb, epsilon )
    a, b = inta, intb
    c    = ...
asdas 81 lines of Ruby by asfd 1.31 KB Show Edit Expand
1
2
3
4
5
6
7
8
9
10
11
12
13
trueroot=0.42630275100686274567
Restults=Hash.new()

def f(x)
  x**(0.5) - Math.exp(-x)
end

def f1(x)
   1/(2*Math.sqrt(x)) + Math.exp(x) 
end

def bisection(inta, intb, epsilon )
    a, ...
some ruby 13 lines of Ruby by Dino 149 Bytes Show Edit Expand
1
2
3
4
5
6
7
8
9
10
11
12
13

get '/users' do
  redirect to('/')
end

get '/users/new' do
  haml :users_new
end

post '/users' do
  @user = params[:user]
  haml :user
end

Page 109, 10 entries