Chris asks…

## Mathematica?

Can anyone help me set up Newton’s iteration scheme in **Mathematica**? The program claims the formula is this:

fprime[x_] = f'[x];

digits = 100;

newt[x_] := SetPrecision[x – f[x]/fprime[x], digits]

I am using the equation (x^2)-2 because we are supposed to have a function that equals zero and x=sqrt(2). How do I set up my equation?

Thank you!

### richmama answers:

You don’t have an initial x value, usually called x₀. You need that to be specific about this… I’ll say x = 1.

Then try this:

f[x_] = x^2 – 2;

x0 = 1;

Iterations = 5;

digits = 100;

For[i = 0, i < Iterations, i++,

x0 = x0 – f[x0]/f'[x0];

]

N[x0, digits]

N[Sqrt[2], digits]

Mark asks…

## mathematica?

This was an assignment that we had and that I couldn’t do. When it was assigned we knew how to plot, evaluate expressions, create functions, solving linear systems, basic loops, random numbers, and some stuff with tables and lists. All very basic mind you.

The assignment was this:

1) Run a random simulation with 1000 families and determine how many children a family will have on average.

2) On average, how many daughters and how many sons will there be in a family.

Thanks for your help…

### richmama answers:

Mathematica is not easy and I don’t think 99% of people here would have used it unless they are majoring in maths in university. Your best bet is to discuss with your friends or lecturer.

Charles asks…

## How does Mathematica work for simultaneous equations?

I want to solve this equation for A for example. The answer will be in the other variables. However, when i put this in **mathematica**, i get an error or nothing as the answer.

Solve[{1 == Au + Bp, 3 Bp + 5 Au == 21}, {A}]

Thanks!

### richmama answers:

Good fine

i dont know what matematica is….. I suppose some function in something…. But sim eq works this way….

In one of the eq you isolate a variable, say

1=au+bp, then 1-bp =au ok???

Then you substitute the value of this variable in the other eq…

3bp+5au=21 ok??

Then 3bp +5(1-bp)=21 ok??

Then 3bp +5 -5bp =21 ok??

Now 3bp -5bp =21 -5

-2bp=16

bp =-8

in the first eq 1=au+bp

1=au-8

then au =9

William asks…

## How to use Mathematica to make x subject of an equation?

Hello,

I’d like to know if it’s possible to use **Mathematica** to make a particular variable the subject of the equation. I have some horrendous equations to untangle [and I’m not even sure if I’ve formulated the equations correctly; they are to do with Fluid Dynamics and shocks] and can’t fathom how to rearrange them.

### richmama answers:

You can do this with several forms, I´ll tell one. If you can be more specific with your problem, maybe it´s better use another approach.

Your equation can be specified as a Mathematica function, for example:

func[z_] := a Sin[b x] + z x

And use func as you wish:

func[w]

D[func[r], r]

Integrate[func[u], {u, 0, 10.}]

In this case, a, b and x will be constants (but you can do literally)

Powered by Yahoo! Answers