2

As title says, here is my system:

[;Acos(\phi)=1;]

[;-0.5Asin(\phi)=0;]

The obvious solutions are

A=1 and [;\phi=n\pi , n\in \mathbb{Z};],

I tried using sympy..nsolve(doesn't work) and scipy..fsolve(gives an error "Result from function call is not a proper array of floats")

Raghbendra Nayak
  • 1,606
  • 3
  • 22
  • 47
zivo
  • 120
  • 8
  • *'scipy..fsolve(gives an error "Result from function call is not a proper array of floats")'* If you don't show us the actual code that you used, it is hard for anyone to help you with that. Creating a [minimal, complete, verifiable example](http://stackoverflow.com/help/mcve) would make it much easier for someone to help you with this problem. – Warren Weckesser Dec 07 '16 at 18:32

1 Answers1

1

The presence of trigonometric functions makes the system difficult to solve, even though it appears to be a "simple" one.

One approach to easily find the solutions of a system that includes terms of the form cos(x) and/or sin(x) is to perform the substitution u=cos(x), v=sin(x), introduce the additional equation u**2 + v**2 == 1, and solve for u, v. Variable x can then be obtained from the value(s) of u.

import sympy as sp

A, u, v, phi = sp.symbols('A, u, v, phi', real = True)

eqs = [sp.Eq(A * u, 1), sp.Eq(-A * v/2, 0), sp.Eq(u**2 + v**2, 1)]
sol = sp.solve(eqs, [A, u, v])
print (sol)

[(-1, -1, 0), (1, 1, 0)]

It follows that A can take two values (-1, 1). For A=-1 it must hold u==-1, which corresponds to an infinite number of values of phi as follows

sp.solveset(sp.Eq(sp.cos(phi),-1), phi)

ImageSet(Lambda(_n, 2*_n*pi + pi), Integers())

The procedure is similar for A=1.

Stelios
  • 5,271
  • 1
  • 18
  • 32