Post Reply 
Why solve() is not solving?
07-07-2016, 01:22 PM
Post: #1
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?
Find all posts by this user
Quote this message in a reply
07-07-2016, 02:34 PM
Post: #2
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?
Find all posts by this user
Quote this message in a reply
07-07-2016, 02:39 PM
Post: #3
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.
Find all posts by this user
Quote this message in a reply
07-07-2016, 04:19 PM
Post: #4
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.
Find all posts by this user
Quote this message in a reply
07-07-2016, 05:11 PM
Post: #5
RE: Why solve() is not solving?
Hello Tim,
I defined it with this cmd:
   
Find all posts by this user
Quote this message in a reply
07-07-2016, 08:31 PM
Post: #6
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.
Find all posts by this user
Quote this message in a reply
07-07-2016, 10:22 PM
Post: #7
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...)
Find all posts by this user
Quote this message in a reply
07-08-2016, 07:28 AM
Post: #8
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),
Find all posts by this user
Quote this message in a reply
07-08-2016, 12:01 PM
Post: #9
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.
Find all posts by this user
Quote this message in a reply
07-08-2016, 02:00 PM
Post: #10
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: [].

-road
Find all posts by this user
Quote this message in a reply
07-08-2016, 04:56 PM (This post was last modified: 07-08-2016 04:56 PM by tiamattia.)
Post: #11
RE: Why solve() is not solving?
I tried, still not solving
Find all posts by this user
Quote this message in a reply
07-09-2016, 07:58 AM
Post: #12
RE: Why solve() is not solving?
I checked with the emulator and got 1.0.
Find all posts by this user
Quote this message in a reply
07-09-2016, 12:48 PM
Post: #13
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.

-road
Find all posts by this user
Quote this message in a reply
07-09-2016, 01:57 PM
Post: #14
RE: Why solve() is not solving?
No, i haven't tried yet. I will try as soos as I can.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)