Nope, to tell the truth I've only ever used scripting languages before for various bits of software, and have been programming for a mere month or so as it's part of my electronics degree....I will have to learn assembly and MATLAB later too, as well as a ........ loads of advanced maths like fourier/laplace transforms. :/
Well my hats off to you, bud. That is certainly a noble profession. You will have fun with assembly I know I like playing with it. Maybe you can help in my plight to get MathML extentions supported on the forum.
Why thank you, I really want to learn assembly, as it's quite relevant to programming microcontrollers, which is more along the lines of what I'll be doing (rather than software development for OS's).
I've never heard of math ML, but i will certainly invite you on a new plight to get LaTeX...as I have used it for a while on maths forums, and it is very powerful and easy to use, and not that hard to implement. (I think)
I looked at the wiki on math ml and it says:
In LaTeX, this is simply [math]ax^2+bx+c[/math]The expression ax2 + bx + c could be represented as
<apply>
<plus/>
<apply>
<times/>
<ci>a</ci>
<apply>
<power>
<ci>x</ci>
<cn>2</cn>
</power>
</apply>
</apply>
<apply>
<times/>
<ci>b</ci>
<ci>x</ci>
</apply>
<ci>c</ci>
</apply>
LaTeX is fine by me I have used it before. There are times when I am trying to explain a mathematical concept or write a function that does an equation, and have no visually appealing way to express the equation.
The end result: Summation = for loop.
Or similar.
Also, another question, could I declare variables within the for loop like so:
...so that even though 'xi' and 'function' would be reset on each iteration, the code would still work the same?....I'd like to do this just to break up the code a bit, and it looks a bit neater, and easier for me to keep track of.Code:float sum=0.0; for(x=0;x<=5;x++) { float xi=a+(b*x); float function = xi*xi; sum+=function; continue; } printf("sum of series = %f\n",sum)
Also, does 'continue;' just tell the loop to continue? Silly question, but I was under the impreson it would continue anyway until x<=5.
Yeah continue just skips back to the beginning of the loop. Don't use it like that, however. Its only handy if you need to conditionally leap ahead one iteration.
Yes, it is perfectly legal to declare variables like that. Its prefered by many since it makes it clearer what each variable is used for.
Ok thats good, well thanks alot for all your help! I'll try and re-run my program.
see you soon on the forums!
Wait... before you run off. Vote!