Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2013-12-31 17:09:08

prathima
Member
Registered: 2013-09-19
Posts: 33

scilab programmes

i need scilab progam for
1. to obtain fibonacci series
2.to obtain non fibonacci series
3. to find the root of the equation f(x,a)=a*cos(x)-x*e(-a*x) for different values of a∈[1,10]
please reply soon.
it is imporant for my examsdunno

Last edited by prathima (2013-12-31 17:27:06)

Offline

#2 2013-12-31 18:48:23

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: scilab programmes

I do not program in Scilab. Best I can do is pseudocode, you will and should write them.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#3 2013-12-31 19:13:48

prathima
Member
Registered: 2013-09-19
Posts: 33

Re: scilab programmes

ok....

Offline

#4 2013-12-31 19:30:59

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: scilab programmes

1. to obtain fibonacci series

I guess you mean Fibonacci sequence.

1) x1 = 1;
2) x2 = 1;
3) h = x2;
4) x2 = x1 + x2;
5)Print[x2]
5) x1 = h;
6) Goto 3

Remember to debug it if necessary. I am partying.

2.to obtain non fibonacci series

What is a non Fibonacci sequence specifically?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#5 2013-12-31 20:09:36

prathima
Member
Registered: 2013-09-19
Posts: 33

Re: scilab programmes

non fibonacci sequence is 4,6,7,9.10,11,12,14,15,16,17,18,19,20,...

Offline

#6 2013-12-31 21:15:19

gAr
Member
Registered: 2011-01-09
Posts: 3,482

Re: scilab programmes

The example for Fibonacci is there: http://hkumath.hku.hk/~nkt/Scilab/IntroToScilab.html

for 3, you can use newton-raphson,

E.g. in python,

from math import exp, sin, cos
t=3
told=1
a=5
while abs(t-told) > 0.00000000001:
    told=t
    t=t - (a*cos(t) - t*exp(-a*t))/(a*t*exp(-a*t) - a*sin(t) - exp(-a*t))
print t

"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

#7 2013-12-31 22:18:47

prathima
Member
Registered: 2013-09-19
Posts: 33

Re: scilab programmes

i dnt knw hw to insert the condition that a∈[1,10] in newton raphson method

Offline

#8 2013-12-31 22:24:05

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: scilab programmes

Hi;

Is it continuous?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#9 2014-01-01 01:04:11

prathima
Member
Registered: 2013-09-19
Posts: 33

Re: scilab programmes

i dont know.
in question it is not clear that a is continous or not

Last edited by prathima (2014-01-01 01:06:38)

Offline

#10 2014-01-01 01:06:16

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: scilab programmes

What values can a take? a = 1,2,3,4... integers? Or any value from 1 to 10 like 7.27?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#11 2014-01-01 01:10:46

prathima
Member
Registered: 2013-09-19
Posts: 33

Re: scilab programmes

question is
scilab program to find the root of eqn f(x,a)=a*cos(x)-x*e^(-a*x) for different values of a∈[1,10]

Offline

#12 2014-01-01 01:13:30

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: scilab programmes

Why not use the code gAr provided for python.

from math import exp, sin, cos
t=3
told=1
input[a];
while abs(t-told) > 0.00000000001:
    told=t
    t=t - (a*cos(t) - t*exp(-a*t))/(a*t*exp(-a*t) - a*sin(t) - exp(-a*t))
print t

I just changed one line to Input[a]. Now you can enter any a you want.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#13 2014-01-01 01:23:58

prathima
Member
Registered: 2013-09-19
Posts: 33

Re: scilab programmes

thank youup:)

Offline

#14 2014-01-01 01:25:07

prathima
Member
Registered: 2013-09-19
Posts: 33

Re: scilab programmes

scilab program to obtain non fibonacci series

Offline

#15 2014-01-01 01:33:21

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: scilab programmes

Generate the fibonacci numbers like I did in the first post and then an array of {1,2,3,4,5....}. When you get a fibonacci number cross it out by zeroing the array element.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#16 2014-01-01 01:46:46

prathima
Member
Registered: 2013-09-19
Posts: 33

Re: scilab programmes

zeroing the array element means

Offline

#17 2014-01-01 01:48:51

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: scilab programmes

Putting a zero in the array element.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#18 2014-01-01 01:50:04

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,974
Website

Re: scilab programmes

prathima wrote:

it is imporant for my examsdunno

I hope you do not mind me asking but what grade student are you?


'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

#19 2014-01-01 01:52:40

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: scilab programmes

i am not getting

Do you know what an array is?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#20 2014-01-01 01:58:32

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,974
Website

Re: scilab programmes


'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

#21 2014-01-01 02:00:26

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,049

Re: scilab programmes

Hi prathima

Basically, just take the array {1,2,3,4,5,6,...} and put a zero instead all the numbers which are Fibonacci numbers.

Last edited by anonimnystefy (2014-01-01 02:00:47)


“Here lies the reader who will never open this book. He is forever dead.
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

#22 2014-01-01 02:00:53

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: scilab programmes

He can not do that yet.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#23 2014-01-01 02:01:26

prathima
Member
Registered: 2013-09-19
Posts: 33

Re: scilab programmes

in scilab array set values in vector form for ex. A=[1 2 3]

Offline

#24 2014-01-01 02:02:20

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: scilab programmes

Do you know how to access an individual array element?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#25 2014-01-01 02:03:41

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: scilab programmes

What is pg?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

Board footer

Powered by FluxBB