Post Reply 
Cas.solve Problem
08-13-2024, 05:12 PM
Post: #1
Cas.solve Problem
Hi guys,

Im currently studying quantum physics, so i solve a lot of equations with very large or small numbers, like the speed of light, etc. The problem im having right now is, when i try to solve equations with the "solve" function in cas mode, the calculator shows me "two brackets" with nothing inside them, like an empty result, or sometimes the hp prime just crashes and restarts. Take for example this equation:[Image: FWtmyt9]
(i will also attached a photo of the equation just in case)
The solution must be 299999999.966 and the calculator shows me nothing. Can someone help me?


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
08-13-2024, 10:03 PM (This post was last modified: 08-13-2024 10:47 PM by ftneek.)
Post: #2
RE: Cas.solve Problem
You can try solving symbolically and then substituting in values afterwards

Ex:
solve((a*b) = (x*30/(sqrt(1-x^2/b^2))),x)
and then subst(Ans,a=2*10^6,b=3*10^8)

- neek
Find all posts by this user
Quote this message in a reply
08-14-2024, 01:37 AM
Post: #3
RE: Cas.solve Problem
Thank you so much ftneek!! Solving it simbolically is certainly anther option. Do you know why the hp prime cant solve it with the numbers directly instead of the symbols?
Find all posts by this user
Quote this message in a reply
08-14-2024, 03:12 AM (This post was last modified: 08-14-2024 04:03 PM by Gene222.)
Post: #4
RE: Cas.solve Problem
The solve app also gives the answer as 299,999,999.966. The downside of the solve app is that you have to provide an initial guess, and I don't think it can handle complex numbers.
Find all posts by this user
Quote this message in a reply
08-14-2024, 05:37 AM
Post: #5
RE: Cas.solve Problem
(08-14-2024 01:37 AM)megamanu Wrote:  Thank you so much ftneek!! Solving it simbolically is certainly anther option. Do you know why the hp prime cant solve it with the numbers directly instead of the symbols?

No problem. The trouble is likely the size of the constants in this equation. Doing a few steps by hand you see the calculation becomes even larger than it is initially, at some point you might exceed the largest integer that can be represented on the Prime.

That's why for physics problems where the constants are large, or in general, its a good idea to try and solve symbolically first because during the solving process the size of the expression likely does not grow that large compared to the size of the constants, and the CAS works well with symbols.

- neek
Find all posts by this user
Quote this message in a reply
08-14-2024, 06:19 AM (This post was last modified: 08-14-2024 10:57 AM by C.Ret.)
Post: #6
RE: Cas.solve Problem
(08-14-2024 01:37 AM)megamanu Wrote:  Do you know why the hp prime cant solve it with the numbers directly instead of the symbols?

Our messages crossed. Consider this answer as a complement to the arguments given by ftneek. May he feel free to complete or correct my answer.

The fact that the HP Prime does not find a solution to this equation in CAS mode while it finds a symbolic one comes from the very foundation of a CAS system. In CAS mode, the SOLVE instruction will give a symbolic solution no matter what.

On the other hand, if the equation is only numerical then, for convenience, this same SOLVE instruction will attempt a numerical approach. Hence the display of the intermediate screen.
Unlike other resolution instructions present elsewhere in other applications of the HP Prime, its numerical range is narrower in CAS (a consequence linked to the implementation of it) and above all strongly dependent on the initial conditions.

If the user enters a purely symbolic expression to the equation in CAS.SOLVE, there is no ambiguity and the symbolic approach will give a symbolic answer.
On the other hand, a problem arises if the user gives numerical values ​​to the equation to be solved without specifying any initial value for the numerical search. Unlike the SOLVE instructions of specific applications, the absence of an initial value often does not lead to any result.

On the following screenshot, I illustrate two approaches allowing a numerical result in CAS mode. The first suggested by ftneek is done in two steps, the first of which requires the enumeration of the symbolic solutions.
As well as an alternative method that leaves the choice to the CAS system of the method but without forgetting to give the unknown x a coherent initial value facilitating the numerical resolution.

[Image: attachment.php?aid=13817]

Of course, the numerical method can lead to approximate results. While the symbolic method will give more precise and more accurate results.
Here, only the symbolic method gives 299999999.966, the numerical method results in 3*10⁸.


Hoping that this helps a little.
Kind regards.


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
08-14-2024, 12:09 PM (This post was last modified: 08-14-2024 12:10 PM by megamanu.)
Post: #7
RE: Cas.solve Problem
(08-14-2024 06:19 AM)C.Ret Wrote:  
(08-14-2024 01:37 AM)megamanu Wrote:  Do you know why the hp prime cant solve it with the numbers directly instead of the symbols?

Our messages crossed. Consider this answer as a complement to the arguments given by ftneek. May he feel free to complete or correct my answer.

