Why solve() is not solving?
07-07-2016, 01:22 PM
Post: #1
 tiamattia Junior Member Posts: 17 Joined: Jul 2016
Why solve() is not solving?
Hello,

I'm trying to solve a complex equation. This is the function i defined "gamma":

If i write:

The calculator says:

As you can see in the second image, no result is returned. Why? Is there a way to solve this or i have to write it in explicit form?
07-07-2016, 02:34 PM
Post: #2
 ww63 Junior Member Posts: 43 Joined: Sep 2014
RE: Why solve() is not solving?
Maybe, because the Gamma function isn't a function, that can be described analytical. So you can only solve witha numreical algorithm?
07-07-2016, 02:39 PM
Post: #3
 tiamattia Junior Member Posts: 17 Joined: Jul 2016
RE: Why solve() is not solving?
I tried to use fsolve() with no success. Now i've re-wrote the function using 2*pi*f instead of omega and both solve and fsolve converge to a solution.
07-07-2016, 04:19 PM
Post: #4
 Tim Wessman Senior Member Posts: 2,233 Joined: Dec 2013
RE: Why solve() is not solving?
(07-07-2016 01:22 PM)tiamattia Wrote:  I'm trying to solve a complex equation. This is the function i defined "gamma":

Can you show how you defined it? It should work provided your definition is correct.

TW

Although I work for the HP calculator group, the views and opinions I post here are my own.
07-07-2016, 05:11 PM
Post: #5
 tiamattia Junior Member Posts: 17 Joined: Jul 2016
RE: Why solve() is not solving?
Hello Tim,
I defined it with this cmd:

07-07-2016, 08:31 PM
Post: #6
 Tim Wessman Senior Member Posts: 2,233 Joined: Dec 2013
RE: Why solve() is not solving?
Did you just replace omega by 2*pi*f or make any other changes?

Note, you can just copy/paste your text directly from the emulator if you are using that. Makes it easier rather then pictures everyone has to type and hope they didn't make a mistake.

TW

Although I work for the HP calculator group, the views and opinions I post here are my own.
07-07-2016, 10:22 PM
Post: #7
 tiamattia Junior Member Posts: 17 Joined: Jul 2016
RE: Why solve() is not solving?
Yes, this is what i'm executing:
Code:
 Cmd: √(-ω^2*μ*ε*0.00000125664*8.85419e−12+()*ω*μ*σ*0.00000125664)▶gamma(ω,σ,ε,μ) Result: (ω,σ,ε,μ)->√((-ω²)*μ*ε*0.00000125664*8.85419e−12+()*ω*μ*σ*0.00000125664) Cmd: gamma(1,1,1,1)  Result: 7.92666386315e−4+7.92666386322e−4* Cmd: solve(gamma(x,1,1,1) = 7.92666386315e−4+7.92666386322e−4*()) Result: [] Cmd: fsolve(gamma(x,1,1,1) = 7.92666386315e−4+7.92666386322e−4*(), x = 1) Result: 4.88592031168e−9+5.90761930892e−7* As you can see, the result of fsolve is way different from 1. Cmd: √(-(2*π*f)^2*μ*ε*0.00000125664*8.85419e−12+()*2*π*f*μ*σ*0.00000125664)▶gamma(f,σ,ε​,μ) Result: (f,σ,ε,μ)->√((-(2*π*f)²)*μ*ε*0.00000125664*8.85419e−12+()*2*π*f*μ*σ*0.00000125664) Cmd: gamma(1,1,1,1) Result: 1.98691997624e−3+1.98691997635e−3* Cmd: solve(gamma(x,1,1,1)=1.98691997624e−3+1.98691997635e−3*) The emulator crashes after this command. The calc instead solves this. The result is: {0.999999999998+5.53621719455e−11*} Cmd: fsolve((gamma(x,1,1,1)) = (1.98691997624e−3+1.98691997635e−3*()),x = 1) The emulator crashes after this command. The calc instead solves this. The result is: 0.999999999998

(I'm using the character sigma (lower case) σ, that is an alias of the character sigma (upper case) ∑ which is the summation function, as a variable. I don't think this is the problem beacuse i'm using it in both situations...)
07-08-2016, 07:28 AM
Post: #8
 parisse Senior Member Posts: 1,105 Joined: Dec 2013
RE: Why solve() is not solving?
There is an invalid char in your definition (charcode E003). This makes the equation a symbolic equation depending on this variable (i.e. gamma(x,1,1,1) depends on x and this variable),
07-08-2016, 12:01 PM
Post: #9
 tiamattia Junior Member Posts: 17 Joined: Jul 2016
RE: Why solve() is not solving?
That's i, the imaginary unit. It is defined it in the private user area of the calc charachter map.
07-08-2016, 02:00 PM
Post: #10
 roadrunner Member Posts: 293 Joined: Jun 2015
RE: Why solve() is not solving?
Did you type purge(x) before the solve and fsolve commands? The reason I ask is when I can cut and pasted your equations into the emulator I obtained the expected results: {1.00000005156}. When I typed x:=3 first I got empty brackets: [].

07-08-2016, 04:56 PM (This post was last modified: 07-08-2016 04:56 PM by tiamattia.)
Post: #11
 tiamattia Junior Member Posts: 17 Joined: Jul 2016
RE: Why solve() is not solving?
I tried, still not solving
07-09-2016, 07:58 AM
Post: #12
 parisse Senior Member Posts: 1,105 Joined: Dec 2013
RE: Why solve() is not solving?
I checked with the emulator and got 1.0.
07-09-2016, 12:48 PM
Post: #13
 roadrunner Member Posts: 293 Joined: Jun 2015
RE: Why solve() is not solving?
(07-08-2016 04:56 PM)tiamattia Wrote:  I tried, still not solving

Did you try doing a reset on the emulator? That may be what is needed.