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

You are not logged in.

- Topics: Active | Unanswered

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

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 exams

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

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 106,337

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.****No great discovery was ever made without a bold guess. **

Offline

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

ok....

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 106,337

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.****No great discovery was ever made without a bold guess. **

Offline

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

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

Offline

**gAr****Member**- Registered: 2011-01-09
- Posts: 3,479

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

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

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

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 106,337

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.****No great discovery was ever made without a bold guess. **

Offline

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

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

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 106,337

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.****No great discovery was ever made without a bold guess. **

Offline

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

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

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 106,337

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.****No great discovery was ever made without a bold guess. **

Offline

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

thank you:)

Offline

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

scilab program to obtain non fibonacci series

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 106,337

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.****No great discovery was ever made without a bold guess. **

Offline

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

zeroing the array element means

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 106,337

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.****No great discovery was ever made without a bold guess. **

Offline

prathima wrote:

it is imporant for my exams

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

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 106,337

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.****No great discovery was ever made without a bold guess. **

Offline

'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

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

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

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 106,337

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.****No great discovery was ever made without a bold guess. **

Offline

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

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

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 106,337

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.****No great discovery was ever made without a bold guess. **

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 106,337

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.****No great discovery was ever made without a bold guess. **

Offline