A summary of different symbols in programming [closed] - math

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed yesterday.
Improve this question
I'm preparing for competitive programming, I keep running into different symbols in problems that I'm expected to know.
(example image of such symbols)
Can someone make a summary of all of these different symbols and explain what they mean? Thanks in advance.

The big Sigma stands for "sum". The part you've circled in red means:
a_l + a_(l+1) + ... + a_(r-1)
It's a sum of r-l elements. And then you're dividing this sum by r-l, so you end up with the average of those r-l elements.
A sum like this can usually be implemented with a for-loop:
s = 0;
for (i = l; i <= r-1; i++)
{
s += a[i];
}
But note that in many cases the sum can be computed directly without a slow loop. For instance if the a_i follow an arithmetic progression or geometric progression then you can calculate the sum directly without actually summing all the terms one by one.
The arrow presumably means "tends to", giving information about a limit of this quantity. However, normally we never use this arrow alone; there should be some context to tell which limit we're talking about. For instance, "3x+4 tends to 13", alone, makes no sense. What would make sense would be "3x+4 tends to 13 when x tends to 3".

Related

Numerical integration of an unknown function [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 months ago.
Improve this question
For a school project I have to determine a function u(t) of time. I have derived an expression of the following form:
(https://i.stack.imgur.com/vNrYb.png)
with a,b,c,d constants (not necessarily integers). I have figured out that this problem is only solvable with numerical integration with initial condition u(0)=u_0, yet I don't know how to do this particular problem.
I have looked at all the numerical integration methods I have learnt so far, but they all seem to apply for polynomials or for functions where you know the function evaluations at specific points.
There are lots of ways to calculate an approximate value for u(t), some simple but requiring a lot of iterations, and more complex requiring fewer iterations. Assuming a,b,c,d are real numbers, and u_0 = u(0) then for t > 0, one could just split the interval between 0 and t into N sub-intervals and calculate
u_(i+1) = u_i + (du/dt)(t_i)*t/N
where t_i = i*t/N
then,
u_N = u(t).
If N is not sufficiently large, the result will be inaccurate. To obtain a satisfactory N is more art than science. Just printing the results for increasing N should give you an idea of how large N needs to be to obtain the level of accuracy you need. Adding higher order terms (d^2u/dt^2 etc.) can sometimes improve speed and accuracy.
You can't numerically integrate anything unless you have values for all those constants.
I don't know what numerical integration schemes you looked at, but I think Euler's method or Runga-Kutta would both be worth trying.
You don't say which language you want to use. Python would be a fine choice. So would Java. Lots of libraries to help.
Wolfram Alpha has a closed-form solution here. It's a separable, non-linear ODE. You'll need to know hypergeometric functions to evaluate.

Properly reading recursive functions [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I currently teach myself programming and I came to a point where I was introduced to the recursive functions. I understand the basic principle behind them but whenever I try to read a code which contains recursive functions I have tough times tracing them. Honestly, If I don't write down the whole function on a paper and manually follow it I can't really understand what it does, I can't follow it mentally is what I am saying. Can you give some tips on how to do it mentally? I am pretty much average intelligent ( IQ 117 ), maybe that's the problem? Thanks in advance.
I think this is an excellent question. Many people make the mistake of trying to follow the call-stack of a recursive function, which is the wrong approach.
I find the only way is to look at what is written and ask yourself whether it is logically correct and whether it will end. If those things are true, it is going to work and you don't really need to understand how.
In more detail:
Are all possible input values considered?
Are the statements true in each case?
Is there a (are there) value(s) at which point the function will not recurse?
Do all remaining input values ultimately lead to that value?
For example (pseudo code):
factorial(n):
if (n < 0) throw InvalidArgument
if (n == 0) return 1
else return factorial(n - 1) * n
All input values are covered. The statements are true. There is a value at which it does not recurse (<=0) and the all remaining values reduce by 1 until the exit value is reached. Therefore it works.
You may of course make mistakes in your thinking. A good IQ does help here, and you may need at some point to resort to tracing or debugging to check your assumptions and find the error in your logic, but this should not be the first approach.
That is the beauty of recursive solutions: they tend to be statements of fact rather than procedural instructions!
I think IQ does not matter. Anyway, i think it's all about practice. Try to write some recursive functions. And after alot of practice and experience you will find it more easy to understand.
There is some good ideas.
Good luck.

examples to compare tradtional math notations vs APL/J notations [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
I am reading a review to compare Mathematica to APL/J. One question raised in the article seems very interesting to me:
Is Mathematica really the way to go to express our creative thoughts –
viz back to a 17th century notation designed for parchment instead of
forward to a twentieth-century one designed for computers?
Can one share examples of Iverson's notation vs traditional math notation to demonstrate the edge of APL/J on expressing and solving math problems? This would be greatly helpful for new comers.
One example: Alternating series.
Alternating sum is very common in mathematics. But it is cumbersome to put the sign before each term:
in APL and J, because of the order of operations, it is
-/a
I recommend reading Iverson's paper Notation as a Tool of Thought, kindly provided by the J folks. It deals precisely with this issue.
In it you'll find many Math proofs derived using APL instead of the classical notation, along with accompanying commentary. Here's a redacted example, proving Gauss's formula for the arithmetic series:
+/⍳n
+/⌽⍳n ⍝ as + is associative and commutative
((+/⍳n)+(+/⌽⍳n))÷2 ⍝ as x=(x+x)÷2
(+/(⍳n)+(⌽⍳n))÷2 ⍝ as + is associative and commutative
(+/(n/n+1))÷2 ⍝ summing each respective x∊⍳n and y∊⌽⍳n, y=n+1-x → (x+y)=n+1
(n×n+1)÷2 ⍝ per definition of × (times)
Other articles by Iverson, Hui and friends are also illuminating. Again, the J folks provide a notable library.

Which program to solve integration = 0 for a variable? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
i'd like to know how to solve a definite integral in Mathematica.
I do know all variables except b, and need to solve for F(b)=0.
How can i solve it in Mathematica?
Here is my try:
NSolve[Integrate[1/(8*(1 - ff) (2 Pi)^0.5) E^(-0.5*((x - 1.1)/(1 - ff)/8)^2), {x, 0, 9999}] == -0.44531779637243296, ff]
These integrals can be trivially expressed in terms of an error function: Wiki, Mathworld. Hence what you need here is a library to (i) calculate error functions, (ii) numerically solve non-linear equations. Virtually any language has this, so pick anything you're familiar with. In Mathematica, look up Erf and NSolve.
I'd start by plugging it into Wolfram Alpha and see what it gives you.
Mathematica should be able to do it. I think of statistics first when R comes up; I don't know about its calculus capabilities. Excel is not the first choice.
If I were you, I'd be less worried about the software and more worried about the solution itself. A function of this form might be well known. Plot each one and visually check to see what the functions look like and how easy they might be to integrate.
Like this:
http://www.wolframalpha.com/input/?i=graph+exp%28-%28%28x%2B5%29%2F1.5%29%5E2%29
You should be wondering why it's three similar looking integrals. Those singularities in the plot tell you why.
If there's no closed form solutions, you'll have to go with a numerical one. You'll have to choose an algorithm (simple Euler or Runga Kutta or something else), interval sizes, etc. You'll want to know about singular points and how best to tackle them.
Choosing a package is just the start.
You might find http://r.789695.n4.nabble.com/calculus-using-R-td1676727.html helpful.

What math field can deduce equations for a hand-drawn shape? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
Suppose I have an Arabic character hand-drawn in Thuluth font, as in:
http://arabicletters.info/wp-content/uploads/1.jpg
I was thinking of a way I can recreate the same shape but at a much greater height, whilst leaving the other characteristics intact (stroke width, thickness, the relation of where the curving starts to happen to the height) which then got me curious about a way of finding its mathematical representation and play with it until I can get what I want or any other shape for that matter. Is there a math sub-specialty that can help with this? and for this particular problem, can it be solved using programs like Adobe Illustrator or AutoCAD?
Forgive the noobness.
I don't think deduce is the right word.
You can get what you want if you add sufficient points and do Bezier spline fits to match the letters.
There might be a way to automate the process of adding points, but the "sufficient" criterion is tricky. And then you'd have to tell how to connect points with splines.
Sounds like you're trying to reproduce optical character recognition in Arabic.

Resources