FAQ Database Discussion Community

Find tangent points on a curve from a user-given point outside the curve

I am trying to find the tangent lines from a given point outside a closed curve (not on the curve). The curve is defined as 2D x and y coordinates of points´╝îshaped like an irregular ellipse for example. If given a point by the user: (x0,y0) = (-30,80), how can...

MATLAB polynomial fit selective powers

I have 2 vectors x and y to which I want to fit a polynomial as y = f(x) in MATLAB. I could have used polyfit. However, I want to fit only selective power terms of the polynomial. For example, y = f(x) = a*x^3 + b*x + c. Notice...

IPython, Ploting a Polynomial

I've been working with Sympy for an Interpolation, in wich I obtain as a result a 7th degree Polynomial (ax^7 + bx^6 + cx^5 + ...+ h) wich I want to Plot, but wen I try to plot it I get errors, for example, if i try: plt.plot(r,U.subs(x,r)) where r...

Create a polynomial of arbitrary degree in python

I would like to use a polynomial function of the type ax +bx^2+c*x^3+... to fit some data using scipy.optimize.curve_fit. I managed to do it fine but my problem is that I would like the user to be able to enter the degree of the polynomial for the fit and nothing...

How to set up an array with related items

I am trying to make a program that will allow me to manipulate multi-variable polynomials. I want to be able to deal with expressions that have more than one variable, and each with its own exponent. For example, one example of a polynomial object will contain information from 5x^2*y^3. I...

Roots of a polynomial mod a prime

I'm looking for a speedy algorithm to find the roots of a univariate polynomial in a prime finite field. That is, if f = a0 + a1x + a2x2 + ... + anxn (n > 0) then an algorithm that finds all r < p satisfying f(r) = 0 mod...

Why does Sympy cut off polynomial terms with small coefficients?

I am trying to convert an expression containing terms with various degrees of a symbolic variable z_s into a polynomial in python using sympy.Poly() so that I can then extract the coefficients using .coeffs(). The expression I have is a high-order polynomial with independent, symbolic variable z_s. For some reason,...

Transferring code from notepad ++ to command prompt

I'm relatively new to java, so I wouldn't be surprised if I'm missing something obvious here. Anyways, I made a code that finds the roots of a polynomial using the Bisection method. I thought the program was all well and dandy until I pasted it from notepad++ to command prompt,...

R_fitting a polynomial with a known intercept

Hello I am using lm(y~poly(x,2)) to fit a second order polynomial to my data. But I just couldn't find a way to give a known intercept value. How can I fit a polynomial model with a known intercept value (say 'k') using lm? Thanks

C++: How to compute an integral with interval bounds?

I am both tired, new to C++ and real bad at dealing with polynomials. That's a bad combo for my assignment. Nevertheless I am trying to solve it. Please note that I might have misunderstood certain parts both mathematically and language-wise. Maybe even terminology. The first task of my assignment...

Polynomial multiplication in M2(R)?

I was trying to implement a FFT-based multiplication algorithm in M2(R). Basically an algorithm that gets as an input two polynoms with elements given as matrices, and builds the product polynom. However, even though the algorithm should work, as it looks exactly identical to a version I wrote earlier on...

polynomial fitting on spectral data

I want to fit a polynomial function (max. 3rd order) on each raster cell over all my spectral bands (Landsat 1-7) creating a new raster(stack) representing the coefficients. I got my data (including NA values) in a stack with 6 Layer (Landsat Band 1-7[excluding 6]). I guess somehow I should...

What is an efficient way of multiplying massive polynomials in Java?

I have a function that defines a very long polynomial useful in operations with matrices. The formula multiplies binomials of the form (1+xi*yj) , where i and j are subscripted and correspond to the rows and columns of the matrix in question, respectively. The polynomial that results is the product...