Skip to content

StringPolynomial Issue for a general polynomial representation #5

@olgOk

Description

@olgOk

Hi!

I was trying to play with the example for an arbitrary function specified as a string using a numpy expression when run into an issue for the code line (poly + Polynomial([0, ] * poly.degree() + [eps / 2, ]))

TypeError: unsupported operand type(s) for +: 'StringPolynomial' and 'Polynomial'

My code followed exactly the example provided in the repo:

poly = pyqsp.poly.StringPolynomial("np.cos(3*x)", 6)
ang_seq = pyqsp.angle_sequence.QuantumSignalProcessingPhases(poly)
pyqsp.response.PlotQSPResponse(ang_seq, target=poly, signal_operator="Wx")

Are there missing lines of code that convert a string representation of a function to a function or am I doing something wrong here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions