Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2014-04-03 13:48:22

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Sage

Solve[Sqrt[x-1]-Sqrt[x+1] +1==0,x]

The above is Mathematica code. How do I solve that equation with Sage?


'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

#2 2014-04-03 13:51:31

ShivamS
Member
Registered: 2011-02-07
Posts: 3,648

Re: Sage

solve(sqrt(x-1)-sqrt(x+1) +1==0,x)
Sorry, this doesn't work. Haven't used Sage in a long time after switching to Mathematica. I don't know why it doesn't work though...

Last edited by ShivamS (2014-04-03 13:54:29)

Offline

#3 2014-04-03 13:59:33

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: Sage

I've tried that. I can't solve this equation with Maxima either.

Only gAr can tell


'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

#4 2014-04-03 19:12:55

gAr
Member
Registered: 2011-01-09
Posts: 3,482

Re: Sage

Hi,

Its syntax is

solve([sqrt(x-1)-sqrt(x+1)==-1],x)

But it doesn't solve it though, Sage and maxima seems to have a problem when square roots are involved like that.
That has frustrated me a few times.
So we need to either manually eliminate the roots or write a program to eliminate roots, and then give that equation to solve.
Introduces some extra solutions, so we need to weed out the extras later.

For now, use this input instead:

solve([(8*sqrt(x + 1)*sqrt(x - 1)*x)^2==(8*x^2 - 5)^2],x)

[x == (-5/4), x == (5/4)]
So, for the original equation, x=5/4


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

#5 2014-04-03 19:19:47

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: Sage

How did you get this equation?

[(8*sqrt(x + 1)*sqrt(x - 1)*x)^2==(8*x^2 - 5)^2]

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

#6 2014-04-03 19:30:50

gAr
Member
Registered: 2011-01-09
Posts: 3,482

Re: Sage

Ah, I was using the code from here
Did not eliminate sqrt completely, so needs to be modified.


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

#7 2014-04-03 19:34:38

gAr
Member
Registered: 2011-01-09
Posts: 3,482

Re: Sage

Wait, an easier workaround!

solve([y==sqrt(x-1),y==sqrt(x+1)-1],x,y)

[[x == (5/4), y == (1/2)]]
which is just perfect!


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

#8 2014-04-03 19:56:03

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: Sage

Why does the simplest idea not work but the complicated ones do?


'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

#9 2014-04-03 20:06:14

gAr
Member
Registered: 2011-01-09
Posts: 3,482

Re: Sage

Why does the simplest idea not work but the complicated ones do?

Why, wan't #7 simple?


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

#10 2014-04-03 20:15:27

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: Sage

Yes, It was.

I am only curious


'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

Board footer

Powered by FluxBB