The fact that the HP Prime does not find a solution to this equation in CAS mode while it finds a symbolic one comes from the very foundation of a CAS system. In CAS mode, the SOLVE instruction will give a symbolic solution no matter what.

On the other hand, if the equation is only numerical then, for convenience, this same SOLVE instruction will attempt a numerical approach. Hence the display of the intermediate screen.
Unlike other resolution instructions present elsewhere in other applications of the HP Prime, its numerical range is narrower in CAS (a consequence linked to the implementation of it) and above all strongly dependent on the initial conditions.

If the user enters a purely symbolic expression to the equation in CAS.SOLVE, there is no ambiguity and the symbolic approach will give a symbolic answer.
On the other hand, a problem arises if the user gives numerical values ​​to the equation to be solved without specifying any initial value for the numerical search. Unlike the SOLVE instructions of specific applications, the absence of an initial value often does not lead to any result.

On the following screenshot, I illustrate two approaches allowing a numerical result in CAS mode. The first suggested by ftneek is done in two steps, the first of which requires the enumeration of the symbolic solutions.
As well as an alternative method that leaves the choice to the CAS system of the method but without forgetting to give the unknown x a coherent initial value facilitating the numerical resolution.

[Image: attachment.php?aid=13817]

Of course, the numerical method can lead to approximate results. While the symbolic method will give more precise and more accurate results.
Here, only the symbolic method gives 299999999.966, the numerical method results in 3*10⁸.


Hoping that this helps a little.
Kind regards.

Thank you so much C.ret!! Crystal clear the explanation. From now on, i will approach this type of excercises with these two methods. Thanks a lot people!
Find all posts by this user
Quote this message in a reply
08-15-2024, 06:45 PM
Post: #8
RE: Cas.solve Problem
(08-14-2024 05:37 AM)ftneek Wrote:  The trouble is likely the size of the constants in this equation ...
where the constants are large, or in general, its a good idea to try and solve symbolically first

What is large? It is all relative, depends on how we define the problem.

Cas> solve(x = sqrt(1-(a*x)^2))                    → []
Cas> solve(x = sqrt(1-(a*x)^2) * b) (b=1)     → {1/√(a^2+1)}

Here, even implied multiply (by 1) need symbol b, is 1 too large?
What about the 1 inside square root ... is that too large too?

I wish solver can figure this out, without user decide what constants need to be symbolic.
In the meantime, remove square root is the way to go, allow solver to recognize quadratic.

Cas> solve(x^2 = (1-(a*x)^2) AND x>=0)     → {1/√(a^2+1)}
Find all posts by this user
Quote this message in a reply
08-15-2024, 08:02 PM
Post: #9
RE: Cas.solve Problem
With my Prime dev version (or with Xcas) and default settings, I get list[1/(sqrt(a^2+1)),-1/(sqrt(a^2+1))] for solve(x = sqrt(1-(a*x)^2)).
Find all posts by this user
Quote this message in a reply
08-15-2024, 11:35 PM
Post: #10
RE: Cas.solve Problem
(08-15-2024 06:45 PM)Albert Chan Wrote:  
(08-14-2024 05:37 AM)ftneek Wrote:  The trouble is likely the size of the constants in this equation ...
where the constants are large, or in general, its a good idea to try and solve symbolically first

What is large? It is all relative, depends on how we define the problem.

Cas> solve(x = sqrt(1-(a*x)^2))                    → []
Cas> solve(x = sqrt(1-(a*x)^2) * b) (b=1)     → {1/√(a^2+1)}

Here, even implied multiply (by 1) need symbol b, is 1 too large?
What about the 1 inside square root ... is that too large too?

I wish solver can figure this out, without user decide what constants need to be symbolic.
In the meantime, remove square root is the way to go, allow solver to recognize quadratic.

Cas> solve(x^2 = (1-(a*x)^2) AND x>=0)     → {1/√(a^2+1)}
So, what do you recommend me to do in this case? Solve it simbolically as the other user said?
Find all posts by this user
Quote this message in a reply
08-16-2024, 12:16 AM
Post: #11
RE: Cas.solve Problem
(08-15-2024 11:35 PM)megamanu Wrote:  So, what do you recommend me to do in this case? Solve it simbolically as the other user said?

I would remove square root by squaring both side, then solve simple quadratic.

Cas> problem := (2*10^6*3*10^8 = 30*x/sqrt(1-x^2/(3*10^8)^2)
Cas> solve(simplify(problem^2)) + 0.

{−299999999.966, 299999999.966}
Find all posts by this user
Quote this message in a reply
08-16-2024, 01:41 AM
Post: #12
RE: Cas.solve Problem
Thank you very much!
Find all posts by this user
Quote this message in a reply
Post Reply 




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