Ask Your Question

sgia's profile - activity

2023-07-31 19:53:01 +0200 received badge  Nice Question (source)
2023-07-31 19:52:54 +0200 received badge  Popular Question (source)
2022-01-30 02:42:05 +0200 asked a question Sage cannot simplify expressions with radical functions?

Sage cannot simplify expressions with radical functions? Sage cannot seem to simplify symbolic expressions containing ra

2021-06-02 17:03:41 +0200 received badge  Good Answer (source)
2021-06-02 17:03:36 +0200 received badge  Nice Question (source)
2021-01-14 11:22:24 +0200 received badge  Famous Question (source)
2017-03-13 01:34:01 +0200 received badge  Notable Question (source)
2016-07-23 01:08:59 +0200 received badge  Famous Question (source)
2015-10-29 04:10:00 +0200 received badge  Notable Question (source)
2014-12-05 04:35:32 +0200 received badge  Popular Question (source)
2014-04-27 13:38:41 +0200 received badge  Popular Question (source)
2013-04-20 22:43:34 +0200 received badge  Nice Question (source)
2013-04-20 18:07:12 +0200 asked a question Sage cannot simplify arccos, but can simplify arcsin?

I am using Sage 5.7. It can simplify expressions involving arcsin, but not arccos, why?

Thanks

assume(x > 0)
assume(x < pi/2)
acos(cos(x)).simplify_full()

output: arccos(cos(x))

asin(sin(x)).simplify_full()

output: x
2013-04-07 09:31:12 +0200 received badge  Nice Answer (source)
2013-04-07 04:08:02 +0200 received badge  Teacher (source)
2013-04-07 04:08:02 +0200 received badge  Self-Learner (source)
2013-04-07 00:25:45 +0200 answered a question How to substitute a function within derivatives?

I figured this out. Sage's behavior is confusing to say the least. To make it work, I need the following:

gx=function('g', x)
dgx = gx.diff(x)
dgx

sage output: D[0](g)(x)

m(x)=h(x)*x
dgx.substitute_function(g, m)

sage output: x*D[0](h)(x) + h(x)

What's happening, as I understand, is:

  • function('g', x) has a side effect of creating a variable g with type : class 'sage.symbolic.function_factory.NewSymbolicFunction' which is important for my purpose, but the statement also returns an Express g(x). My original version assigned the returned Express to g, which overrided the NewSymbolicFunction that I need

  • I need to use .substitute_function() method instead of .subs(), and for that to work, I also need to first create another function m(x)

This seems unnecessarily complex and unintuitive. Is there a better way?

Thanks

2013-03-28 18:24:31 +0200 received badge  Student (source)
2013-03-22 00:03:00 +0200 answered a question How to substitute a function within derivatives?

The code does not show up correctly, trying again:

g=function('g', x)
h=function('h', x)
dg = g.diff(x)
dg
sage output: D[0](g)(x)

dg.subs(g==h*x)
sage output: D[0](g)(x)
2013-03-21 23:59:28 +0200 asked a question How to substitute a function within derivatives?

I want to simplify an ODE by making a substitution, say g(x) -> h(x)*x, but can't get it to work. I tried:

g=function('g', x)
h=function('h', x)
dg = g.diff(x)
dg

sage output: D[0](g)(x)

dg.subs(g==h*x)

sage output: D[0](g)(x)

The substitution is not done for the g function within derivatives. I tried dg.subs(g(x)==h(x)*x) too, got deprecation warnings and the same results. How can I make this work? This is a simplified example, in reality, instead of dg, I have the lhs of an ODE defined interms of g(x).

Thanks