La recherche a retourné 26 résultats

par niccolo
mar. mars 28, 2023 8:15 pm
Forum : Xcas - English
Sujet : "Unholding" variables
Réponses : 1
Vues : 780

"Unholding" variables

Let's say I store an expression in a variable: exprsn := x^2 + 3 Now, I want to turn it into a function, so I do: f(x) := exprsn But then, if I type "f(7)", I get "exprsn" instead of "7^2 + 3". How to fix this? I did "f(x) := eval(exprsn)", and it (seems to?) work. My questions: 1. Is this the corre...
par niccolo
lun. oct. 31, 2022 10:29 am
Forum : Xcas - English
Sujet : Handling big numbers?
Réponses : 5
Vues : 980

Re: Handling big numbers?

Thank you all!
par niccolo
ven. oct. 28, 2022 2:44 am
Forum : Xcas - English
Sujet : Handling big numbers?
Réponses : 5
Vues : 980

Re: Handling big numbers?

Another question:

I want to know if the square root (or, if possible, any n'th root) of a large integer is an integer, how do I do this?

(in other words, I'm not interested in the root itself, only in knowing whether it's integer.)
par niccolo
jeu. oct. 27, 2022 11:17 am
Forum : Xcas - English
Sujet : Handling big numbers?
Réponses : 5
Vues : 980

Handling big numbers?

If I calculate the fourth root of 142241757136172119140621, I wrongly get the impression it's integer, because approx( 142241757136172119140621**(1/4) ) gives me "614125.0". When I calculate this in WolframAlpha , I get a more exact result ("614124.9999999999999999956825266197...."). Ok, I get it th...
par niccolo
jeu. août 13, 2020 7:05 pm
Forum : Xcas - English
Sujet : solve([a+b=6, a/b=1/2], a)
Réponses : 1
Vues : 2115

solve([a+b=6, a/b=1/2], a)

I don't understand this:

solve([a+b=6, a/b=1/2], a) returns []
solve([a+b=6, a/b=1/2], [a]) returns []
solve([a+b=6, a/b=1/2], [a,b]) returns [[2,4]] (correctly)

Is this a bug?

(Is this somehow related to solve([2*x=2,x=1.0], x) ?)
par niccolo
lun. juin 22, 2020 3:23 pm
Forum : Bugs
Sujet : "autosave" feature moves focus to the application
Réponses : 6
Vues : 4019

Re: "autosave" feature moves focus to the application

(A year has passed.) An update: I've upgraded to Ubuntu 20.04, and installed xcas 1.5.0 (using Ubuntu's official package manager). The problem has returned: 'xcas' steals the focus. Highly annoying . I found two solutions: (1) Before switching to some other app, save the session. (2) Before switchin...
par niccolo
dim. juin 23, 2019 1:23 pm
Forum : Xcas - English
Sujet : solve([2*x=2,x=1.0], x)
Réponses : 1
Vues : 1777

solve([2*x=2,x=1.0], x)

solve([2*x=2,x=1.0], [x]) returns [[1.0]].
solve([2*x=2,x=1.0], x) returns [].

Is this a bug?

(I know I can write "1" instead of "1.0", and then I get the solution in either case. My "complaint" here is about having to write "[x]" instead of "x".)
par niccolo
mer. juin 19, 2019 12:33 am
Forum : Xcas - English
Sujet : A problem formatting a list returned from solve()
Réponses : 4
Vues : 2364

Re: A problem formatting a list returned from solve()

Aaahhh.....

I think I understand why xcas displays [[1,2,3]] the way it does: it's a matrix. One that happens to have a single row.

Still, it's problematic that we can't tell the difference between [1,2,3] and [[1,2,3]].

Is there a hidden configuration option to "fix" this?
par niccolo
mar. juin 18, 2019 10:44 pm
Forum : Xcas - English
Sujet : A problem formatting a list returned from solve()
Réponses : 4
Vues : 2364

Re: A problem formatting a list returned from solve()

I've found the problem:

solve() returns a list of lists. So I have to use 'solution[0]', not 'solution'.

I wasn't aware of this because xcas displays this:

[[1,2,3]]

the same as this:

[1,2,3]

So I had no way of knowing there was a list inside :-(

That's a big problem.

Why does xcas do this?
par niccolo
mar. juin 18, 2019 7:27 pm
Forum : Xcas - English
Sujet : A problem formatting a list returned from solve()
Réponses : 4
Vues : 2364

A problem formatting a list returned from solve()

I have a solution to some problem: solution := [z-4, 25-2*z, z] And I'm trying to see what happens when 'z' runs from 0 to 9, so I do: makelist(x->subst(solution, [z=x]), 0, 9) This works ok. 'xcas' displays the big list as a nice matrix which is easy to read. The problem is that in reality my 'solu...
par niccolo
mer. juin 12, 2019 6:44 pm
Forum : Xcas - English
Sujet : Automatically load my own functions on startup
Réponses : 6
Vues : 3344

Re: Automatically load my own functions on startup

I did this by using the following: I modified runxcas.en to: Thanks. I considered this solution, but it's flawed for me: I usually launch xcas from the directory I work in, as I want xcas to save the file to the diretcory I'm in, without me navigating there. But if I load it with a template file, i...
par niccolo
mer. juin 12, 2019 6:13 pm
Forum : Xcas - English
Sujet : solve([x=1,y=2],[x,y])
Réponses : 2
Vues : 1628

Re: solve([x=1,y=2],[x,y])

I suspect I understand why. It's because "x=1" (the solution I was expecting) isn't a solution to the set of equations. In other words, it's as if giac does "subst(equation_set, solution)" and if not *all* the equations in equation_set evaluate to 'true', it's not considered a solution. E.g., "subst...
par niccolo
mer. juin 12, 2019 5:57 pm
Forum : Xcas - English
Sujet : solve([x=1,y=2],[x,y])
Réponses : 2
Vues : 1628

solve([x=1,y=2],[x,y])

Hello!

The following works:

Code : Tout sélectionner

solve([x=1,y=2],[x,y])
But when I do:

Code : Tout sélectionner

solve([x=1,y=2],[x])
I don't get any solution. Why is that?
par niccolo
mar. mai 28, 2019 12:48 pm
Forum : Xcas - English
Sujet : vector^2 without a warning?
Réponses : 3
Vues : 2009

Re: vector^2 without a warning?

Just follow the hint: replace ^ by .^ like (pointB - pointA).^2 Given the vector [a,b,c], I want to arrive at a^2 + b^2 + c^2. [a,b,c]^2 does this (but gives a warning). [a,b,c].^2 gives [a^2, b^2, c^2]. Not good. I know I can do "[a,b,c]*[a,b,c]" or "sum([a,b,c].^2)", but I was wondering if there'...
par niccolo
mar. mai 28, 2019 10:30 am
Forum : Xcas - English
Sujet : vector^2 without a warning?
Réponses : 3
Vues : 2009

vector^2 without a warning?

I often need to "dot product" a vector with itself. E.g., "(pointB - pointA)^2". But when I do this I see the warning: Warning, ^ is ambiguous on non square matrices. Use .^ to apply ^ element by element. Is there a way to get rid of this warning? I know I can do "dot(expr, expr)" instead, but then ...