Any ideas, how to replace function in interval with third-degree polynomial?
For example,
F(x)=a*sin(1*x/b)+b*cos(1*x/c) needs to be replaced in interval [-10,3] with third-degree polynomial.
Any useful comments or ideas are highly appreciated.
Thanks.
Related
So essentially I understand how to minimize/maximize a linear function when I am given it in the form such as y = mx + b.
But the problem involves a flow network and linear programming, and this is really what is confusing me. I would seriously appreciate any clarification! And no, this is not a homework problem, but an optional exercise. Thank you.
The vector x is |E|-dimension, so I am thinking for nontrivial problems you cant even draw one.
this is my first Scilab algorithm (Horner's method). Please tell me what should I correct to make it working (according to this flowchart). I am a very beginner. Your feedback will be highly appreciated. Thanks!
function
N=4 //number of elements
TAB=[4,2,6,5] //exemplary numbers
w=a0
i=1
while i<=n do
w=wx+a[i]
i=i+1
end
endfunction
Please, read some introduction (https://www.scilab.org/scilab-real-dummies for example) to Scilab to learn the basics it will help you for the future.
The calling sequence of your function should be something like:
v=myhorner(A,x)
where A is the array containing the polynomial coefficients in decreasing order and x the value for which you want to evaluate the polynomial.
Then the code should be
v=A(1);
for i=2:size(A,"*")
v=v*x+A(i);
end
Note however the horner function already exists in Scilab
Supposed that i have
fu3 = g.^5.*qQd./(exp(g.^2/T(i)));
I_value = (1/T^3)*trapz(g,fu3);
so, that depends of T and s ( included in qQd ). This calculation take a several minutes. So i want to fit this expression into a easy polynomial expression. I Think the name is fit or interpolation. I want to find a polynomial expression that satisfy my integral of I_value. Any help ?
What's your integration range? Let me assume it is pretty large. Then your integrand function varies by many orders of magnitude (did you plot it? probably you need logarithmic scale to understand the full extent of the problem). This is the cause for trapezoidal integration taking minutes. Replacing the integrand by a polynomial is not an option here.
Solution 1: Solve the problem analytically (partial integration, and substitution g^2->u).
Solution 2: If nevertheless you want to do it numerically, use a better integration scheme than equidistant trapezoids. You need an integrator that adapts step width according to magnitude variations of the integrand.
We know that if $μ(n)=0$ then the integer n has at least one factor with multiplicity.
Now how can we determine if in the decomposition of a rational (m/n)>1 to prime factors, we have a power less than (-1)? For example
m=2*3*5*7*11;
n=2^2*3^3*5;
m/n=2^(-1)*3^(-2)*7*11
f(m/n)=0 (*for example*)
Is there any function similar to Moebius function μ in Mathematica which does this job for me?
I think I can write the code, but I need a defined function in Mathematica?
thanks
I think I found it,
It should be
f[x_]:=If[SquareFreeQ[x]==True,1,0]
First, yes it's my HW and I find it hard so I'll really appreciate some guidance.
I need to prove that for denomination of 1,x,x2...xn when x>=1 the greedy algorithm for the coins problem always work .
We will always get the amount of money we need in minimal coins number when we always pick the maximal coin that smaller from the amount.
Thank you.
As this is your homework I will not provide a complete answer but will rather try to guide you:
First as it usually happens for problems of that type try and prove for yourself that the statement is true for the first few natural numbers. Try to summarize what you use to make the proof for them. This usually will give you some guidance of the correct approach.
I would use induction for this one.
Another option that might help you - represent all the numbers in numerical system with base x. This should make it clearer why the statement is true.
Hope this helps you.